172 lines
8.0 KiB
Diff
172 lines
8.0 KiB
Diff
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
|
|
index 22c6c98..4a8d7e1 100644
|
|
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
|
|
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
|
|
@@ -285,6 +285,7 @@ DECL_TEMPLATE(linux, sys_fanotify_mark);
|
|
|
|
// Linux-specific (new in Linux 3.17)
|
|
DECL_TEMPLATE(linux, sys_getrandom);
|
|
+DECL_TEMPLATE(linux, sys_memfd_create);
|
|
|
|
/* ---------------------------------------------------------------------
|
|
Wrappers for sockets and ipc-ery. These are split into standalone
|
|
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
|
|
index ae696b1..88802fb 100644
|
|
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
|
|
@@ -1078,8 +1078,8 @@ static SyscallTableEntry syscall_table[] = {
|
|
// LIN__(__NR_sched_getattr, sys_ni_syscall), // 315
|
|
// LIN__(__NR_renameat2, sys_ni_syscall), // 316
|
|
// LIN__(__NR_seccomp, sys_ni_syscall), // 317
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 318
|
|
-// LIN__(__NR_memfd_create, sys_ni_syscall), // 319
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 318
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 319
|
|
|
|
// LIN__(__NR_kexec_file_load, sys_ni_syscall), // 320
|
|
// LIN__(__NR_bpf, sys_ni_syscall) // 321
|
|
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
|
|
index 4293800..200b0d1 100644
|
|
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
|
|
@@ -1215,7 +1215,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
|
LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 371
|
|
LINXY(__NR_clock_adjtime, sys_clock_adjtime), // 372
|
|
LINXY(__NR_sendmmsg, sys_sendmmsg), // 374
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 384
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 384
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 385
|
|
};
|
|
|
|
|
|
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
|
|
index 56fafac..a72392f 100644
|
|
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
|
|
@@ -1037,6 +1037,7 @@ static SyscallTableEntry syscall_main_table[] = {
|
|
LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 270
|
|
LINX_(__NR_process_vm_writev, sys_process_vm_writev), // 271
|
|
LINXY(__NR_getrandom, sys_getrandom), // 278
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create), // 279
|
|
|
|
// The numbers below are bogus. (See comment further down.)
|
|
// When pulling entries above this line, change the numbers
|
|
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
|
|
index f0bd3cb..7c72545 100644
|
|
--- a/coregrind/m_syswrap/syswrap-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-linux.c
|
|
@@ -3018,6 +3018,26 @@ POST(sys_getrandom)
|
|
POST_MEM_WRITE( ARG1, ARG2 );
|
|
}
|
|
|
|
+PRE(sys_memfd_create)
|
|
+{
|
|
+ PRINT("sys_memfd_create ( %#lx, %ld )" , ARG1,ARG2);
|
|
+ PRE_REG_READ2(int, "memfd_create",
|
|
+ char *, uname, unsigned int, flags);
|
|
+ PRE_MEM_RASCIIZ( "memfd_create(uname)", ARG1 );
|
|
+}
|
|
+
|
|
+POST(sys_memfd_create)
|
|
+{
|
|
+ vg_assert(SUCCESS);
|
|
+ if (!ML_(fd_allowed)(RES, "memfd_create", tid, True)) {
|
|
+ VG_(close)(RES);
|
|
+ SET_STATUS_Failure( VKI_EMFILE );
|
|
+ } else {
|
|
+ if (VG_(clo_track_fds))
|
|
+ ML_(record_fd_open_nameless)(tid, RES);
|
|
+ }
|
|
+}
|
|
+
|
|
/* ---------------------------------------------------------------------
|
|
utime wrapper
|
|
------------------------------------------------------------------ */
|
|
diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c
|
|
index bddadd0..fa921c1 100644
|
|
--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
|
|
@@ -1118,7 +1118,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
|
LINXY (__NR_process_vm_readv, sys_process_vm_readv), // 345
|
|
LINX_ (__NR_process_vm_writev, sys_process_vm_writev), // 346
|
|
//..
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 353
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 353
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 354
|
|
};
|
|
|
|
SyscallTableEntry* ML_(get_linux_syscall_entry) (UInt sysno)
|
|
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
|
|
index c51ab6f..f8340ab 100644
|
|
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
|
|
@@ -910,7 +910,8 @@ static SyscallTableEntry syscall_main_table[] = {
|
|
LINXY (__NR_clock_adjtime, sys_clock_adjtime),
|
|
LINXY (__NR_process_vm_readv, sys_process_vm_readv),
|
|
LINX_ (__NR_process_vm_writev, sys_process_vm_writev),
|
|
- LINXY(__NR_getrandom, sys_getrandom)
|
|
+ LINXY(__NR_getrandom, sys_getrandom),
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create)
|
|
};
|
|
|
|
SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
|
|
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
|
|
index 5c058c2..6b53abe 100644
|
|
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
|
|
@@ -1258,7 +1258,8 @@ static SyscallTableEntry syscall_table[] = {
|
|
LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351
|
|
LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352
|
|
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 359
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 359
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 360
|
|
};
|
|
|
|
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
|
|
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
index c173593..25e0bde 100644
|
|
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
@@ -1157,7 +1157,8 @@ static SyscallTableEntry syscall_table[] = {
|
|
LINXY(__NR_process_vm_readv, sys_process_vm_readv), // 351
|
|
LINX_(__NR_process_vm_writev, sys_process_vm_writev),// 352
|
|
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 359
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 359
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 360
|
|
};
|
|
|
|
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
|
|
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
|
|
index 6363e2d..ca969c8 100644
|
|
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
|
|
@@ -1050,9 +1050,9 @@ static SyscallTableEntry syscall_table[] = {
|
|
// ?????(__NR_sched_getattr, ), // 346
|
|
// ?????(__NR_renameat2, ), // 347
|
|
// ?????(__NR_seccomp, ), // 348
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 349
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 349
|
|
|
|
-// ?????(__NR_memfd_create, ), // 350
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 350
|
|
};
|
|
|
|
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
|
|
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
|
|
index dcbf425..0e87679 100644
|
|
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
|
|
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
|
|
@@ -1821,8 +1821,8 @@ static SyscallTableEntry syscall_table[] = {
|
|
// LIN__(__NR_renameat2, sys_ni_syscall), // 353
|
|
// LIN__(__NR_seccomp, sys_ni_syscall), // 354
|
|
|
|
- LINXY(__NR_getrandom, sys_getrandom) // 355
|
|
-// LIN__(__NR_memfd_create, sys_ni_syscall), // 356
|
|
+ LINXY(__NR_getrandom, sys_getrandom), // 355
|
|
+ LINXY(__NR_memfd_create, sys_memfd_create) // 356
|
|
// LIN__(__NR_bpf, sys_ni_syscall) // 357
|
|
};
|
|
|