diff mbox series

[uclibc-ng-devel] Fix exec-null test for newer kernels

Message ID 20230614153440.7306-1-yann@sionneau.net
State Accepted
Headers show
Series [uclibc-ng-devel] Fix exec-null test for newer kernels | expand

Commit Message

Yann Sionneau June 14, 2023, 3:34 p.m. UTC
From: Yann Sionneau <ysionneau@kalrayinc.com>

Without this patch, since https://github.com/torvalds/linux/commit/dcd46d897adb70d63e025f175a00a89797d31a43
this test runs in infinite loop.

Signed-off-by: Yann Sionneau <ysionneau@kalrayinc.com>
---
 test/unistd/exec-null.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Waldemar Brodkorb June 15, 2023, 7:28 a.m. UTC | #1
Hi Yann,

thanks, applied and reenabled the test.

best regards
 Waldemar

Yann Sionneau wrote,

> From: Yann Sionneau <ysionneau@kalrayinc.com>
> 
> Without this patch, since https://github.com/torvalds/linux/commit/dcd46d897adb70d63e025f175a00a89797d31a43
> this test runs in infinite loop.
> 
> Signed-off-by: Yann Sionneau <ysionneau@kalrayinc.com>
> ---
>  test/unistd/exec-null.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/test/unistd/exec-null.c b/test/unistd/exec-null.c
> index 3df99f3..0f79b3d 100644
> --- a/test/unistd/exec-null.c
> +++ b/test/unistd/exec-null.c
> @@ -4,7 +4,12 @@
>  
>  int main(int argc, char *argv[])
>  {
> -	if (argc == 0)
> +	/* since Linux https://github.com/torvalds/linux/commit/dcd46d897adb70d63e025f175a00a89797d31a43
> +	 * kernel forces an empty first arg if execve is called
> +	 * with argv == NULL.
> +	 * so we need to handle argc == 1 for newer kernel as well
> +	 */
> +	if (argc == 0 || argc == 1)
>  		return 0;
>  
>  	char *exec_argv[1], *exec_envp[1];
> -- 
> 2.17.1
> 
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
diff mbox series

Patch

diff --git a/test/unistd/exec-null.c b/test/unistd/exec-null.c
index 3df99f3..0f79b3d 100644
--- a/test/unistd/exec-null.c
+++ b/test/unistd/exec-null.c
@@ -4,7 +4,12 @@ 
 
 int main(int argc, char *argv[])
 {
-	if (argc == 0)
+	/* since Linux https://github.com/torvalds/linux/commit/dcd46d897adb70d63e025f175a00a89797d31a43
+	 * kernel forces an empty first arg if execve is called
+	 * with argv == NULL.
+	 * so we need to handle argc == 1 for newer kernel as well
+	 */
+	if (argc == 0 || argc == 1)
 		return 0;
 
 	char *exec_argv[1], *exec_envp[1];