]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86: Kill handle_signal()->set_fs()
authorOleg Nesterov <oleg@redhat.com>
Sun, 10 Jul 2011 16:44:24 +0000 (18:44 +0200)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 15 Jul 2011 04:46:20 +0000 (21:46 -0700)
commit73d382deccac186d103496bf10388bc2432a8384
treee842c530bad8ebbf856a7326b7b8987e176f5093
parent9b429620740945363b746414e8b9a84b8119914c
x86: Kill handle_signal()->set_fs()

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().

Linus commented in:
http://lkml.kernel.org/r/alpine.LFD.0.999.0707170902570.19166@woody.linux-foundation.org

... about the equivalent bit from i386:

Heh. I think it's entirely historical.

Please realize that the whole reason that function is called "set_fs()" is
that it literally used to set the %fs segment register, not
"->addr_limit".

So I think the "set_fs(USER_DS)" is there _only_ to match the other

        regs->xds = __USER_DS;
        regs->xes = __USER_DS;
        regs->xss = __USER_DS;
        regs->xcs = __USER_CS;

things, and never mattered. And now it matters even less, and has been
copied to all other architectures where it is just totally insane.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/20110710164424.GA20261@redhat.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/signal.c