Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1332341 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2016-02-11 21:00 +0100 |
| Last post | 2016-02-12 15:10 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Borislav Petkov <bp@alien8.de> - 2016-02-11 21:00 +0100
Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Andy Lutomirski <luto@amacapital.net> - 2016-02-12 01:50 +0100
Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS Borislav Petkov <bp@alien8.de> - 2016-02-12 15:10 +0100
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-02-11 21:00 +0100 |
| Subject | Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS |
| Message-ID | <r15zb-4W1-5@gated-at.bofh.it> |
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.
[toc] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2016-02-12 01:50 +0100 |
| Subject | Re: [PATCH v3 4/4] selftests/x86: Add tests for UC_SIGCONTEXT_SS and UC_STRICT_RESTORE_SS |
| Message-ID | <r1a5Q-7V7-11@gated-at.bofh.it> |
| In reply to | #1332341 |
On Thu, Feb 11, 2016 at 11:53 AM, Borislav Petkov <bp@alien8.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@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. 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
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-02-12 15:10 +0100 |
| Message-ID | <r1mA2-847-21@gated-at.bofh.it> |
| In reply to | #1332475 |
On Thu, Feb 11, 2016 at 04:46:31PM -0800, Andy Lutomirski wrote:
> Too tangled. Adding:
>
> #include "../../../../arch/x86/include/asm/desc_defs.h"
Yeah, that's fine. We do those crazy include paths in other tools too:
$ grep -ErIn '(\.\.\/){2,}' tools/
tools/usb/ffs-test.c:42:#include "../../include/uapi/linux/usb/functionfs.h"
tools/perf/bench/mem-memset-x86-64-asm.S:4:#include "../../../arch/x86/lib/memset_64.S"
tools/perf/bench/mem-memcpy-x86-64-asm.S:4:#include "../../../arch/x86/lib/memcpy_64.S"
tools/perf/util/include/asm/byteorder.h:2:#include "../../../../include/uapi/linux/swab.h"
tools/perf/util/include/linux/const.h:1:#include "../../../../include/uapi/linux/const.h"
...
> Complains that u16 isn't a type. Trying to include types.h doesn't
> work well either.
Add
typedef unsigned short u16;
before the include maybe?
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web