From: Julian Seward Date: Mon, 8 Sep 2014 11:19:48 +0000 (+0000) Subject: Add support for sys_pivot_root and sys_unshare. Patch from X-Git-Tag: svn/VALGRIND_3_10_0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af2f0eb3ab87dea1436759a7565977b82d027714;p=thirdparty%2Fvalgrind.git Add support for sys_pivot_root and sys_unshare. Patch from Steven Stewart-Gallus . n-i-bz (patch on dev@, 27 Aug 2014) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14494 --- diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 40c43a0ed0..f7b6b90792 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -87,6 +87,7 @@ DECL_TEMPLATE(linux, sys_syslog); DECL_TEMPLATE(linux, sys_vhangup); DECL_TEMPLATE(linux, sys_sysinfo); DECL_TEMPLATE(linux, sys_personality); +DECL_TEMPLATE(linux, sys_pivot_root); DECL_TEMPLATE(linux, sys_sysctl); DECL_TEMPLATE(linux, sys_prctl); DECL_TEMPLATE(linux, sys_sendfile); @@ -232,6 +233,8 @@ DECL_TEMPLATE(linux, sys_sched_rr_get_interval); DECL_TEMPLATE(linux, sys_sched_setaffinity); DECL_TEMPLATE(linux, sys_sched_getaffinity); +DECL_TEMPLATE(linux, sys_unshare); + // These ones have different parameters and/or return values on Darwin. // Also, some archs on Linux do not match the generic wrapper for sys_pipe. DECL_TEMPLATE(linux, sys_munlockall); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 5999270d3d..92148a88ed 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -873,7 +873,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_vhangup, sys_vhangup), // 153 // (__NR_modify_ldt, sys_modify_ldt), // 154 - // (__NR_pivot_root, sys_pivot_root), // 155 + LINX_(__NR_pivot_root, sys_pivot_root), // 155 LINXY(__NR__sysctl, sys_sysctl), // 156 LINXY(__NR_prctl, sys_prctl), // 157 PLAX_(__NR_arch_prctl, sys_arch_prctl), // 158 @@ -1013,7 +1013,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_pselect6, sys_pselect6), // 270 LINXY(__NR_ppoll, sys_ppoll), // 271 -// LINX_(__NR_unshare, sys_unshare), // 272 + LINX_(__NR_unshare, sys_unshare), // 272 LINX_(__NR_set_robust_list, sys_set_robust_list), // 273 LINXY(__NR_get_robust_list, sys_get_robust_list), // 274 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index db17e1d945..b2ba414f6b 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1022,7 +1022,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_setfsuid32, sys_setfsuid), // 215 LINX_(__NR_setfsgid32, sys_setfsgid), // 216 -//zz // (__NR_pivot_root, sys_pivot_root), // 217 */Linux + LINX_(__NR_pivot_root, sys_pivot_root), // 217 GENXY(__NR_mincore, sys_mincore), // 218 GENX_(__NR_madvise, sys_madvise), // 219 @@ -1161,7 +1161,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_shmctl, sys_shmctl), // 308 // LINX_(__NR_pselect6, sys_pselect6), // -// LINX_(__NR_unshare, sys_unshare), // 310 + LINX_(__NR_unshare, sys_unshare), // 310 LINX_(__NR_set_robust_list, sys_set_robust_list), // 311 LINXY(__NR_get_robust_list, sys_get_robust_list), // 312 // LINX_(__NR_splice, sys_ni_syscall), // 313 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index bcd00f1cdf..9f6623ef98 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -554,6 +554,18 @@ PRE(sys_umount) PRE_MEM_RASCIIZ( "umount2(path)", ARG1); } +/* Not actually wrapped by GLibc but does things with the system + * mounts so it is put here. + */ +PRE(sys_pivot_root) +{ + PRINT("sys_pivot_root ( %s %s )", (HChar*)ARG1, (HChar*)ARG2); + PRE_REG_READ2(int, "pivot_root", char *, new_root, char *, old_root); + PRE_MEM_RASCIIZ( "pivot_root(new_root)", ARG1); + PRE_MEM_RASCIIZ( "pivot_root(old_root)", ARG2); +} + + /* --------------------------------------------------------------------- 16- and 32-bit uid/gid wrappers ------------------------------------------------------------------ */ @@ -2749,6 +2761,12 @@ POST(sys_sched_getaffinity) POST_MEM_WRITE(ARG3, ARG2); } +PRE(sys_unshare) +{ + PRINT("sys_unshare ( %ld )", ARG1); + PRE_REG_READ1(int, "unshare", int, flags); +} + /* --------------------------------------------------------------------- miscellaneous wrappers ------------------------------------------------------------------ */ diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index 799836d377..c1154a2a15 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -782,7 +782,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_mlockall, sys_mlockall), LINX_ (__NR_munlockall, sys_munlockall), LINX_ (__NR_vhangup, sys_vhangup), - /* GENX_(__NR_pivot_root,sys_pivot_root), */ + LINX_ (__NR_pivot_root,sys_pivot_root), LINXY (__NR__sysctl, sys_sysctl), LINXY (__NR_prctl, sys_prctl), LINXY (__NR_adjtimex, sys_adjtimex), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index b7ab7b6d02..2e5436d75b 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1103,7 +1103,7 @@ static SyscallTableEntry syscall_table[] = { // __NR_multiplexer // 201 GENXY(__NR_getdents64, sys_getdents64), // 202 -//.. // (__NR_pivot_root, sys_pivot_root), // 203 */Linux + LINX_(__NR_pivot_root, sys_pivot_root), // 203 LINXY(__NR_fcntl64, sys_fcntl64), // 204 GENX_(__NR_madvise, sys_madvise), // 205 GENXY(__NR_mincore, sys_mincore), // 206 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index d660833463..d775f9bd0e 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1022,7 +1022,7 @@ static SyscallTableEntry syscall_table[] = { // _____(__NR_pciconfig_iobase, sys_pciconfig_iobase), // 200 // _____(__NR_multiplexer, sys_multiplexer), // 201 GENXY(__NR_getdents64, sys_getdents64), // 202 -// _____(__NR_pivot_root, sys_pivot_root), // 203 + LINX_(__NR_pivot_root, sys_pivot_root), // 203 LINXY(__NR_fcntl64, sys_fcntl64), // 204 !!!!?? 32bit only */ GENX_(__NR_madvise, sys_madvise), // 205 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index c51a9f4c52..2ba73f90dc 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1655,7 +1655,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_setfsuid32, sys_setfsuid), // 215 LINX_(__NR_setfsgid32, sys_setfsgid), // 216 -//zz // (__NR_pivot_root, sys_pivot_root), // 217 */Linux + LINX_(__NR_pivot_root, sys_pivot_root), // 217 GENXY(__NR_mincore, sys_mincore), // 218 GENX_(__NR_madvise, sys_madvise), // 219 @@ -1767,7 +1767,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_pselect6, sys_pselect6), // 308 LINXY(__NR_ppoll, sys_ppoll), // 309 -// LINX_(__NR_unshare, sys_unshare), // 310 + LINX_(__NR_unshare, sys_unshare), // 310 LINX_(__NR_set_robust_list, sys_set_robust_list), // 311 LINXY(__NR_get_robust_list, sys_get_robust_list), // 312 LINX_(__NR_splice, sys_splice), // 313