From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932140AbbJMBER (ORCPT ); Mon, 12 Oct 2015 21:04:17 -0400 Received: from mail.kernel.org ([198.145.29.136]:41861 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752973AbbJMBEM (ORCPT ); Mon, 12 Oct 2015 21:04:12 -0400 From: Andy Lutomirski To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Brian Gerst , Denys Vlasenko , Linus Torvalds , Borislav Petkov , Stas Sergeev , Andy Lutomirski Subject: [RFC 0/4] x86: sigcontext SS fixes, take 2 Date: Mon, 12 Oct 2015 18:04:04 -0700 Message-Id: X-Mailer: git-send-email 2.4.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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