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