[PATCH] selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error

SurajSonawane2415 posted 1 patch 1 month, 3 weeks ago
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error
Posted by SurajSonawane2415 1 month, 3 weeks ago
Fix build error in vdso_test_getrandom.c due to missing CLONE_NEWTIME.
Include linux/sched.h to define CLONE_NEWTIME.
Ensure successful compilation by resolving the missing header issue.

Signed-off-by: SurajSonawane2415 <surajsonawane0215@gmail.com>
---
 tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
index 72a1d9b43..3f2a4dbf8 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
@@ -22,6 +22,7 @@
 #include <linux/random.h>
 #include <linux/compiler.h>
 #include <linux/ptrace.h>
+#include <linux/sched.h>
 
 #include "../kselftest.h"
 #include "parse_vdso.h"
-- 
2.34.1
Re: [PATCH] selftests: vDSO: fix compile error for vdso_test_getrandom
Posted by SurajSonawane2415 1 month, 3 weeks ago
Yes, I ran it but faced an issue. After reading comments on a similar patch shared by Jason A. 
Donenfeld, I realized that my environment is Ubuntu 22.04 (Linux 5.15 + glibc 2.35). 
After upgrading to a newer version of glibc, the issue seems to be fixed. 
I think including <sched.h> might not be needed. I would really appreciate your advice on how to handle this.
Re: [PATCH] selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error
Posted by Shuah Khan 1 month, 3 weeks ago
On 10/2/24 09:28, SurajSonawane2415 wrote:
> Fix build error in vdso_test_getrandom.c due to missing CLONE_NEWTIME.
> Include linux/sched.h to define CLONE_NEWTIME.
> Ensure successful compilation by resolving the missing header issue.
> 

Did you run "make headers" before building this test? It builds
just fine for me on my system.

+ Adding Jason Donenfeld

> Signed-off-by: SurajSonawane2415 <surajsonawane0215@gmail.com>
> ---
>   tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> index 72a1d9b43..3f2a4dbf8 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> @@ -22,6 +22,7 @@
>   #include <linux/random.h>
>   #include <linux/compiler.h>
>   #include <linux/ptrace.h>
> +#include <linux/sched.h>
>   
>   #include "../kselftest.h"
>   #include "parse_vdso.h"

thanks,
-- Shuah
Re: [PATCH] selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error
Posted by Jason A. Donenfeld 1 month, 3 weeks ago
Wasn't this already submitted and commented on?

https://lore.kernel.org/all/20240919111841.20226-1-liaoyu15@huawei.com/
Re: [PATCH] selftests/vdso: Add linux/sched.h to fix CLONE_NEWTIME build error
Posted by Shuah Khan 1 month, 3 weeks ago
On 10/2/24 16:51, Jason A. Donenfeld wrote:
> Wasn't this already submitted and commented on?
> 
> https://lore.kernel.org/all/20240919111841.20226-1-liaoyu15@huawei.com/

Thank you Jason. Yes we reviewed this - I asked Yu Liao to send
me v2 since the define is coming in from pthread.h indirectly.

Suraj, Thank for finding and fixing the problem. However Yu Liao sent
in patch for this before you did. We will take that patch.

thanks,
-- Shuah