1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

missing_syscall: fixup syscall numbers for x32 vs. amd64

This commit is contained in:
mirabilos 2020-10-09 08:56:57 +02:00 committed by Lennart Poettering
parent d156a4fa0f
commit 356e9c6687

View File

@ -15,6 +15,12 @@
#include <asm/sgidefs.h>
#endif
#if defined(__x86_64__) && defined(__ILP32__)
#define systemd_SC_arch_bias(x) ((x) | /* __X32_SYSCALL_BIT */ 0x40000000)
#else
#define systemd_SC_arch_bias(x) (x)
#endif
#include "missing_keyctl.h"
#include "missing_stat.h"
@ -34,7 +40,7 @@ static inline int missing_pivot_root(const char *new_root, const char *put_old)
/* ======================================================================= */
#if defined __x86_64__
# define systemd_NR_memfd_create 319
# define systemd_NR_memfd_create systemd_SC_arch_bias(319)
#elif defined __arm__
# define systemd_NR_memfd_create 385
#elif defined __aarch64__
@ -91,7 +97,7 @@ static inline int missing_memfd_create(const char *name, unsigned int flags) {
/* ======================================================================= */
#if defined __x86_64__
# define systemd_NR_getrandom 318
# define systemd_NR_getrandom systemd_SC_arch_bias(318)
#elif defined(__i386__)
# define systemd_NR_getrandom 355
#elif defined(__arm__)
@ -167,7 +173,7 @@ static inline pid_t missing_gettid(void) {
/* ======================================================================= */
#if defined(__x86_64__)
# define systemd_NR_name_to_handle_at 303
# define systemd_NR_name_to_handle_at systemd_SC_arch_bias(303)
#elif defined(__i386__)
# define systemd_NR_name_to_handle_at 341
#elif defined(__arm__)
@ -224,7 +230,7 @@ static inline int missing_name_to_handle_at(int fd, const char *name, struct fil
#elif defined __arm__
# define systemd_NR_setns 375
#elif defined(__x86_64__)
# define systemd_NR_setns 308
# define systemd_NR_setns systemd_SC_arch_bias(308)
#elif defined(__i386__)
# define systemd_NR_setns 346
#elif defined(__powerpc__)
@ -277,7 +283,7 @@ static inline pid_t raw_getpid(void) {
/* ======================================================================= */
#if defined __x86_64__
# define systemd_NR_renameat2 316
# define systemd_NR_renameat2 systemd_SC_arch_bias(316)
#elif defined __arm__
# define systemd_NR_renameat2 382
#elif defined __aarch64__
@ -386,7 +392,7 @@ static inline key_serial_t missing_request_key(const char *type, const char *des
/* ======================================================================= */
#if defined(__x86_64__)
# define systemd_NR_copy_file_range 326
# define systemd_NR_copy_file_range systemd_SC_arch_bias(326)
#elif defined(__i386__)
# define systemd_NR_copy_file_range 377
#elif defined __s390__
@ -438,7 +444,7 @@ static inline ssize_t missing_copy_file_range(int fd_in, loff_t *off_in,
#if defined __i386__
# define systemd_NR_bpf 357
#elif defined __x86_64__
# define systemd_NR_bpf 321
# define systemd_NR_bpf systemd_SC_arch_bias(321)
#elif defined __aarch64__
# define systemd_NR_bpf 280
#elif defined __arm__
@ -490,7 +496,7 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
# if defined __i386__
# define systemd_NR_pkey_mprotect 380
# elif defined __x86_64__
# define systemd_NR_pkey_mprotect 329
# define systemd_NR_pkey_mprotect systemd_SC_arch_bias(329)
# elif defined __aarch64__
# define systemd_NR_pkey_mprotect 288
# elif defined __arm__
@ -543,7 +549,7 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect);
#elif defined __sparc__
# define systemd_NR_statx 360
#elif defined __x86_64__
# define systemd_NR_statx 332
# define systemd_NR_statx systemd_SC_arch_bias(332)
#else
# warning "statx() syscall number unknown for your architecture"
#endif
@ -643,7 +649,7 @@ static inline long missing_get_mempolicy(int *mode, unsigned long *nodemask,
#elif defined __ia64__
# define systemd_NR_pidfd_send_signal (424 + 1024)
#else
# define systemd_NR_pidfd_send_signal 424
# define systemd_NR_pidfd_send_signal systemd_SC_arch_bias(424)
#endif
/* may be (invalid) negative number due to libseccomp, see PR 13319 */
@ -687,7 +693,7 @@ static inline int missing_pidfd_send_signal(int fd, int sig, siginfo_t *info, un
#elif defined __ia64__
# define systemd_NR_pidfd_open (434 + 1024)
#else
# define systemd_NR_pidfd_open 434
# define systemd_NR_pidfd_open systemd_SC_arch_bias(434)
#endif
/* may be (invalid) negative number due to libseccomp, see PR 13319 */