1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
From: mirabilos <tg@debian.org>
Date: Fri, 9 Oct 2020 15:58:48 +0200
Subject: fixup syscall numbers for x32 vs. amd64
---
shared/systemd/src/basic/missing_syscall.h | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/shared/systemd/src/basic/missing_syscall.h b/shared/systemd/src/basic/missing_syscall.h
index d11a77d..82daa68 100644
--- a/shared/systemd/src/basic/missing_syscall.h
+++ b/shared/systemd/src/basic/missing_syscall.h
@@ -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"
@@ -36,7 +42,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__
@@ -93,7 +99,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__)
@@ -169,7 +175,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__)
@@ -226,7 +232,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__)
@@ -279,7 +285,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__
@@ -388,7 +394,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__
@@ -440,7 +446,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__
@@ -492,7 +498,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__
@@ -545,7 +551,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
@@ -647,7 +653,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 */
@@ -691,7 +697,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 */
|