Fixes for old distros
cover Fixes for old distros
Hi,
few fixes for old SLES we still support,
which I'd like to merge before release.
Kind regards,
Petr
Petr Vorel (3):
pidfd_send_signal: Build with _GNU_SOURCE tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h> lapi/syscalls: Add syncfs
include/lapi/syscalls/arm.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/i386.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + include/lapi/syscalls/x86_64.in | 1 + include/tst_device.h | 2 +- .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c | 1 + .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c | 1 + .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c | 1 + 16 files changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.24.1
PATCH 1/3 pidfd_send_signal: Build with _GNU_SOURCE
This adds missing O_CLOEXEC and O_DIRECTORY on old distros, where it's (in glibc) guarded under __USE_GNU.
This was needed on SLES 11 (glibc 2.11).
--- .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c | 1 + .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c | 1 + .../kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c | 1 + 3 files changed, 3 insertions(+)
testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c +1 -0
@@ -9,6 +9,7 @@* struct is passed. */ +#define _GNU_SOURCE#include <signal.h> #include <stdlib.h> #include "tst_safe_pthread.h"
testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c +1 -0
@@ -21,6 +21,7 @@* -> EPERM */ +#define _GNU_SOURCE#include <pwd.h> #include <signal.h> #include "tst_safe_pthread.h"
testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c +1 -0
@@ -15,6 +15,7 @@* child using the pidfd of the first one. */ +#define _GNU_SOURCE#include <signal.h> #include <stdio.h> #include <unistd.h>
Signature · 1 line
2.24.1
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
In reply to Petr VorelAs a fallback for old distros which does not define __NR_syncfs (the dependency is in the library itself).
This was needed on SLES 11 (kernel 2.6.32).
--- include/tst_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/tst_device.h +1 -1
@@ -19,7 +19,7 @@#define TST_DEVICE_H__ #include <unistd.h> -#include <sys/syscall.h> +#include "lapi/syscalls.h" struct tst_device {const char *dev;
Signature · 1 line
2.24.1
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
Hi,
Quoted 17 lines
As a fallback for old distros which does not define
__NR_syncfs(the dependency is in the library itself).This was needed on SLES 11 (kernel 2.6.32).
Fixes 74aeb88c9 ("tst_device: use raw syscall in the tst_device.h")Signed-off-by Petr Vorel <[email protected]>--- include/tst_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/tst_device.h +0
-0
include/tst_device.h line 22
Quoted 5 lines
include/tst_device.h +1
-1@@ -19,7 +19,7 @@#define TST_DEVICE_H__ #include <unistd.h> -#include <sys/syscall.h> +#include "lapi/syscalls.h"
Hm, maybe this fix wasn't a good idea.
It effectively uses lapi/syscalls.h everywhere instead of <sys/syscall.h>. Not sure if this is what we want.
Example of the error is #634 [1], which is caused by __NR_socketcall being -1 instead of not defined (socketcall is not defined on some archs, e.g. x86-64 and ARM). We can fix the condition, but it will lead to numerous not obvious errors, so I suggest to revert this (and thus get LTP broken on very old distros).
I'm sorry to break LTP just before release.
Kind regards,
Petr
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
----- Original Message -----
Quoted 6 lines
include/tst_device.h line 22
Quoted 3 lines
#include <
unistd.h>include/tst_device.h +1
-1-#include <sys/syscall.h> +#include "lapi/syscalls.h" Hm, maybe this fix wasn't a good idea.
It effectively useslapi/syscalls.heverywhere instead of <sys/syscall.h>. Not sure if this is what we want.
We already include lapi/syscalls.h at several places, so I wouldn't expect this to be as bad.
Quoted 5 lines
Example of the error is #634 [1], which is caused by
__NR_socketcallbeing -1 instead of not defined (socketcall is not defined on some archs, e.g. x86-64 and ARM).
We can fix the condition
Tests using tst_syscall or ltp_syscall should be fine, since those check for ENOSYS.
Quoted 4 lines
, but it will lead to numerous not obvious errors, so
I
suggest to revert this (and thus get LTP broken on very old distros).
Cyril, any thoughts?
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
Hi,
Quoted 10 lines
----- Original Message -----
Quoted 6 lines
include/tst_device.h line 22
Quoted 3 lines
#include <
unistd.h>include/tst_device.h +1
-1-#include <sys/syscall.h> +#include "lapi/syscalls.h" Hm, maybe this fix wasn't a good idea.
It effectively useslapi/syscalls.heverywhere instead of <sys/syscall.h>. Not sure if this is what we want.We already include
lapi/syscalls.hat several places, so I wouldn't expect this to be as bad.
Yes, it's in many places, the same as lapi/syscalls.h:
git grep -l sys/syscall.h |wc -l
136
git grep -l lapi/syscalls.h |wc -l
206
But none of lapi/syscalls.h use is in the API headers (only in API C and tests)
Quoted 7 lines
Quoted 4 lines
Example of the error is #634 [1], which is caused by
__NR_socketcallbeing -1 instead of not defined (socketcall is not defined on some archs, e.g. x86-64 and ARM).
We can fix the conditionTests using
tst_syscallorltp_syscallshould be fine, since those check for ENOSYS.
OK, if lapi/syscalls.h include is ok, using tst_syscall() in socketcall01.c is trivial fix. But I'd worry about these uses:
$ git grep -e '^#if.*\bSYS_' $(git grep -l sys/syscall.h) testcases/kernel/containers/libclone/libclone.h:#ifndef SYS_unshare testcases/kernel/containers/libclone/libclone.h:#ifdef __NR_unshare testcases/kernel/containers/libclone/libclone.h:#ifndef __NR_unshare testcases/kernel/fs/scsi/ltpscsi/llseek.c:#ifdef __NR_lseek testcases/kernel/fs/scsi/ltpscsi/llseek.c:#ifndef __NR_llseek testcases/kernel/hotplug/memory_hotplug/commands.c:#ifndef __NR_migrate_pages testcases/kernel/mem/vma/vma03.c:#ifdef __NR_mmap2 testcases/kernel/security/tomoyo/include.h:#ifdef __NR_uselib testcases/kernel/security/tomoyo/include.h:#ifdef __NR_pivot_root testcases/kernel/syscalls/accept4/accept4_01.c:#if defined(SYS_ACCEPT4) /* the socketcall() number */ testcases/kernel/syscalls/readahead/readahead01.c:#if defined(__NR_readahead) testcases/kernel/syscalls/set_robust_list/set_robust_list01.c:#ifdef __NR_set_robust_list testcases/kernel/syscalls/set_robust_list/set_robust_list01.c:#ifdef __NR_set_robust_list testcases/kernel/syscalls/set_robust_list/set_robust_list01.c:#ifdef __NR_set_robust_list testcases/kernel/syscalls/set_robust_list/set_robust_list01.c:#ifdef __NR_set_robust_list testcases/kernel/syscalls/setns/setns01.c:#if defined(__NR_setns) testcases/kernel/syscalls/setns/setns02.c:#if defined(__NR_setns) && defined(CLONE_NEWIPC) && defined(CLONE_NEWUTS) testcases/kernel/syscalls/socketcall/socketcall01.c:#ifdef __NR_socketcall testcases/kernel/syscalls/socketcall/socketcall02.c:#ifdef __NR_socketcall testcases/kernel/syscalls/socketcall/socketcall03.c:#ifdef __NR_socketcall testcases/kernel/syscalls/socketcall/socketcall04.c:#ifdef __NR_socketcall testcases/kernel/syscalls/timerfd/timerfd01.c:#ifdef __NR_timerfd_create testcases/misc/crash/crash02.c:#if defined(__NR_vfork) && __NR_vfork testcases/misc/crash/crash02.c:#if defined(__NR_clone) && __NR_clone
which IMHO fail unless transformed into tst_syscall/ltp_syscall().
That's why I'd apply my fix https://patchwork.ozlabs.org/patch/1225869/.
Kind regards,
Petr
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
Quoted 1 line · Petr Vorel
But none of
lapi/syscalls.huse is in the API headers (only in API C and tests)
And you could avoid #including lapi/syscalls.h in API headers by simply moving the implementation of tst_dev_sync() to lib/tst_device.c.
Why do you guys use static inline functions so much anyway? There are no technical reasons to do that except for default main().
Signature · 7 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
Hi,
Quoted 8 lines · Petr Vorel
Quoted 1 line
But none of
lapi/syscalls.huse is in the API headers (only in API C and tests)And you could avoid #including
lapi/syscalls.hin API headers by simply moving the implementation oftst_dev_sync()tolib/tst_device.c.Why do you guys use static inline functions so much anyway? There are no technical reasons to do that except for default
main().
+1. I still think it's not good to include lapi/syscalls.h even it does not break anything. I'll send a patch which uses tst_syscall in socketcall01.c and second commit which moves tst_dev_sync() to lib/tst_device.c. It's up to you if agree on second one.
Kind regards,
Petr
PATCH 2/3 tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>
In reply to Jan StancekHi!
Quoted 8 lines
Quoted 4 lines
Example of the error is #634 [1], which is caused by
__NR_socketcallbeing -1 instead of not defined (socketcall is not defined on some archs, e.g. x86-64 and ARM).
We can fix the conditionTests using
tst_syscallorltp_syscallshould be fine, since those check for ENOSYS.
Quoted 6 lines
Quoted 4 lines
, but it will lead to numerous not obvious errors, so
I
suggest to revert this (and thus get LTP broken on very old distros).Cyril, any thoughts?
I would say that doing #ifdef __NR_* in test source to disable it is wrong to begin with.
Doing 'git grep ifdef __NR' shows only socketcall, set_robust_list and timerfd tests.
The timerfd tests include lapi/syscalls.h already and uses ltp_syscall() so that shouldn't break. I guess we can safely remove the ifdef there as well.
The set_robust_list includes the old test.h so thi change to tst_device.h should not affect it either.
So as far as I can tell the only thing that breaks are the socketcall tests and I guess that the actual fix would be using tst_syscall() instead of syscall() and we can remove the ifdefs as well.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 3/3 lapi/syscalls: Add syncfs
In reply to Petr Vorelfor old distros, which don't define it. Added for all architectures (including very old ones), as the dependency is in the library itself.
This was needed on SLES 11 (kernel 2.6.32).
--- include/lapi/syscalls/arm.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/i386.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + include/lapi/syscalls/x86_64.in | 1 + 12 files changed, 12 insertions(+)
include/lapi/syscalls/arm.in +1 -0
@@ -334,6 +334,7 @@ accept4 (__NR_SYSCALL_BASE+366) fanotify_init (__NR_SYSCALL_BASE+367) fanotify_mark (__NR_SYSCALL_BASE+368) prlimit64 (__NR_SYSCALL_BASE+369) +syncfs (__NR_SYSCALL_BASE+373) process_vm_readv (__NR_SYSCALL_BASE+376) process_vm_writev (__NR_SYSCALL_BASE+377) kcmp (__NR_SYSCALL_BASE+378)
include/lapi/syscalls/hppa.in +1 -0
@@ -16,6 +16,7 @@ faccessat (__NR_openat + 12) splice 291 tee 293 vmsplice 294 +syncfs 327 process_vm_readv 330 process_vm_writev 331 memfd_create 340
include/lapi/syscalls/i386.in +1 -0
@@ -332,6 +332,7 @@ recvmmsg 337 fanotify_init 338 fanotify_mark 339 prlimit64 340 +syncfs 344 process_vm_readv 347 process_vm_writev 348 kcmp 349
include/lapi/syscalls/ia64.in +1 -0
@@ -293,6 +293,7 @@ recvmmsg 1322 fanotify_init 1323 fanotify_mark 1324 prlimit64 1325 +syncfs 1329 process_vm_readv 1332 process_vm_writev 1333 renameat2 1338
include/lapi/syscalls/powerpc.in +1 -0
@@ -339,6 +339,7 @@ recvmsg 342 recvmmsg 343 accept4 344 syscalls 345 +syncfs 348 process_vm_readv 351 process_vm_writev 352 kcmp 354
include/lapi/syscalls/powerpc64.in +1 -0
@@ -339,6 +339,7 @@ recvmsg 342 recvmmsg 343 accept4 344 syscalls 345 +syncfs 348 process_vm_readv 351 process_vm_writev 352 kcmp 354
include/lapi/syscalls/s390.in +1 -0
@@ -323,6 +323,7 @@ setgid 214 setfsuid 215 setfsgid 216 newfstatat 293 +syncfs 338 process_vm_readv 340 process_vm_writev 341 kcmp 343
include/lapi/syscalls/s390x.in +1 -0
@@ -322,6 +322,7 @@ setgid 214 setfsuid 215 setfsgid 216 newfstatat 293 +syncfs 338 process_vm_readv 340 process_vm_writev 341 kcmp 343
include/lapi/syscalls/sh.in +1 -0
@@ -360,6 +360,7 @@ accept4 366 fanotify_init 367 fanotify_mark 368 prlimit64 369 +syncfs 373 process_vm_readv 376 process_vm_writev 377 kcmp 378
include/lapi/syscalls/sparc.in +1 -0
@@ -330,6 +330,7 @@ recvmmsg 328 fanotify_init 329 fanotify_mark 330 prlimit64 331 +syncfs 335 process_vm_readv 338 process_vm_writev 339 kcmp 341
include/lapi/syscalls/sparc64.in +1 -0
@@ -306,6 +306,7 @@ recvmmsg 328 fanotify_init 329 fanotify_mark 330 prlimit64 331 +syncfs 335 process_vm_readv 338 process_vm_writev 339 kcmp 341
include/lapi/syscalls/x86_64.in +1 -0
@@ -299,6 +299,7 @@ recvmmsg 299 fanotify_init 300 fanotify_mark 301 prlimit64 302 +syncfs 306 process_vm_readv 310 process_vm_writev 311 kcmp 312
Signature · 1 line
2.24.1
cover Fixes for old distros
In reply to Petr Vorel----- Original Message -----
Quoted 4 lines
Hi,
few fixes for old SLES we still support,
which I'd like to merge before release.
Looks good to me.
cover Fixes for old distros
Hi Jan,
Quoted 4 lines
Quoted 2 lines
few fixes for old SLES we still support,
which I'd like to merge before release.Looks good to me.
Thanks for your review, merged.
Kind regards,
Petr