函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:arch\x86\kernel\dumpstack_32.c Create Date:2022-07-27 08:33:01
首页 Copyright©Brick

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
int get_stack_info(unsigned long *stack, struct task_struct *task,
           struct stack_info *info, unsigned long *visit_mask)
{
    if (!stack)
        goto unknown;
 
    task = task ? : current;
 
    if (in_task_stack(stack, task, info))
        goto recursion_check;
 
    if (task != current)
        goto unknown;
 
    if (in_entry_stack(stack, info))
        goto recursion_check;
 
    if (in_hardirq_stack(stack, info))
        goto recursion_check;
 
    if (in_softirq_stack(stack, info))
        goto recursion_check;
 
    if (in_doublefault_stack(stack, info))
        goto recursion_check;
 
    goto unknown;
 
recursion_check:
    /*
     * Make sure we don't iterate through any given stack more than once.
     * If it comes up a second time then there's something wrong going on:
     * just break out and report an unknown stack type.
     */
    if (visit_mask) {
        if (*visit_mask & (1UL << info->type)) {
            printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type);
            goto unknown;
        }
        *visit_mask |= 1UL << info->type;
    }
 
    return 0;
 
unknown:
    info->type = STACK_TYPE_UNKNOWN;
    return -EINVAL;
}