]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement linux rseq syscall as ENOSYS
authorMark Wielaard <mark@klomp.org>
Fri, 10 Dec 2021 16:41:59 +0000 (17:41 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 15 Dec 2021 11:15:06 +0000 (12:15 +0100)
This implements rseq for amd64, arm, arm64, ppc32, ppc64,
s390x and x86 linux as ENOSYS (without warning).

glibc will start using rseq to accelerate sched_getcpu, if
available. This would cause a warning from valgrind every
time a new thread is started.

Real rseq (restartable sequences) support is pretty hard, so
for now just explicitly return ENOSYS (just like we do for clone3).

https://sourceware.org/pipermail/libc-alpha/2021-December/133656.html

12 files changed:
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-arm-linux.c
coregrind/m_syswrap/syswrap-arm64-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-s390x-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-scnums-arm-linux.h
include/vki/vki-scnums-arm64-linux.h
include/vki/vki-scnums-ppc32-linux.h
include/vki/vki-scnums-ppc64-linux.h
include/vki/vki-scnums-s390x-linux.h

index 5062324a1ef85bda5007619f7b93558e2daaa833..18b25f80ae1a542801dc4b0832534da5ed07395b 100644 (file)
@@ -862,6 +862,8 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_statx,             sys_statx),             // 332
 
+   GENX_(__NR_rseq,              sys_ni_syscall),        // 334
+
    LINX_(__NR_membarrier,        sys_membarrier),        // 324
 
    LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 326
index 556dd844b9564aa452641713fd80006cc7c96991..d583cef0c78ae9dc0be82dd68ec4c6bf386f29b7 100644 (file)
@@ -1024,6 +1024,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINX_(__NR_pwritev2,          sys_pwritev2),         // 393
 
    LINXY(__NR_statx,             sys_statx),            // 397
+   GENX_(__NR_rseq,              sys_ni_syscall),       // 398
 
    LINXY(__NR_clock_gettime64,   sys_clock_gettime64),  // 403
    LINX_(__NR_clock_settime64,   sys_clock_settime64),  // 404
index b8710772768a22fc12a5d029f7fc92faee8ad73e..2066a38ea9ab2ac15bdf4d2890c68a275c756cc9 100644 (file)
@@ -823,8 +823,9 @@ static SyscallTableEntry syscall_main_table[] = {
    //   (__NR_pkey_mprotect,     sys_ni_syscall),        // 288
    //   (__NR_pkey_alloc,        sys_ni_syscall),        // 289
    //   (__NR_pkey_free,         sys_ni_syscall),        // 290
+   LINXY(__NR_statx,             sys_statx),             // 291
 
-   LINXY(__NR_statx,             sys_statx),             // 397
+   GENX_(__NR_rseq,              sys_ni_syscall),        // 293
 
    LINXY(__NR_io_uring_setup,    sys_io_uring_setup),    // 425
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
index 6263ab8451547e0288bc05c143c8dd6c64b6418b..637b2504e1c1fdeb0d4d77e94f88fbc3b14a4627 100644 (file)
@@ -1028,6 +1028,8 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_statx,             sys_statx),            // 383
 
+   GENX_(__NR_rseq,              sys_ni_syscall),       // 387
+
    LINXY(__NR_clock_gettime64,   sys_clock_gettime64),  // 403
    LINX_(__NR_clock_settime64,   sys_clock_settime64),  // 404
 
index a26b41c321fcbbec862e57c8a317bf4fa1b75ae3..93956d3cc295cd429484af7bcf86d4e54fca15d4 100644 (file)
@@ -1019,6 +1019,8 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_statx,             sys_statx),            // 383
 
+   GENX_(__NR_rseq,              sys_ni_syscall),       // 387
+
    LINXY(__NR_io_uring_setup,    sys_io_uring_setup),    // 425
    LINXY(__NR_io_uring_enter,    sys_io_uring_enter),    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
index 5c9209859f2ff41b78ded02411d0807fbcf2e89c..73f9684c46756bc33aa968d686205c865ded9e17 100644 (file)
@@ -860,6 +860,8 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_statx, sys_statx),                                      // 379
 
+   GENX_(__NR_rseq, sys_ni_syscall),                                  // 381
+
    LINXY(__NR_io_uring_setup, sys_io_uring_setup),                    // 425
    LINXY(__NR_io_uring_enter, sys_io_uring_enter),                    // 426
    LINXY(__NR_io_uring_register, sys_io_uring_register),              // 427
index 1d8f45d33a093d56ef0bf720b825277e439e7b7f..8662ff501a261ab04bf2ebf00ef2debe218beb6a 100644 (file)
@@ -1619,6 +1619,8 @@ static SyscallTableEntry syscall_table[] = {
    /* Explicitly not supported on i386 yet. */
    GENX_(__NR_arch_prctl,        sys_ni_syscall),       // 384
 
+   GENX_(__NR_rseq,              sys_ni_syscall),       // 386
+
    LINXY(__NR_clock_gettime64,   sys_clock_gettime64),  // 403
    LINX_(__NR_clock_settime64,   sys_clock_settime64),  // 404
 
index ff560e19ddd91e8b90c4735880a0e8a1b2c5b748..485db8b265dc80c5647624c7d122118f3cd8a66d 100644 (file)
 #define __NR_pkey_alloc                 395
 #define __NR_pkey_free                  396
 #define __NR_statx                      397
+#define __NR_rseq                       398
 
 
 
index 9aa3b2b5fbd74b337cdcc6fa4a569ca39078c6fe..acdfb39c6819a92923cdcc976772d129ef0953f9 100644 (file)
 #define __NR_pkey_alloc 289
 #define __NR_pkey_free 290
 #define __NR_statx 291
+#define __NR_io_pgetevents 291
+#define __NR_rseq 293
 
 #undef __NR_syscalls
-#define __NR_syscalls 292
+#define __NR_syscalls 294
 
 ///*
 // * All syscalls below here should go away really,
index 6987ad941b2e07331fcb39cb0496057c131eaa44..08fa77df0d4c73497f7b9b2199f9e0f6284d4a6e 100644 (file)
 #define __NR_pkey_alloc                384
 #define __NR_pkey_free         385
 #define __NR_pkey_mprotect     386
+#define __NR_rseq              387
 
 #endif /* __VKI_SCNUMS_PPC32_LINUX_H */
 
index 6827964fdf6367c0c41225a88648135a9b935446..a76fa6d322fe1451a9cb151d86004e2d149fd4a7 100644 (file)
 #define __NR_pkey_alloc                384
 #define __NR_pkey_free         385
 #define __NR_pkey_mprotect     386
+#define __NR_rseq              387
 
 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */
 
index 6487e20c9916baf6e12d379bee3b7ec6d3f19c98..869c04584775c60c7bdc057ebf2b05cc37047efd 100644 (file)
 #define __NR_s390_guarded_storage      378
 #define __NR_statx                     379
 #define __NR_s390_sthyi                        380
+#define __NR_kexec_file_load           381
+#define __NR_io_pgetevents             382
+#define __NR_rseq                      383
 
-#define NR_syscalls 381
+#define NR_syscalls 384
 
 /* 
  * There are some system calls that are not present on 64 bit, some