[PATCH 3/6] selftests/mm : fix test_prctl_fork_exec failure

Aboorva Devarajan posted 6 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH 3/6] selftests/mm : fix test_prctl_fork_exec failure
Posted by Aboorva Devarajan 3 months, 3 weeks ago
From: Donet Tom <donettom@linux.ibm.com>

execv argument is an array of pointers to null-terminated strings.
In this patch we added NULL in the execv argument to fix the test
failure.

Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
---
 tools/testing/selftests/mm/ksm_functional_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
index d7d3c22c077a..6ea50272a0ba 100644
--- a/tools/testing/selftests/mm/ksm_functional_tests.c
+++ b/tools/testing/selftests/mm/ksm_functional_tests.c
@@ -579,7 +579,7 @@ static void test_prctl_fork_exec(void)
 		return;
 	} else if (child_pid == 0) {
 		char *prg_name = "./ksm_functional_tests";
-		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME };
+		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME, NULL };
 
 		execv(prg_name, argv_for_program);
 		return;
-- 
2.43.5
Re: [PATCH 3/6] selftests/mm : fix test_prctl_fork_exec failure
Posted by Dev Jain 3 months, 3 weeks ago
On 16/06/25 9:36 pm, Aboorva Devarajan wrote:
> From: Donet Tom <donettom@linux.ibm.com>
>
> execv argument is an array of pointers to null-terminated strings.
> In this patch we added NULL in the execv argument to fix the test
> failure.

Just a comment, how did this test suddenly start failing now? Also is a
fixes tag required? Clearly I am missing something.

> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
> ---
>   tools/testing/selftests/mm/ksm_functional_tests.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
> index d7d3c22c077a..6ea50272a0ba 100644
> --- a/tools/testing/selftests/mm/ksm_functional_tests.c
> +++ b/tools/testing/selftests/mm/ksm_functional_tests.c
> @@ -579,7 +579,7 @@ static void test_prctl_fork_exec(void)
>   		return;
>   	} else if (child_pid == 0) {
>   		char *prg_name = "./ksm_functional_tests";
> -		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME };
> +		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME, NULL };
>   
>   		execv(prg_name, argv_for_program);
>   		return;
Re: [PATCH 3/6] selftests/mm : fix test_prctl_fork_exec failure
Posted by donettom 3 months, 3 weeks ago
esOn Mon, Jun 16, 2025 at 09:58:38PM +0530, Dev Jain wrote:
> 
> On 16/06/25 9:36 pm, Aboorva Devarajan wrote:
> > From: Donet Tom <donettom@linux.ibm.com>
> > 
> > execv argument is an array of pointers to null-terminated strings.
> > In this patch we added NULL in the execv argument to fix the test
> > failure.
> 
> Just a comment, how did this test suddenly start failing now? Also is a
> fixes tag required? Clearly I am missing something.
> 

This test has been failing on my machine since the version in which
it was introduced.

Will add the fixes-by tag in next version.


Below is the test result on 0374af1da077- mm/ksm: test case for prctl fork/exec workflow

./ksm_functional_tests 
TAP version 13
1..9
 [RUN] test_unmerge
ok 1 Pages were unmerged
 [RUN] test_unmerge_zero_pages
ok 2 KSM zero pages were unmerged
 [RUN] test_unmerge_discarded
ok 3 Pages were unmerged
 [RUN] test_unmerge_uffd_wp
ok 4 # SKIP UFFD_FEATURE_PAGEFAULT_FLAG_WP not available
 [RUN] test_prot_none
ok 5 Pages were unmerged
 [RUN] test_prctl
ok 6 Setting/clearing PR_SET_MEMORY_MERGE works
 [RUN] test_prctl_fork
ok 7 PR_SET_MEMORY_MERGE value is inherited
 [RUN] test_prctl_fork_exec
 [RUN] test_prctl_unmerge
not ok 8 No pages got merged
Bail out! 1 out of 8 tests failed
 Planned tests != run tests (9 != 8)
 Totals: pass:6 fail:1 xfail:0 xpass:0 skip:1 error:0
not ok 8 KSM not enabled
 [RUN] test_prctl_unmerge
ok 9 Pages were unmerged
Bail out! 1 out of 9 tests failed
 Totals: pass:7 fail:1 xfail:0 xpass:0 skip:1 error:0


With the above patch the test is passing.

 [RUN] test_prctl_fork_exec
ok 8 PR_SET_MEMORY_MERGE value is inherited

> > Signed-off-by: Donet Tom <donettom@linux.ibm.com>
> > Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
> > ---
> >   tools/testing/selftests/mm/ksm_functional_tests.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
> > index d7d3c22c077a..6ea50272a0ba 100644
> > --- a/tools/testing/selftests/mm/ksm_functional_tests.c
> > +++ b/tools/testing/selftests/mm/ksm_functional_tests.c
> > @@ -579,7 +579,7 @@ static void test_prctl_fork_exec(void)
> >   		return;
> >   	} else if (child_pid == 0) {
> >   		char *prg_name = "./ksm_functional_tests";
> > -		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME };
> > +		char *argv_for_program[] = { prg_name, FORK_EXEC_CHILD_PRG_NAME, NULL };
> >   		execv(prg_name, argv_for_program);
> >   		return;
>