Skip to contentSkip to conversation

2.6.18-rc3-g3b445eea BUG: warning at /usr/src/linux-git/kernel/cpu.c:51

DISCUSSION Chuck Ebbert 3 participants 4 messages Aug 8, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 5 lines · Jan Beulich
Quoted 1 line

Most likely the CFI annotation for that sysenter path is not complete.

Correct, the return point of sysexit (SYSENTER_RETURN) is still in kernel space, but its annotations are invisible to the unwinder. We should make the VDSO be treated as user-mode code despite living above PAGE_OFFSET.

Umm, that's already been done?

include/asm-i386/unwind.h::arch_unw_user_mode():

        return info->regs.eip < PAGE_OFFSET
               || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
                    && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
               || info->regs.esp < PAGE_OFFSET;

Could this be the problem?

|ENTRY(sysenter_entry)
|        CFI_STARTPROC simple
|        CFI_DEF_CFA esp, 0
|==>     CFI_REGISTER esp, ebp
|        movl TSS_sysenter_esp0(%esp),%esp
|sysenter_past_esp:

What does that do? .cfi_register is not documented anywhere, not even in the gnu.org online documentation for gas. (I spent 10 minutes googling and found nothing other than the changeset that added it to gas.)

Signature · 1 line
Chuck
#1 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Chuck Ebbert <[email protected]> 08.08.06 02:39 >>>

In-Reply-To: <[email protected]>

Quoted 5 lines · Jan Beulich
Quoted 1 line

Most likely the CFI annotation for that sysenter path is not complete.

Correct, the return point of sysexit (SYSENTER_RETURN) is still in kernel space, but its annotations are invisible to the unwinder. We should make the VDSO be treated as user-mode code despite living above PAGE_OFFSET.

Quoted 7 lines

Umm, that's already been done?

include/asm-i386/unwind.h::arch_unw_user_mode():

       return info->regs.eip < PAGE_OFFSET
              || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
                   && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
              || info->regs.esp < PAGE_OFFSET;

Hmm, indeed. Then I'm unclear what the problem might be here.

Quoted 8 lines

Could this be the problem?

|ENTRY(sysenter_entry)
|        CFI_STARTPROC simple
|        CFI_DEF_CFA esp, 0
|==>     CFI_REGISTER esp, ebp
|        movl TSS_sysenter_esp0(%esp),%esp
|sysenter_past_esp:

Clearly not. That is the way the user stack gets communicated to the kernel, and it would cause problems at earliest in the next outer frame (which is in user mode, so we don't care anyway). And I know I saw it unwind properly through the sysenter code in other cases in the past.

Quoted 4 lines

What does that do? .cfi_register is not documented anywhere, not even in the gnu.org online documentation for gas. (I spent 10 minutes googling and found nothing other than the changeset that added it to gas.)

.cfi_register is the directive equivalent to DW_CFA_register, saying that on register is spilled to another (rather than to memory) - see the Dwarf2 (or Dwarf3) specification for details.

Jan

#2 lore raw
Quoted 8 lines
Quoted 6 lines

include/asm-i386/unwind.h::arch_unw_user_mode():

       return info->regs.eip < PAGE_OFFSET
              || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
                   && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
              || info->regs.esp < PAGE_OFFSET;

Hmm, indeed. Then I'm unclear what the problem might be here.

That code will check for the vsyscall page, but sysenter_entry isn't in the vsyscall page, but in the kernel proper.

So it means the EIP never actually reached the vsyscall page. It should have gone up another level, but didn't.

-Andi

Quoted 9 lines
Quoted 9 lines

Could this be the problem?

|ENTRY(sysenter_entry)
|        CFI_STARTPROC simple
|        CFI_DEF_CFA esp, 0
|==>     CFI_REGISTER esp, ebp
|        movl TSS_sysenter_esp0(%esp),%esp
|sysenter_past_esp:
#3 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Andi Kleen <[email protected]> 08.08.06 08:49 >>>

include/asm-i386/unwind.h::arch_unw_user_mode():

       return info->regs.eip < PAGE_OFFSET
              || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
                   && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
              || info->regs.esp < PAGE_OFFSET;
Quoted 7 lines
Quoted 1 line

Hmm, indeed. Then I'm unclear what the problem might be here.

That code will check for the vsyscall page, but sysenter_entry isn't in the vsyscall page, but in the kernel proper.

So it means the EIP never actually reached the vsyscall page. It should have gone up another level, but didn't.

I think we had seen sysenter_past_esp in the stack trace, so it did reach that function. The next outer level should be the VDSO page, shouldn't it?

Jan