x86-64: Clear a 64-bit FS/GS base on fork if selector is nonzero
commit05cb94bc742f64a3dcc4e7dbed3e523ffe88c711
authorH. Peter Anvin <hpa@zytor.com>
Fri, 23 Apr 2010 23:17:40 +0000 (23 16:17 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 May 2010 22:02:44 +0000 (12 15:02 -0700)
treebe2b8db7669a1cc3503fd6a3b99cca271aa9e4d6
parent73f0c8de569332547c42046b5cf179483be99bef
x86-64: Clear a 64-bit FS/GS base on fork if selector is nonzero

commit 7ce5a2b9bb2e92902230e3121d8c3047fab9cb47 upstream.

When we do a thread switch, we clear the outgoing FS/GS base if the
corresponding selector is nonzero.  This is taken by __switch_to() as
an entry invariant; it does not verify that it is true on entry.
However, copy_thread() doesn't enforce this constraint, which can
result in inconsistent results after fork().

Make copy_thread() match the behavior of __switch_to().

Reported-and-tested-by: Samuel Thibault <samuel.thibault@inria.fr>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
LKML-Reference: <4BD1E061.8030605@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kernel/process_64.c