Re: [PATCH] x86: kill handle_signal()->set_fs()

From: H. Peter Anvin
Date: Sun Jul 10 2011 - 14:27:03 EST


On 07/10/2011 09:44 AM, Oleg Nesterov wrote:
> handle_signal()->set_fs() has a nice comment which explains what
> set_fs() is, but it doesn't explain why it is needed and why it
> depends on CONFIG_X86_64.
>
> Afaics, the history of this confusion is:
>
> 1. I guess today nobody can explain why it was needed
> in arch/i386/kernel/signal.c, perhaps it was always
> wrong. This predates 2.4.0 kernel.
>
> 2. then it was copy-and-past'ed to the new x86_64 arch.
>
> 3. then it was removed from i386 (but not from x86_64)
> by b93b6ca3 "i386: remove unnecessary code".
>
> 4. then it was reintroduced under CONFIG_X86_64 when x86
> unified i386 and x86_64, because the patch above didn't
> touch x86_64.
>
> Remove it. ->addr_limit should be correct. Even if it was possible
> that it is wrong, it is too late to fix it after setup_rt_frame().
>

The main reason I could think of why this would be necessary is if we
take an event while we have fs == KERNEL_DS inside the kernel which is
then promoted to a signal. Are you absolutely sure that can't happen?

In particular, there should be a setting upstream of this, as you're
correctly pointing out that it's too late. If not, we might actually
have a problem.

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/