[RFC 0/4] x86: sigcontext SS fixes, take 2

From: Andy Lutomirski
Date: Mon Oct 12 2015 - 21:04:21 EST


This is take 2 at fixing x86 64-bit signals wrt SS. After a lot of
thought, this is not controlled by any flags -- I would much prefer
to avoid opt-in behavior. Instead, it just tries hard to avoid
triggering the cases that break DOSEMU.

Stas, what do you think? Could you test this? It applies on top of
tip:x86/asm. You can also find it at
https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=x86/sigcontext&id=fd69bc4e6095d6a7cf2a0f03e69bace025505132

With this applied, all of the x86 selftests pass on x86_64. That
wasn't the case before -- ldt_gdt_64 was broken.

This is a bit risky, and another option would be to do nothing at
all. Then we'd disable the problematic self-tests (sigh), and
DOSEMU and similar tools will be stuck using gross hacks even on new
kernels.

Andy Lutomirski (4):
x86/signal/64: Add a comment about sigcontext->fs and gs
x86/signal/64: Fix SS if needed when delivering a 64-bit signal
x86/signal/64: Re-add support for SS in the 64-bit signal context
selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS

arch/x86/include/asm/desc_defs.h | 23 +++
arch/x86/include/asm/sigcontext.h | 2 +-
arch/x86/include/asm/sighandling.h | 1 -
arch/x86/include/uapi/asm/sigcontext.h | 23 ++-
arch/x86/include/uapi/asm/ucontext.h | 41 +++++-
arch/x86/kernel/signal.c | 115 ++++++++++++---
tools/testing/selftests/x86/Makefile | 4 +-
tools/testing/selftests/x86/sigreturn.c | 240 ++++++++++++++++++++++++++++----
8 files changed, 389 insertions(+), 60 deletions(-)

--
2.4.3

--
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/