From 171613816590db287f05e91416173bfda437d599 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Wed, 24 Jan 2024 13:55:18 +0800 Subject: [PATCH] android: add missing syscall constants This adds all syscall constants that are available in NDK `r26` but were so far missing in this library. See `semver/android.txt` changes for the complete list. Refs: * https://android.googlesource.com/platform/bionic/+/refs/tags/ndk-r26/libc/kernel/uapi/asm-generic/unistd.h * https://android.googlesource.com/platform/bionic/+/refs/tags/ndk-r26/libc/include/bits/glibc-syscalls.h (backport ) (cherry picked from commit e89781f5cce16b499308fa83f0545c2750d223ad) --- libc-test/semver/android-aarch64.txt | 1 + libc-test/semver/android-x86_64.txt | 1 + libc-test/semver/android.txt | 16 ++++++++++++++++ src/unix/linux_like/android/b32/arm.rs | 16 ++++++++++++++++ src/unix/linux_like/android/b32/x86/mod.rs | 17 +++++++++++++++++ .../linux_like/android/b64/aarch64/mod.rs | 19 ++++++++++++++++++- .../linux_like/android/b64/riscv64/mod.rs | 18 +++++++++++++++++- src/unix/linux_like/android/b64/x86_64/mod.rs | 17 +++++++++++++++++ 8 files changed, 103 insertions(+), 2 deletions(-) diff --git a/libc-test/semver/android-aarch64.txt b/libc-test/semver/android-aarch64.txt index ce27097a5b5b6..ecc3cef4f91ee 100644 --- a/libc-test/semver/android-aarch64.txt +++ b/libc-test/semver/android-aarch64.txt @@ -14,6 +14,7 @@ PROT_MTE SYS_arch_specific_syscall SYS_fcntl SYS_lseek +SYS_memfd_secret SYS_mmap SYS_syscalls __system_property_wait diff --git a/libc-test/semver/android-x86_64.txt b/libc-test/semver/android-x86_64.txt index 05919bb6f40e5..80471e37403fc 100644 --- a/libc-test/semver/android-x86_64.txt +++ b/libc-test/semver/android-x86_64.txt @@ -46,6 +46,7 @@ SYS_arch_prctl SYS_epoll_ctl_old SYS_epoll_wait_old SYS_kexec_file_load +SYS_memfd_secret SYS_msgctl SYS_msgget SYS_msgrcv diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 21ce51c09f10b..b679acdcf28ed 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -2488,7 +2488,9 @@ SYS_clock_gettime SYS_clock_nanosleep SYS_clock_settime SYS_clone +SYS_clone3 SYS_close +SYS_close_range SYS_connect SYS_copy_file_range SYS_delete_module @@ -2497,12 +2499,14 @@ SYS_dup3 SYS_epoll_create1 SYS_epoll_ctl SYS_epoll_pwait +SYS_epoll_pwait2 SYS_eventfd2 SYS_execve SYS_execveat SYS_exit SYS_exit_group SYS_faccessat +SYS_faccessat2 SYS_fallocate SYS_fanotify_init SYS_fanotify_mark @@ -2524,6 +2528,7 @@ SYS_fsopen SYS_fspick SYS_fsync SYS_futex +SYS_futex_waitv SYS_get_mempolicy SYS_get_robust_list SYS_getcpu @@ -2569,6 +2574,9 @@ SYS_kcmp SYS_kexec_load SYS_keyctl SYS_kill +SYS_landlock_add_rule +SYS_landlock_create_ruleset +SYS_landlock_restrict_self SYS_lgetxattr SYS_linkat SYS_listen @@ -2588,6 +2596,7 @@ SYS_mlock SYS_mlock2 SYS_mlockall SYS_mount +SYS_mount_setattr SYS_move_mount SYS_move_pages SYS_mprotect @@ -2608,8 +2617,11 @@ SYS_nfsservctl SYS_open_by_handle_at SYS_open_tree SYS_openat +SYS_openat2 SYS_perf_event_open SYS_personality +SYS_pidfd_getfd +SYS_pidfd_open SYS_pidfd_send_signal SYS_pipe2 SYS_pivot_root @@ -2622,6 +2634,8 @@ SYS_pread64 SYS_preadv SYS_preadv2 SYS_prlimit64 +SYS_process_madvise +SYS_process_mrelease SYS_process_vm_readv SYS_process_vm_writev SYS_pselect6 @@ -2630,6 +2644,7 @@ SYS_pwrite64 SYS_pwritev SYS_pwritev2 SYS_quotactl +SYS_quotactl_fd SYS_read SYS_readahead SYS_readlinkat @@ -2669,6 +2684,7 @@ SYS_sendmmsg SYS_sendmsg SYS_sendto SYS_set_mempolicy +SYS_set_mempolicy_home_node SYS_set_robust_list SYS_set_tid_address SYS_setdomainname diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index cbd514b4f6f6e..67bd0bb3abd4c 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -508,6 +508,22 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in mcontext_t.gregs from sys/ucontext.h pub const REG_R0: ::c_int = 0; diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index a6b9f4c6288a1..902016fda3ec8 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -546,6 +546,23 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in user_regs_structs, from sys/reg.h pub const EBX: ::c_int = 0; diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index 75cc2fedace39..0d6f32ee3989c 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -444,7 +444,24 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; -pub const SYS_syscalls: ::c_long = 436; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_syscalls: ::c_long = 451; pub const PROT_BTI: ::c_int = 0x10; pub const PROT_MTE: ::c_int = 0x20; diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index 6e8dfca0a6c50..0251804691fd6 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -351,7 +351,23 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; -pub const SYS_syscalls: ::c_long = 436; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // From NDK's asm/auxvec.h pub const AT_SYSINFO_EHDR: ::c_ulong = 33; diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 6bc616c8d0b17..f871fb2cd4a61 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -741,6 +741,23 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0;