Skip to contentSkip to conversation

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

PATCH In review SurajSonawane2415 3 participants 5 messages Oct 2, 2024 – Oct 3, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/vDSO/vdso_test_getrandom.c +1 -0
index 72a1d9b43..3f2a4dbf8 100644
@@ -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"
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 4 lines · 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

Quoted 10 lines
---
  tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 +
  1 file changed, 1 insertion(+)
tools/testing/selftests/vDSO/vdso_test_getrandom.c +0 -0
index 72a1d9b43..3f2a4dbf8 100644

tools/testing/selftests/vDSO/vdso_test_getrandom.c line 28

Quoted 7 lines
tools/testing/selftests/vDSO/vdso_test_getrandom.c +1 -0
@@ -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

maintainer
#3 lore raw
Quoted 3 lines · Jason A. Donenfeld

Wasn't this already submitted and commented on?

https://lore.kernel.org/all/[email protected]/

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

#4 lore raw

Re: [PATCH] selftests: vDSO: fix compile error for vdso_test_getrandom

In reply to SurajSonawane2415

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.