问号“"是什么意思?在Linux内核中的紧急呼叫跟踪? [英] What is the meaning of question marks '?' in Linux kernel panic call traces?

查看:273
本文介绍了问号“"是什么意思?在Linux内核中的紧急呼叫跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

呼叫跟踪"包含类似这样的条目:

The Call Trace contains entries like that:

 [<deadbeef>] FunctionName+0xAB/0xCD [module_name]
 [<f00fface>] ? AnotherFunctionName+0x12/0x40 [module_name]
 [<deaffeed>] ClearFunctionName+0x88/0x88 [module_name]

'是什么意思?标记在AnotherFunctionName之前?

What is the meaning of the '?' mark before AnotherFunctionName?

推荐答案

'?'表示有关此堆栈条目的信息可能不可靠.

'?' means that the information about this stack entry is probably not reliable.

堆栈输出机制(请参见 dump_trace()函数的实现)无法证明找到的地址是调用堆栈中的有效返回地址.

The stack output mechanism (see the implementation of dump_trace() function) was unable to prove that the address it has found is a valid return address in the call stack.

'?'本身由 printk_stack_address()输出.

堆栈条目可能有效或无效.有时,人们可能会简单地跳过它. 研究相关模块的反汇编以查看在ClearFunctionName+0x88(或在x86上紧接该位置的位置)处调用了哪个函数可能会有所帮助.

The stack entry may be valid or not. Sometimes one may simply skip it. It may be helpful to investigate the disassembly of the involved module to see which function is called at ClearFunctionName+0x88 (or, on x86, immediately before that position).

关于可靠性

在x86上,当调用dump_stack()时,实际检查堆栈的函数为arch/x86/kernel/dumpstack.c中定义的print_context_stack().看看它的代码,我将在下面尝试解释它.

On x86, when dump_stack() is called, the function that actually examines the stack is print_context_stack() defined in arch/x86/kernel/dumpstack.c. Take a look at its code, I'll try to explain it below.

我假设DWARF2堆栈展开功能在您的Linux系统中不可用(很可能,如果不是OpenSUSE或SLES,则它们不可用).在这种情况下,print_context_stack()似乎可以执行以下操作.

I assume DWARF2 stack unwind facilities are not available in your Linux system (most likely, they are not, if it is not OpenSUSE or SLES). In this case, print_context_stack() seems to do the following.

它从保证是堆栈位置地址的地址(代码中的堆栈"变量)开始.它实际上是dump_stack()中局部变量的地址.

It starts from an address ('stack' variable in the code) that is guaranteed to be an address of a stack location. It is actually the address of a local variable in dump_stack().

该函数反复递增该地址(while (valid_stack_ptr ...) { ... stack++}),并检查其指向的内容是否也可能是内核代码(if (__kernel_text_address(addr)) ...)中的地址.这样,它会尝试查找调用这些函数时推入堆栈的函数的返回地址.

The function repeatedly increments that address (while (valid_stack_ptr ...) { ... stack++}) and checks if what it points to could also be an address in the kernel code (if (__kernel_text_address(addr)) ...). This way it attempts to find the functions' return addresses pushed on stack when these functions were called.

当然,并非每个看起来像返回地址的无符号long值实际上都是一个返回地址.因此该函数尝试对其进行检查.如果在内核代码中使用了帧指针(如果设置了CONFIG_FRAME_POINTER,则使用%ebp/%rbp寄存器),则可以使用它们遍历函数的堆栈帧.函数的返回地址恰好在帧指针上方(即在%ebp/%rbp + sizeof(unsigned long)处). print_context_stack对此进行了精确检查.

Of course, not every unsigned long value that looks like a return address is actually a return address. So the function tries to check it. If frame pointers are used in the code of the kernel (%ebp/%rbp registers are employed for that if CONFIG_FRAME_POINTER is set), they can be used to traverse the stack frames of the functions. The return address for a function lies just above the frame pointer (i.e. at %ebp/%rbp + sizeof(unsigned long)). print_context_stack checks exactly that.

如果存在一个堆栈帧,其值"stack"指向的是返回地址,则该值被视为可靠的堆栈条目. ops->address将被reliable == 1调用,最终将调用printk_stack_address(),并且该值将作为可靠的调用堆栈条目输出.否则,该地址将被视为不可靠.无论如何都将输出,但带有?"

If there is a stack frame for which the value 'stack' points to is the return address, the value is considered a reliable stack entry. ops->address will be called for it with reliable == 1, it will eventually call printk_stack_address() and the value will be output as a reliable call stack entry. Otherwise the address will be considered unreliable. It will be output anyway but with '?' prepended.

[NB]如果帧指针信息不可用(例如,默认情况下在Debian 6中是这样),则出于这个原因,所有调用堆栈条目都将被标记为不可靠.

[NB] If frame pointer information is not available (e.g. like it was in Debian 6 by default), all call stack entries will be marked as unreliable for this reason.

具有DWARF2展开支持(并且已设置CONFIG_STACK_UNWIND)的系统完全是另一回事.

The systems with DWARF2 unwinding support (and with CONFIG_STACK_UNWIND set) is a whole another story.

这篇关于问号“"是什么意思?在Linux内核中的紧急呼叫跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆