Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572798 > unrolled thread

[PATCH 0/4] selftests, x86: updates for x86 protection keys self tests

Started byDave Hansen <dave.hansen@linux.intel.com>
First post2017-02-03 00:30 +0100
Last post2017-02-03 00:40 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] selftests, x86: updates for x86 protection keys self tests Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-03 00:30 +0100
    [PATCH 4/4] selftests, x86, protection_keys: fix wrong offset in siginfo Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-03 00:30 +0100
    [PATCH 2/4] selftests, x86, protection_keys: remove dead code Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-03 00:30 +0100
      Re: [PATCH 2/4] selftests, x86, protection_keys: remove dead code Shuah Khan <shuahkh@osg.samsung.com> - 2017-02-03 00:40 +0100

#1572798 — [PATCH 0/4] selftests, x86: updates for x86 protection keys self tests

FromDave Hansen <dave.hansen@linux.intel.com>
Date2017-02-03 00:30 +0100
Subject[PATCH 0/4] selftests, x86: updates for x86 protection keys self tests
Message-ID<t6yZb-261-7@gated-at.bofh.it>
The memory protection keys selftests are spewing warnings.  This
fixes them up.  Thanks, Shuah, for sending these first two a few
weeks ago!  I wrongly assumed they would get picked up somewhere.

I also included a fix that affected the 32-bit version of the
pkeys test case.  It was parsing the siginfo incorrectly.

[toc] | [next] | [standalone]


#1572801 — [PATCH 4/4] selftests, x86, protection_keys: fix wrong offset in siginfo

FromDave Hansen <dave.hansen@linux.intel.com>
Date2017-02-03 00:30 +0100
Subject[PATCH 4/4] selftests, x86, protection_keys: fix wrong offset in siginfo
Message-ID<t6yZc-261-29@gated-at.bofh.it>
In reply to#1572798
From: Dave Hansen <dave.hansen@linux.intel.com>

The siginfo contains a bunch of information about the fault.
For protection keys, it tells us which protection key's
permissions were violated.

The wrong offset in here leads to reading garbage and thus
failures in the tests.

We should probably eventually move this over to using the
kernel's headers defining the siginfo instead of a hard-coded
offset.  But, for now, just do the simplest fix.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 b/tools/testing/selftests/x86/protection_keys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN tools/testing/selftests/x86/protection_keys.c~pkeys-selftest-fix-32bit-offset tools/testing/selftests/x86/protection_keys.c
--- a/tools/testing/selftests/x86/protection_keys.c~pkeys-selftest-fix-32bit-offset	2017-02-02 15:27:14.185168666 -0800
+++ b/tools/testing/selftests/x86/protection_keys.c	2017-02-02 15:27:14.188168801 -0800
@@ -192,7 +192,7 @@ void lots_o_noops_around_write(int *writ
 #define SYS_pkey_alloc	 381
 #define SYS_pkey_free	 382
 #define REG_IP_IDX REG_EIP
-#define si_pkey_offset 0x18
+#define si_pkey_offset 0x14
 #else
 #define SYS_mprotect_key 329
 #define SYS_pkey_alloc	 330
_

[toc] | [prev] | [next] | [standalone]


#1572805 — [PATCH 2/4] selftests, x86, protection_keys: remove dead code

FromDave Hansen <dave.hansen@linux.intel.com>
Date2017-02-03 00:30 +0100
Subject[PATCH 2/4] selftests, x86, protection_keys: remove dead code
Message-ID<t6yZc-261-31@gated-at.bofh.it>
In reply to#1572798
From: Shuah Khan <shuahkh@osg.samsung.com>

Remove commented out calls to pkey_get().

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

 b/tools/testing/selftests/x86/protection_keys.c |   10 ----------
 1 file changed, 10 deletions(-)

diff -puN tools/testing/selftests/x86/protection_keys.c~selftests-x86-protection-keys-remove-dead-code tools/testing/selftests/x86/protection_keys.c
--- a/tools/testing/selftests/x86/protection_keys.c~selftests-x86-protection-keys-remove-dead-code	2017-02-02 15:27:13.329130196 -0800
+++ b/tools/testing/selftests/x86/protection_keys.c	2017-02-02 15:27:13.333130376 -0800
@@ -1114,11 +1114,6 @@ void test_pkey_syscalls_on_non_allocated
 		err = sys_pkey_free(i);
 		pkey_assert(err);
 
-		/* not enforced when pkey_get() is not a syscall
-		err = pkey_get(i, 0);
-		pkey_assert(err < 0);
-		*/
-
 		err = sys_pkey_free(i);
 		pkey_assert(err);
 
@@ -1133,11 +1128,6 @@ void test_pkey_syscalls_bad_args(int *pt
 	int err;
 	int bad_pkey = NR_PKEYS+99;
 
-	/* not enforced when pkey_get() is not a syscall
-	err = pkey_get(bad_pkey, bad_flag);
-	pkey_assert(err < 0);
-	*/
-
 	/* pass a known-invalid pkey in: */
 	err = sys_mprotect_pkey(ptr, PAGE_SIZE, PROT_READ, bad_pkey);
 	pkey_assert(err);
_

[toc] | [prev] | [next] | [standalone]


#1572811 — Re: [PATCH 2/4] selftests, x86, protection_keys: remove dead code

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-02-03 00:40 +0100
SubjectRe: [PATCH 2/4] selftests, x86, protection_keys: remove dead code
Message-ID<t6z8S-29H-17@gated-at.bofh.it>
In reply to#1572805
On 02/02/2017 04:28 PM, Dave Hansen wrote:
> From: Shuah Khan <shuahkh@osg.samsung.com>
> 
> Remove commented out calls to pkey_get().
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>

Hi Dave,

This patches is already in linux-kselftest next for 4.11

Is there a reason why you chose to resend these.

-- Shuah

> ---
> 
>  b/tools/testing/selftests/x86/protection_keys.c |   10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff -puN tools/testing/selftests/x86/protection_keys.c~selftests-x86-protection-keys-remove-dead-code tools/testing/selftests/x86/protection_keys.c
> --- a/tools/testing/selftests/x86/protection_keys.c~selftests-x86-protection-keys-remove-dead-code	2017-02-02 15:27:13.329130196 -0800
> +++ b/tools/testing/selftests/x86/protection_keys.c	2017-02-02 15:27:13.333130376 -0800
> @@ -1114,11 +1114,6 @@ void test_pkey_syscalls_on_non_allocated
>  		err = sys_pkey_free(i);
>  		pkey_assert(err);
>  
> -		/* not enforced when pkey_get() is not a syscall
> -		err = pkey_get(i, 0);
> -		pkey_assert(err < 0);
> -		*/
> -
>  		err = sys_pkey_free(i);
>  		pkey_assert(err);
>  
> @@ -1133,11 +1128,6 @@ void test_pkey_syscalls_bad_args(int *pt
>  	int err;
>  	int bad_pkey = NR_PKEYS+99;
>  
> -	/* not enforced when pkey_get() is not a syscall
> -	err = pkey_get(bad_pkey, bad_flag);
> -	pkey_assert(err < 0);
> -	*/
> -
>  	/* pass a known-invalid pkey in: */
>  	err = sys_mprotect_pkey(ptr, PAGE_SIZE, PROT_READ, bad_pkey);
>  	pkey_assert(err);
> _
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web