mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@kernel.org>
Cc: X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>, Stas Sergeev <stsp@list.ru>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Pavel Emelyanov <xemul@parallels.com>
Subject: Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS
Date: Thu, 11 Feb 2016 20:53:42 +0100	[thread overview]
Message-ID: <20160211195342.GI5565@pd.tnic> (raw)
In-Reply-To: <1f3fc110f71fe0a95530193c6008b0c115328f34.1453754484.git.luto@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 <luto@kernel.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.

> + */
> +#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.

  reply	other threads:[~2016-02-11 19:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 21:34 [PATCH v3 0/4] x86: sigcontext fixes, again Andy Lutomirski
2016-01-25 21:34 ` [PATCH v3 1/4] x86/signal/64: Add a comment about sigcontext->fs and gs Andy Lutomirski
2016-01-25 21:34 ` [PATCH v3 2/4] x86/signal/64: Fix SS if needed when delivering a 64-bit signal Andy Lutomirski
2016-02-09 12:06   ` Borislav Petkov
2016-01-25 21:34 ` [PATCH v3 3/4] x86/signal/64: Re-add support for SS in the 64-bit signal context Andy Lutomirski
2016-02-11 19:49   ` Borislav Petkov
2016-02-12  1:01     ` Andy Lutomirski
2016-02-12 13:56       ` Borislav Petkov
2016-01-25 21:34 ` [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Andy Lutomirski
2016-02-11 19:53   ` Borislav Petkov [this message]
2016-02-12  0:46     ` Andy Lutomirski
2016-02-12 13:59       ` Borislav Petkov
2016-01-26  8:22 ` [PATCH v3 0/4] x86: sigcontext fixes, again Cyrill Gorcunov
2016-01-26 19:51   ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160211195342.GI5565@pd.tnic \
    --to=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=stsp@list.ru \
    --cc=x86@kernel.org \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome