[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUe4_aRybxQGo=6cwNNg_-0No5EM9OiQ6y4ja-KncU+8w@mail.gmail.com>
Date: Thu, 11 Feb 2016 16:46:31 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Borislav Petkov <bp@...en8.de>
Cc: Andy Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Stas Sergeev <stsp@...t.ru>,
Cyrill Gorcunov <gorcunov@...il.com>,
Pavel Emelyanov <xemul@...allels.com>
Subject: Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS
On Thu, Feb 11, 2016 at 11:53 AM, Borislav Petkov <bp@...en8.de> wrote:
> 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 <luto@...nel.org>
>> ---
>> 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 <sys/user.h>
>>
>> /*
>> + * 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.
Indeed.
>
>> + */
>> +#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?
>
Too tangled. Adding:
#include "../../../../arch/x86/include/asm/desc_defs.h"
Complains that u16 isn't a type. Trying to include types.h doesn't
work well either.
--Andy
Powered by blists - more mailing lists