[lkml]   [2007]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patches] [PATCH 2.6.21 review I] [4/25] x86: kernel-mode faults pollute current->thead
>>> Andi Kleen <> 10.02.07 12:50 >>>
>From: Jeff Dike <>
>Kernel-mode traps on x86_64 can pollute the trap information for a previous
>userspace trap for which the signal has not yet been delivered to the
>do_trap and do_general_protection set task->thread.error_code and .trapno
>for kernel traps. If a kernel-mode trap arrives between the arrival of a
>userspace trap and the delivery of the associated SISGEGV to the process,
>the process will get the kernel trap information in its sigcontext.
>This causes UML process segfaults, as the trapno that the UML kernel sees
>is 13, rather than the 14 for normal page faults. So, the UML kernel
>passes the SIGSEGV along to its process.
>I don't claim to fully understand the problem. On the one hand, a check in
>do_general_protection for a pending SIGSEGV turned up nothing. On the
>other hand, this patch fixed the UML process segfault problem.
>The patch below moves the setting of error_code and trapno so that that
>only happens in the case of userspace faults. As a side-effect, this
>should speed up kernel-mode fault handling a tiny bit.

This breaks consumers of notify_die() relying on the proper trap number being
passed, as the call to notify_die() from die() currently reads

Also, you seem to leave other places where trap_no gets set untouched -
is this intentional (do_debug - probably correct here, kernel_math_error -
probably incorrect here)?

>I looked at i386, and there is a similar situation. In this case, there is
>duplicate code setting task->thread.error_code and trapno. I deleted one,
>leaving the copy that runs in the case of a userspace fault.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-02-12 10:35    [W:0.137 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site