All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] x86_64,signal: Fix the set of saved segment registers
@ 2014-07-11 16:29 Andy Lutomirski
  2014-07-11 16:29 ` [PATCH 1/2] x86_64,signal: Save and restore SS in signal frames Andy Lutomirski
  2014-07-11 16:29 ` [PATCH 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext Andy Lutomirski
  0 siblings, 2 replies; 16+ messages in thread
From: Andy Lutomirski @ 2014-07-11 16:29 UTC (permalink / raw)
  To: H. Peter Anvin, Andi Kleen; +Cc: Al Viro, x86, linux-kernel, Andy Lutomirski

The x86_64 signal code claims to save and restore CS, FS, and GS,
and it further claims that this is the minimal set that's needed.

Neither of these claims is true.  The code does not, and AFAICT
never has, saved or restored FS and GS, nor does it need to.  On the
other hand, all 64-bit syscalls (and rt_sigreturn in particular)
clobber SS, making it impossible for signal handlers to correctly
restore SS without using a trampoline or ptracing themselves.

This patchset saves and restores SS in the __pad0 slot and renames
the FS and GS slots __pad1 and __pad2 to more accurately document
their purpose.

I discovered this while writing a test for espfix64.

Andy Lutomirski (2):
  x86_64,signal: Save and restore SS in signal frames
  x86_64,signal: Remove 'fs' and 'gs' from sigcontext

 arch/x86/include/asm/sigcontext.h      |  6 +++---
 arch/x86/include/uapi/asm/sigcontext.h |  6 +++---
 arch/x86/kernel/signal.c               | 12 +++---------
 3 files changed, 9 insertions(+), 15 deletions(-)

-- 
1.9.3


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-03-09 20:15 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 16:29 [PATCH 0/2] x86_64,signal: Fix the set of saved segment registers Andy Lutomirski
2014-07-11 16:29 ` [PATCH 1/2] x86_64,signal: Save and restore SS in signal frames Andy Lutomirski
2015-03-09 20:15   ` Andy Lutomirski
2014-07-11 16:29 ` [PATCH 2/2] x86_64,signal: Remove 'fs' and 'gs' from sigcontext Andy Lutomirski
2014-07-11 18:12   ` Andi Kleen
2014-07-11 18:39     ` Andy Lutomirski
2014-07-12  2:09       ` H. Peter Anvin
2014-07-12  2:04   ` H. Peter Anvin
2014-07-12  2:21   ` Linus Torvalds
2014-07-12  2:26     ` H. Peter Anvin
2014-07-12  8:39     ` Andy Lutomirski
2014-07-12 18:37       ` Andi Kleen
2014-07-12 18:40         ` H. Peter Anvin
2014-07-12 18:52           ` Andi Kleen
2014-07-12 21:17             ` Andy Lutomirski
2014-07-18  1:13               ` Andy Lutomirski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.