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