From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750983AbcBKTxt (ORCPT ); Thu, 11 Feb 2016 14:53:49 -0500 Received: from mail.skyhub.de ([78.46.96.112]:38210 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcBKTxs (ORCPT ); Thu, 11 Feb 2016 14:53:48 -0500 Date: Thu, 11 Feb 2016 20:53:42 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: X86 ML , "linux-kernel@vger.kernel.org" , Brian Gerst , Denys Vlasenko , Stas Sergeev , Cyrill Gorcunov , Pavel Emelyanov Subject: Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Message-ID: <20160211195342.GI5565@pd.tnic> References: <1f3fc110f71fe0a95530193c6008b0c115328f34.1453754484.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1f3fc110f71fe0a95530193c6008b0c115328f34.1453754484.git.luto@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2016 at 01:34:15PM -0800, Andy Lutomirski wrote: > This tests the two ABI-preserving cases that DOSEMU cares about, and > it also explicitly tests the new UC_SIGCONTEXT_SS and > UC_STRICT_RESTORE_SS flags. > > Signed-off-by: Andy Lutomirski > --- > tools/testing/selftests/x86/sigreturn.c | 240 ++++++++++++++++++++++++++++---- > 1 file changed, 212 insertions(+), 28 deletions(-) > > diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c > index b5aa1bab7416..43e840470e32 100644 > --- a/tools/testing/selftests/x86/sigreturn.c > +++ b/tools/testing/selftests/x86/sigreturn.c > @@ -55,6 +55,47 @@ > #include > > /* > + * Copied from asm/ucontext.h, as asm/ucontext.h conflicts badly with the glibc > + * headers. > + */ > +#ifdef __x86_64__ > +/* > + * UC_SAVED_SS will be set when delivering 64-bit or x32 signals on > + * kernels that save SS in the sigcontext. Kernels that set UC_SAVED_SS > + * allow signal handlers to set UC_RESTORE_SS; if UC_RESTORE_SS is set, > + * then sigreturn will restore SS. > + * > + * For compatibility with old programs, the kernel will *not* set > + * UC_RESTORE_SS when delivering signals. Those UC_SAVED_SS and UC_RESTORE_SS look stale to me. > + */ > +#define UC_SIGCONTEXT_SS 0x2 > +#define UC_STRICT_RESTORE_SS 0x4 > +#endif > + > +/* Access rights as returned by LAR */ > +#define AR_TYPE_RODATA (0 * (1 << 9)) > +#define AR_TYPE_RWDATA (1 * (1 << 9)) > +#define AR_TYPE_RODATA_EXPDOWN (2 * (1 << 9)) > +#define AR_TYPE_RWDATA_EXPDOWN (3 * (1 << 9)) > +#define AR_TYPE_XOCODE (4 * (1 << 9)) > +#define AR_TYPE_XRCODE (5 * (1 << 9)) > +#define AR_TYPE_XOCODE_CONF (6 * (1 << 9)) > +#define AR_TYPE_XRCODE_CONF (7 * (1 << 9)) > +#define AR_TYPE_MASK (7 * (1 << 9)) > + > +#define AR_DPL0 (0 * (1 << 13)) > +#define AR_DPL3 (3 * (1 << 13)) > +#define AR_DPL_MASK (3 * (1 << 13)) > + > +#define AR_A (1 << 8) /* A means "accessed" */ > +#define AR_S (1 << 12) /* S means "not system" */ > +#define AR_P (1 << 15) /* P means "present" */ > +#define AR_AVL (1 << 20) /* AVL does nothing */ > +#define AR_L (1 << 21) /* L means "long mode" */ > +#define AR_DB (1 << 22) /* D or B, depending on type */ > +#define AR_G (1 << 23) /* G means "limit in pages" */ Why not include the kernel header instead of repeating it here again? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.