public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] pkey01: Fix TBROK due missing results
@ 2024-08-09  9:55 Petr Vorel
  2024-08-09 11:40 ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-08-09  9:55 UTC (permalink / raw)
  To: ltp

PKEY_DISABLE_EXECUTE is ppc64le specific test. Due messages being
TINFO test on other archs fails:

    tst_test.c:1498: TBROK: Test 2 haven't reported results!

Changing messages to TCONF. Also exit loop on !execute_supported TCONF
(no need to have 30x TCONF with the same error message, because we have
PKEY_DISABLE_EXECUTE last). The other TCONF (on MAP_HUGETLB) must be
repeated.

Fixes: d2b8a476c2 ("pkey01: Adding test for PKEY_DISABLE_EXECUTE")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi Li, all,

if you don't like PKEY_DISABLE_EXECUTE having to be the last, we can
just have 30x TCONF (just to change both TINFO to TCONF). Whatever you prefer.

Kind regards,
Petr

 testcases/kernel/syscalls/pkeys/pkey01.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
index e5db2c253c..a4b73c4056 100644
--- a/testcases/kernel/syscalls/pkeys/pkey01.c
+++ b/testcases/kernel/syscalls/pkeys/pkey01.c
@@ -51,7 +51,7 @@ static struct tcase {
 } tcases[] = {
 	{PERM_NAME(PKEY_DISABLE_ACCESS)},
 	{PERM_NAME(PKEY_DISABLE_WRITE)},
-	{PERM_NAME(PKEY_DISABLE_EXECUTE)},
+	{PERM_NAME(PKEY_DISABLE_EXECUTE)} /* keep it the last */
 };
 
 static void setup(void)
@@ -155,7 +155,7 @@ static size_t function_size(void (*func)(void))
 	return (size_t)(end - start + 1);
 }
 
-static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
+static int pkey_test(struct tcase *tc, struct mmap_param *mpa)
 {
 	pid_t pid;
 	char *buffer;
@@ -165,13 +165,13 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
 	size_t func_size = 0;
 
 	if (!execute_supported && (tc->access_rights == PKEY_DISABLE_EXECUTE)) {
-		tst_res(TINFO, "skip PKEY_DISABLE_EXECUTE test");
-		return;
+		tst_res(TCONF, "skip PKEY_DISABLE_EXECUTE test");
+		return 1;
 	}
 
 	if (!tst_hugepages && (mpa->flags & MAP_HUGETLB)) {
-		tst_res(TINFO, "Skip test on (%s) buffer", flag_to_str(mpa->flags));
-		return;
+		tst_res(TCONF, "Skip test on (%s) buffer", flag_to_str(mpa->flags));
+		return 0;
 	}
 
 	if (fd == 0)
@@ -253,6 +253,8 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
 
 	if (pkey_free(pkey) == -1)
 		tst_brk(TBROK | TERRNO, "pkey_free failed");
+
+	return 0;
 }
 
 static void verify_pkey(unsigned int i)
@@ -265,7 +267,8 @@ static void verify_pkey(unsigned int i)
 	for (j = 0; j < ARRAY_SIZE(mmap_params); j++) {
 		mpa = &mmap_params[j];
 
-		pkey_test(tc, mpa);
+		if (pkey_test(tc, mpa))
+			break;
 	}
 }
 
-- 
2.45.2


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

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

* Re: [LTP] [PATCH 1/1] pkey01: Fix TBROK due missing results
  2024-08-09  9:55 [LTP] [PATCH 1/1] pkey01: Fix TBROK due missing results Petr Vorel
@ 2024-08-09 11:40 ` Li Wang
  2024-08-09 11:54   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2024-08-09 11:40 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

On Fri, Aug 9, 2024 at 5:55 PM Petr Vorel <pvorel@suse.cz> wrote:

> PKEY_DISABLE_EXECUTE is ppc64le specific test. Due messages being
> TINFO test on other archs fails:
>
>     tst_test.c:1498: TBROK: Test 2 haven't reported results!
>

Ah yes, I think of why I used tst_brk in my previous patch.


>
> Changing messages to TCONF. Also exit loop on !execute_supported TCONF
> (no need to have 30x TCONF with the same error message, because we have
> PKEY_DISABLE_EXECUTE last). The other TCONF (on MAP_HUGETLB) must be
> repeated.
>

Agreed.


> Fixes: d2b8a476c2 ("pkey01: Adding test for PKEY_DISABLE_EXECUTE")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi Li, all,
>
> if you don't like PKEY_DISABLE_EXECUTE having to be the last, we can
> just have 30x TCONF (just to change both TINFO to TCONF). Whatever you
> prefer.
>

It's okay, I guess PKEY_DISABLE_EXECUTE is already the last feature
for mem protection, READ, WRITE, EXEC, and I don't expect there will
be a new permission to appear :).

Feel free to add:
Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

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

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

* Re: [LTP] [PATCH 1/1] pkey01: Fix TBROK due missing results
  2024-08-09 11:40 ` Li Wang
@ 2024-08-09 11:54   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2024-08-09 11:54 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li, all,

> Hi Petr,

> On Fri, Aug 9, 2024 at 5:55 PM Petr Vorel <pvorel@suse.cz> wrote:

> > PKEY_DISABLE_EXECUTE is ppc64le specific test. Due messages being
> > TINFO test on other archs fails:

> >     tst_test.c:1498: TBROK: Test 2 haven't reported results!


> Ah yes, I think of why I used tst_brk in my previous patch.



> > Changing messages to TCONF. Also exit loop on !execute_supported TCONF
> > (no need to have 30x TCONF with the same error message, because we have
> > PKEY_DISABLE_EXECUTE last). The other TCONF (on MAP_HUGETLB) must be
> > repeated.


> Agreed.


> > Fixes: d2b8a476c2 ("pkey01: Adding test for PKEY_DISABLE_EXECUTE")
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > Hi Li, all,

> > if you don't like PKEY_DISABLE_EXECUTE having to be the last, we can
> > just have 30x TCONF (just to change both TINFO to TCONF). Whatever you
> > prefer.


> It's okay, I guess PKEY_DISABLE_EXECUTE is already the last feature
> for mem protection, READ, WRITE, EXEC, and I don't expect there will
> be a new permission to appear :).

Thanks for a quick ack, merged (with added comment for return value in the
code).

Kind regards,
Petr

> Feel free to add:
> Reviewed-by: Li Wang <liwang@redhat.com>

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

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

end of thread, other threads:[~2024-08-09 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  9:55 [LTP] [PATCH 1/1] pkey01: Fix TBROK due missing results Petr Vorel
2024-08-09 11:40 ` Li Wang
2024-08-09 11:54   ` Petr Vorel

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