Support Linux syscall 434 pidfd_open

This commit is contained in:
Earl Chew 2023-04-14 22:56:16 +02:00 committed by Mark Wielaard
parent 1e42338863
commit d387566dd7
14 changed files with 31 additions and 0 deletions

1
NEWS
View File

@ -140,6 +140,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
462830 WARNING: unhandled amd64-freebsd syscall: 474
463027 broken check for MPX instruction support in assembler
464476 Firefox fails to start under Valgrind
464609 Valgrind memcheck should support Linux pidfd_open
464680 Show issues caused by memory policies like selinux deny_execmem
464859 Build failures with GCC-13 (drd tsan_unittest)
464969 D language demangling

View File

@ -320,6 +320,9 @@ DECL_TEMPLATE(linux, sys_io_uring_setup);
DECL_TEMPLATE(linux, sys_io_uring_enter);
DECL_TEMPLATE(linux, sys_io_uring_register);
// Linux-specific (new in Linux 5.3)
DECL_TEMPLATE(linux, sys_pidfd_open);
// Linux-specific (new in Linux 5.9)
DECL_TEMPLATE(linux, sys_close_range);
DECL_TEMPLATE(linux, sys_openat2);

View File

@ -876,6 +876,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436
LINXY(__NR_openat2, sys_openat2), // 437

View File

@ -1052,6 +1052,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -831,6 +831,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -13605,6 +13605,22 @@ POST(sys_openat2)
}
}
PRE(sys_pidfd_open)
{
PRINT("sys_pidfd_open ( %ld, %lu )", SARG1, ARG2);
}
POST(sys_pidfd_open)
{
if (!ML_(fd_allowed)(RES, "pidfd", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
ML_(record_fd_open_nameless) (tid, RES);
}
}
#undef PRE
#undef POST

View File

@ -1136,6 +1136,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -815,6 +815,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_io_uring_setup, sys_io_uring_setup),
LINXY (__NR_io_uring_enter, sys_io_uring_enter),
LINXY (__NR_io_uring_register, sys_io_uring_register),
LINXY (__NR_pidfd_open, sys_pidfd_open),
GENX_ (__NR_clone3, sys_ni_syscall),
LINXY (__NR_close_range, sys_close_range),
LINX_ (__NR_faccessat2, sys_faccessat2),

View File

@ -824,6 +824,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY (__NR_io_uring_setup, sys_io_uring_setup),
LINXY (__NR_io_uring_enter, sys_io_uring_enter),
LINXY (__NR_io_uring_register, sys_io_uring_register),
LINXY (__NR_pidfd_open, sys_pidfd_open),
GENX_ (__NR_clone3, sys_ni_syscall),
LINXY (__NR_close_range, sys_close_range),
LINX_ (__NR_faccessat2, sys_faccessat2),

View File

@ -1056,6 +1056,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -1025,6 +1025,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -866,6 +866,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register), // 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436

View File

@ -1647,6 +1647,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426
LINXY(__NR_io_uring_register, sys_io_uring_register),// 427
LINXY(__NR_pidfd_open, sys_pidfd_open), // 434
GENX_(__NR_clone3, sys_ni_syscall), // 435
LINXY(__NR_close_range, sys_close_range), // 436
LINXY(__NR_openat2, sys_openat2), // 437

View File

@ -39,6 +39,7 @@
#define __NR_fsmount 432
#define __NR_fspick 433
#define __NR_pidfd_open 434
#define __NR_clone3 435
#define __NR_close_range 436
#define __NR_openat2 437