From: Tom Hughes Date: Sun, 3 Mar 2013 12:57:20 +0000 (+0000) Subject: Implement the name_to_handle_at system call for x86 and amd64. X-Git-Tag: svn/VALGRIND_3_9_0~377 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=269fc43ee7be025d8eaad9ebd10ba1c8db986e97;p=thirdparty%2Fvalgrind.git Implement the name_to_handle_at system call for x86 and amd64. Based on patch from Asmadeus to fix BZ#308930. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13304 --- diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index dd3db5a06d..0aeffaae86 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -175,6 +175,7 @@ DECL_TEMPLATE(linux, sys_readlinkat); DECL_TEMPLATE(linux, sys_fchmodat); DECL_TEMPLATE(linux, sys_faccessat); DECL_TEMPLATE(linux, sys_utimensat); +DECL_TEMPLATE(linux, sys_name_to_handle_at); DECL_TEMPLATE(linux, sys_add_key); DECL_TEMPLATE(linux, sys_request_key); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index ea762f3d40..82e67bdf45 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -1071,7 +1071,7 @@ static SyscallTableEntry syscall_table[] = { // LINX_(__NR_fanotify_init, sys_ni_syscall), // 300 // LINX_(__NR_fanotify_mark, sys_ni_syscall), // 301 LINXY(__NR_prlimit64, sys_prlimit64), // 302 -// LINX_(__NR_name_to_handle_at, sys_ni_syscall), // 303 + LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 303 // LINX_(__NR_open_by_handle_at, sys_ni_syscall), // 304 // LINX_(__NR_clock_adjtime, sys_ni_syscall), // 305 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index ff532b194a..dd6fcc5302 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4403,6 +4403,24 @@ PRE(sys_faccessat) PRE_MEM_RASCIIZ( "faccessat(pathname)", ARG2 ); } +PRE(sys_name_to_handle_at) +{ + PRINT("sys_name_to_handle_at ( %ld, %#lx(%s), %#lx, %#lx, %ld )", ARG1, ARG2, (char*)ARG2, ARG3, ARG4, ARG5); + PRE_REG_READ5(int, "name_to_handle_at", + int, dfd, const char *, name, + struct vki_file_handle, handle, + int *, mnt_id, int, flag); + PRE_MEM_RASCIIZ( "name_to_handle_at(name)", ARG2 ); + PRE_MEM_WRITE( "name_to_handle_at(handle)", ARG3, sizeof(struct vki_file_handle) + ((struct vki_file_handle*)ARG3)->handle_bytes ); + PRE_MEM_WRITE( "name_to_handle_at(mnt_id)", ARG4, sizeof(int) ); +} + +POST(sys_name_to_handle_at) +{ + POST_MEM_WRITE( ARG3, sizeof(struct vki_file_handle) + ((struct vki_file_handle*)ARG3)->handle_bytes ); + POST_MEM_WRITE( ARG4, sizeof(int) ); +} + /* --------------------------------------------------------------------- p{read,write}v wrappers ------------------------------------------------------------------ */ diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 6b0a288946..7e7589930f 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1814,7 +1814,7 @@ static SyscallTableEntry syscall_table[] = { // LINX_(__NR_fanotify_mark, sys_ni_syscall), // 339 LINXY(__NR_prlimit64, sys_prlimit64), // 340 -// LINX_(__NR_name_to_handle_at, sys_ni_syscall), // 341 + LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 341 // LINX_(__NR_open_by_handle_at, sys_ni_syscall), // 342 // LINX_(__NR_clock_adjtime, sys_ni_syscall), // 343 // LINX_(__NR_syncfs, sys_ni_syscall), // 344 diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 60282ae88b..05d994bae7 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -3106,6 +3106,17 @@ struct vki_xen_privcmd_mmapbatch_v2 { #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH _VKI_IOC(_VKI_IOC_NONE, 'P', 3, sizeof(struct vki_xen_privcmd_mmapbatch)) #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 _VKI_IOC(_VKI_IOC_NONE, 'P', 4, sizeof(struct vki_xen_privcmd_mmapbatch_v2)) +//---------------------------------------------------------------------- +// From linux-3.4.0/include/linux/fs.h +//---------------------------------------------------------------------- + +struct vki_file_handle { + __vki_u32 handle_bytes; + int handle_type; + /* file identifier */ + unsigned char f_handle[0]; +}; + #endif // __VKI_LINUX_H /*--------------------------------------------------------------------*/