public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] pkey01: print more info when write buff fail
@ 2022-04-11  9:40 Li Wang
  2022-04-11  9:40 ` [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC Li Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Li Wang @ 2022-04-11  9:40 UTC (permalink / raw)
  To: ltp

We got sporadically failed on POWER9 but couldn't reproduce the problem
manually. Here add printf to show info to see if the PKEY_DISABLE_WRITE
takes effect on buffers.

  pkey01.c:149: TINFO: Set PKEY_DISABLE_WRITE on (MAP_ANONYMOUS|MAP_PRIVATE|MAP_HUGETLB) buffer
  pkey01.c:174: TFAIL: Child: exited with 0
  pkey01.c:176: TINFO: Remove PKEY_DISABLE_WRITE from the buffer

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/pkeys/pkey01.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
index 04f50924c..1a9194e1a 100644
--- a/testcases/kernel/syscalls/pkeys/pkey01.c
+++ b/testcases/kernel/syscalls/pkeys/pkey01.c
@@ -161,6 +161,8 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
 		break;
 		case PKEY_DISABLE_WRITE:
 			*buffer = 'a';
+			tst_res(TFAIL | TERRNO,
+				"Write buffer success, buffer[0] = %d", *buffer);
 		break;
 		}
 		exit(0);
@@ -183,6 +185,7 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
 	break;
 	case PROT_WRITE:
 		*buffer = 'a';
+		tst_res(TPASS, "Write buffer success, buffer[0] = %d", *buffer);
 	break;
 	case PROT_READ | PROT_WRITE:
 	case PROT_READ | PROT_WRITE | PROT_EXEC:
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC
  2022-04-11  9:40 [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Li Wang
@ 2022-04-11  9:40 ` Li Wang
  2022-04-11 10:57   ` Jan Stancek
  2022-04-19  6:57 ` [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Petr Vorel
  2022-06-10  8:16 ` Cyril Hrubis
  2 siblings, 1 reply; 8+ messages in thread
From: Li Wang @ 2022-04-11  9:40 UTC (permalink / raw)
  To: ltp

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9506394a159

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/pkeys/pkey.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
index 6e32326b6..6cda88ff1 100644
--- a/testcases/kernel/syscalls/pkeys/pkey.h
+++ b/testcases/kernel/syscalls/pkeys/pkey.h
@@ -11,6 +11,13 @@
 #include "lapi/syscalls.h"
 #include "lapi/mmap.h"
 
+#if defined(__powerpc__) || defined(__ppc__)
+# undef PKEY_DISABLE_ACCESS
+# define PKEY_DISABLE_ACCESS 0x3
+# undef PKEY_DISABLE_WRITE
+# define PKEY_DISABLE_WRITE  0x2
+#endif
+
 #ifndef PKEY_DISABLE_ACCESS
 # define PKEY_DISABLE_ACCESS 0x1
 # define PKEY_DISABLE_WRITE  0x2
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC
  2022-04-11  9:40 ` [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC Li Wang
@ 2022-04-11 10:57   ` Jan Stancek
  2022-04-11 12:35     ` Li Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Stancek @ 2022-04-11 10:57 UTC (permalink / raw)
  To: Li Wang; +Cc: LTP List

On Mon, Apr 11, 2022 at 11:41 AM Li Wang <liwang@redhat.com> wrote:
>
> Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9506394a159
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  testcases/kernel/syscalls/pkeys/pkey.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
> index 6e32326b6..6cda88ff1 100644
> --- a/testcases/kernel/syscalls/pkeys/pkey.h
> +++ b/testcases/kernel/syscalls/pkeys/pkey.h
> @@ -11,6 +11,13 @@
>  #include "lapi/syscalls.h"
>  #include "lapi/mmap.h"
>
> +#if defined(__powerpc__) || defined(__ppc__)
> +# undef PKEY_DISABLE_ACCESS
> +# define PKEY_DISABLE_ACCESS 0x3

Where does powerpc define PKEY_DISABLE_ACCESS as 0x3?

Comment in tools/testing/selftests/powerpc/include/pkeys.h says it's
older glibc that has this problem, but looking at latest glibc it
still defines it as 0x1:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/mman-shared.h;h=00a1f27c0ef51de1ec657071c5744e09299f7ff2;hb=HEAD#l41



> +# undef PKEY_DISABLE_WRITE
> +# define PKEY_DISABLE_WRITE  0x2
> +#endif
> +
>  #ifndef PKEY_DISABLE_ACCESS
>  # define PKEY_DISABLE_ACCESS 0x1
>  # define PKEY_DISABLE_WRITE  0x2
> --
> 2.31.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC
  2022-04-11 10:57   ` Jan Stancek
@ 2022-04-11 12:35     ` Li Wang
  2022-10-10 10:45       ` Richard Palethorpe
  0 siblings, 1 reply; 8+ messages in thread
From: Li Wang @ 2022-04-11 12:35 UTC (permalink / raw)
  To: Jan Stancek, Ram Pai; +Cc: LTP List


[-- Attachment #1.1: Type: text/plain, Size: 1288 bytes --]

On Mon, Apr 11, 2022 at 6:57 PM Jan Stancek <jstancek@redhat.com> wrote:

> On Mon, Apr 11, 2022 at 11:41 AM Li Wang <liwang@redhat.com> wrote:
> >
> > Reference:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9506394a159
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> >  testcases/kernel/syscalls/pkeys/pkey.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/pkeys/pkey.h
> b/testcases/kernel/syscalls/pkeys/pkey.h
> > index 6e32326b6..6cda88ff1 100644
> > --- a/testcases/kernel/syscalls/pkeys/pkey.h
> > +++ b/testcases/kernel/syscalls/pkeys/pkey.h
> > @@ -11,6 +11,13 @@
> >  #include "lapi/syscalls.h"
> >  #include "lapi/mmap.h"
> >
> > +#if defined(__powerpc__) || defined(__ppc__)
> > +# undef PKEY_DISABLE_ACCESS
> > +# define PKEY_DISABLE_ACCESS 0x3
>
> Where does powerpc define PKEY_DISABLE_ACCESS as 0x3?
>

Good question, I previously thought that was officially defined as 0x3 on
PowerPC (per Ram's patch).

But after looking at 'powerpc/include/uapi/asm/mman.h' it still includes
header which define PKEY_DISABLE_ACCESS as 0x1.
    #include <asm-generic/mman-common.h>

@Ram Pai, could you explain why you're using 0x3 in kselftest?
Did I miss anything?


-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 2973 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] pkey01: print more info when write buff fail
  2022-04-11  9:40 [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Li Wang
  2022-04-11  9:40 ` [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC Li Wang
@ 2022-04-19  6:57 ` Petr Vorel
  2022-06-10  8:16 ` Cyril Hrubis
  2 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2022-04-19  6:57 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,

LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] pkey01: print more info when write buff fail
  2022-04-11  9:40 [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Li Wang
  2022-04-11  9:40 ` [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC Li Wang
  2022-04-19  6:57 ` [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Petr Vorel
@ 2022-06-10  8:16 ` Cyril Hrubis
  2022-06-14  7:23   ` Li Wang
  2 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2022-06-10  8:16 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
This looks good to me, in case you are going to push the patch:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 1/2] pkey01: print more info when write buff fail
  2022-06-10  8:16 ` Cyril Hrubis
@ 2022-06-14  7:23   ` Li Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Li Wang @ 2022-06-14  7:23 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: LTP List


[-- Attachment #1.1: Type: text/plain, Size: 165 bytes --]

> This looks good to me, in case you are going to push the patch:
>

Thanks, I have pushed patch-1/2, hope it helps to catch something useful.

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 548 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC
  2022-04-11 12:35     ` Li Wang
@ 2022-10-10 10:45       ` Richard Palethorpe
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Palethorpe @ 2022-10-10 10:45 UTC (permalink / raw)
  To: Li Wang; +Cc: Ram Pai, ltp

Hello,

Li Wang <liwang@redhat.com> writes:

> On Mon, Apr 11, 2022 at 6:57 PM Jan Stancek <jstancek@redhat.com> wrote:
>
>  On Mon, Apr 11, 2022 at 11:41 AM Li Wang <liwang@redhat.com> wrote:
>  >
>  > Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9506394a159
>  >
>  > Signed-off-by: Li Wang <liwang@redhat.com>
>  > ---
>  >  testcases/kernel/syscalls/pkeys/pkey.h | 7 +++++++
>  >  1 file changed, 7 insertions(+)
>  >
>  > diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
>  > index 6e32326b6..6cda88ff1 100644
>  > --- a/testcases/kernel/syscalls/pkeys/pkey.h
>  > +++ b/testcases/kernel/syscalls/pkeys/pkey.h
>  > @@ -11,6 +11,13 @@
>  >  #include "lapi/syscalls.h"
>  >  #include "lapi/mmap.h"
>  >
>  > +#if defined(__powerpc__) || defined(__ppc__)
>  > +# undef PKEY_DISABLE_ACCESS
>  > +# define PKEY_DISABLE_ACCESS 0x3
>
>  Where does powerpc define PKEY_DISABLE_ACCESS as 0x3?
>
> Good question, I previously thought that was officially defined as 0x3 on PowerPC (per Ram's patch).
>
> But after looking at 'powerpc/include/uapi/asm/mman.h' it still includes
> header which define PKEY_DISABLE_ACCESS as 0x1. 
>     #include <asm-generic/mman-common.h>
>
> @Ram Pai, could you explain why you're using 0x3 in kselftest?
> Did I miss anything?

No response and I guess pkey01 would fail on some systems if it weren't
0x1. So I'll mark this as rejected in patchwork.

-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-10-10 10:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-11  9:40 [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Li Wang
2022-04-11  9:40 ` [LTP] [PATCH 2/2] pkey: correct the PKEY_DISABLE_ACCESS definitions on PowerPC Li Wang
2022-04-11 10:57   ` Jan Stancek
2022-04-11 12:35     ` Li Wang
2022-10-10 10:45       ` Richard Palethorpe
2022-04-19  6:57 ` [LTP] [PATCH 1/2] pkey01: print more info when write buff fail Petr Vorel
2022-06-10  8:16 ` Cyril Hrubis
2022-06-14  7:23   ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox