Skip to content

Commit 6334ff7

Browse files
committed
Merge bitcoin/bitcoin#23196: util: Make syscall sandbox compilable with kernel 4.4.0
ac402e7 util: Conditionalize some syscalls in syscall name table (W. J. van der Laan) 64085b3 util: Add __NR_copy_file_range syscall constant for sandbox (W. J. van der Laan) Pull request description: Make the new syscall sandbox compilable with kernel 4.4.0. This defines a further syscall constant `__NR_copy_file_range` to make sure all syscalls used in the profile are available even if not defined in the kernel headers. Also, make a few syscalls optional in the syscall name table: - `__NR_pkey_alloc` - `__NR_pkey_free` - `__NR_pkey_mprotect` - `__NR_preadv2` - `__NR_pwritev2` ACKs for top commit: practicalswift: cr ACK ac402e7 Tree-SHA512: be6c55bf0a686bcdfad0b80b950d0d7d77a559ac234fc997b47514bdba44865a371c96dd8d34a811ba46424a84f410e23f75485b9b1e69e529b7d40e0b4b91b8
2 parents 6f0cbc7 + ac402e7 commit 6334ff7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/util/syscall_sandbox.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ bool g_syscall_sandbox_log_violation_before_terminating{false};
5858
#define __NR_membarrier 324
5959
#endif
6060

61+
#ifndef __NR_copy_file_range
62+
#define __NR_copy_file_range 326
63+
#endif
64+
6165
// This list of syscalls in LINUX_SYSCALLS is only used to map syscall numbers to syscall names in
6266
// order to be able to print user friendly error messages which include the syscall name in addition
6367
// to the syscall number.
@@ -268,15 +272,23 @@ const std::map<uint32_t, std::string> LINUX_SYSCALLS{
268272
{__NR_pipe, "pipe"},
269273
{__NR_pipe2, "pipe2"},
270274
{__NR_pivot_root, "pivot_root"},
275+
#ifdef __NR_pkey_alloc
271276
{__NR_pkey_alloc, "pkey_alloc"},
277+
#endif
278+
#ifdef __NR_pkey_free
272279
{__NR_pkey_free, "pkey_free"},
280+
#endif
281+
#ifdef __NR_pkey_mprotect
273282
{__NR_pkey_mprotect, "pkey_mprotect"},
283+
#endif
274284
{__NR_poll, "poll"},
275285
{__NR_ppoll, "ppoll"},
276286
{__NR_prctl, "prctl"},
277287
{__NR_pread64, "pread64"},
278288
{__NR_preadv, "preadv"},
289+
#ifdef __NR_preadv2
279290
{__NR_preadv2, "preadv2"},
291+
#endif
280292
{__NR_prlimit64, "prlimit64"},
281293
{__NR_process_vm_readv, "process_vm_readv"},
282294
{__NR_process_vm_writev, "process_vm_writev"},
@@ -285,7 +297,9 @@ const std::map<uint32_t, std::string> LINUX_SYSCALLS{
285297
{__NR_putpmsg, "putpmsg"},
286298
{__NR_pwrite64, "pwrite64"},
287299
{__NR_pwritev, "pwritev"},
300+
#ifdef __NR_pwritev2
288301
{__NR_pwritev2, "pwritev2"},
302+
#endif
289303
{__NR_query_module, "query_module"},
290304
{__NR_quotactl, "quotactl"},
291305
{__NR_read, "read"},

0 commit comments

Comments
 (0)