FreeBSD Bugzilla – Attachment 186198 Details for
Bug 219715
devel/valgrind: unhandled syscall (ino64 fallout?)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
wip fix
0001-ino64-support.patch (text/plain), 7.68 KB, created by
Roman Bogorodskiy
on 2017-09-09 15:11:25 UTC
(
hide
)
Description:
wip fix
Filename:
MIME Type:
Creator:
Roman Bogorodskiy
Created:
2017-09-09 15:11:25 UTC
Size:
7.68 KB
patch
obsolete
>From 2a237a62fa63ada68f16640fa6bdf97e38215e90 Mon Sep 17 00:00:00 2001 >From: Roman Bogorodskiy <bogorodskiy@gmail.com> >Date: Sat, 9 Sep 2017 18:27:15 +0400 >Subject: [PATCH] ino64 support > >--- > coregrind/m_libcfile.c | 2 +- > coregrind/m_syswrap/priv_syswrap-freebsd.h | 4 ++ > coregrind/m_syswrap/syswrap-freebsd.c | 65 ++++++++++++++++++++++++++++++ > include/vki/vki-freebsd.h | 54 +++++++++++++++++++++++++ > include/vki/vki-scnums-freebsd.h | 4 ++ > 5 files changed, 128 insertions(+), 1 deletion(-) > >diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c >index 377f84a..53de080 100644 >--- a/coregrind/m_libcfile.c >+++ b/coregrind/m_libcfile.c >@@ -369,7 +369,7 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf ) > # if defined(VGO_linux) || defined(VGO_darwin) || defined(VGO_freebsd) > /* First try with fstat64. If that doesn't work out, fall back to > the vanilla version. */ >-# if defined(__NR_fstat64) >+# if defined(__NR_fstat64) && 0 > { struct vki_stat64 buf64; > res = VG_(do_syscall2)(__NR_fstat64, (UWord)fd, (UWord)&buf64); > if (!(sr_isError(res) && sr_Err(res) == VKI_ENOSYS)) { >diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h >index 63d122f..715ad48 100644 >--- a/coregrind/m_syswrap/priv_syswrap-freebsd.h >+++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h >@@ -97,10 +97,12 @@ DECL_TEMPLATE(freebsd, sys_setegid); > DECL_TEMPLATE(freebsd, sys_seteuid); > DECL_TEMPLATE(freebsd, sys_stat); > DECL_TEMPLATE(freebsd, sys_fstat); >+DECL_TEMPLATE(freebsd, sys_fstat64); > DECL_TEMPLATE(freebsd, sys_lstat); > DECL_TEMPLATE(freebsd, sys_pathconf); > DECL_TEMPLATE(freebsd, sys_fpathconf); > DECL_TEMPLATE(freebsd, sys_getdirentries); >+DECL_TEMPLATE(freebsd, sys_getdirentries64); > DECL_TEMPLATE(freebsd, sys_mmap); > DECL_TEMPLATE(freebsd, sys___syscall); > DECL_TEMPLATE(freebsd, sys_lseek); >@@ -208,6 +210,7 @@ DECL_TEMPLATE(freebsd, sys_kevent); > DECL_TEMPLATE(freebsd, sys_sendfile); > DECL_TEMPLATE(freebsd, sys_statfs6); > DECL_TEMPLATE(freebsd, sys_fstatfs6); >+DECL_TEMPLATE(freebsd, sys_fstatfs64); > DECL_TEMPLATE(freebsd, sys_fhstatfs6); > DECL_TEMPLATE(freebsd, sys_thr_exit); > DECL_TEMPLATE(freebsd, sys_thr_self); >@@ -251,6 +254,7 @@ DECL_TEMPLATE(freebsd, sys_fchmodat); > DECL_TEMPLATE(freebsd, sys_fchownat); > DECL_TEMPLATE(freebsd, sys_fexecve); > DECL_TEMPLATE(freebsd, sys_fstatat); >+DECL_TEMPLATE(freebsd, sys_fstatat64); > DECL_TEMPLATE(freebsd, sys_futimesat); > DECL_TEMPLATE(freebsd, sys_linkat); > DECL_TEMPLATE(freebsd, sys_mkdirat); >diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c >index bf6b1f1..4d5e4ad 100644 >--- a/coregrind/m_syswrap/syswrap-freebsd.c >+++ b/coregrind/m_syswrap/syswrap-freebsd.c >@@ -885,6 +885,18 @@ POST(sys_fstat) > POST_MEM_WRITE( ARG2, sizeof(struct vki_stat) ); > } > >+PRE(sys_fstat64) >+{ >+ PRINT("sys_fstat64 ( %ld, %#lx )", ARG1, ARG2); >+ PRE_REG_READ2(long, "fstat", unsigned long, fd, struct stat32 *, buf); >+ PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat64) ); >+} >+ >+POST(sys_fstat64) >+{ >+ POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); >+} >+ > PRE(sys_pathconf) > { > PRINT("sys_pathconf ( %#lx(%s), %ld )",ARG1,(char *)ARG1,ARG2); >@@ -1029,6 +1041,26 @@ POST(sys_getdirentries) > } > } > >+PRE(sys_getdirentries64) >+{ >+ *flags |= SfMayBlock; >+ PRINT("sys_getdents ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3); >+ PRE_REG_READ3(vki_ssize_t, "getdirentries", >+ unsigned int, fd, struct dirent *, dirp, >+ vki_size_t, count); >+ PRE_MEM_WRITE( "getdirentries(dirp)", ARG2, ARG3 ); >+} >+ >+POST(sys_getdirentries64) >+{ >+ vg_assert(SUCCESS); >+ if (RES > 0) { >+ POST_MEM_WRITE( ARG2, RES ); >+ if ( ARG4 != 0 ) >+ POST_MEM_WRITE( ARG4, sizeof (vki_off_t)); >+ } >+} >+ > PRE(sys_seteuid) > { > PRINT("sys_seteuid ( %ld )", ARG1); >@@ -1251,6 +1283,19 @@ POST(sys_fstatfs6) > POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) ); > } > >+PRE(sys_fstatfs64) >+{ >+ PRINT("sys_fstatfs64 ( %ld, %#lx )", ARG1, ARG2); >+ PRE_REG_READ2(long, "fstatfs6", >+ unsigned int, fd, struct statfs *, buf); >+ PRE_MEM_WRITE( "fstatfs6(buf)", ARG2, sizeof(struct vki_statfs64) ); >+} >+ >+POST(sys_fstatfs64) >+{ >+ POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs64) ); >+} >+ > PRE(sys_statfs6) > { > PRINT("sys_statfs6 ( %#lx(%s), %#lx )",ARG1,(char *)ARG1,ARG2); >@@ -3132,6 +3177,20 @@ POST(sys_fstatat) > POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) ); > } > >+PRE(sys_fstatat64) >+{ >+ PRINT("sys_fstatat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3); >+ PRE_REG_READ3(long, "fstatat", >+ int, dfd, char *, file_name, struct stat *, buf); >+ PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 ); >+ PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) ); >+} >+ >+POST(sys_fstatat64) >+{ >+ POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) ); >+} >+ > PRE(sys_unlinkat) > { > *flags |= SfMayBlock; >@@ -4427,6 +4486,12 @@ const SyscallTableEntry ML_(syscall_table)[] = { > BSDXY(__NR_accept4, sys_accept4), //541 > BSDXY(__NR_pipe2, sys_pipe2), // 542 > >+ // ino64 >+ BSDXY(__NR_fstat64, sys_fstat64), // 551 >+ BSDXY(__NR_fstatat64, sys_fstatat64), // 552 >+ BSDXY(__NR_getdirentries64, sys_getdirentries64), // 554 >+ GENXY(__NR_fstatfs64, sys_fstatfs), // 556 >+ > BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn > > }; >diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h >index aee453e..c1c7b8b 100644 >--- a/include/vki/vki-freebsd.h >+++ b/include/vki/vki-freebsd.h >@@ -367,6 +367,36 @@ struct vki_stat { > unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec)); > }; > >+struct vki_stat64 { >+ vki_uint64_t st_dev; >+ vki_uint64_t st_ino; >+ vki_mode_t st_mode; >+ vki_uint64_t st_nlink; >+ vki_uid_t st_uid; >+ vki_gid_t st_gid; >+ vki_uint64_t st_rdev; >+#if 0 >+ struct vki_timespec st_atimespec; >+ struct vki_timespec st_mtimespec; >+ struct vki_timespec st_ctimespec; >+#else >+ vki_time_t st_atime; >+ long st_atime_nsec; >+ vki_time_t st_mtime; >+ long st_mtime_nsec; >+ vki_time_t st_ctime; >+ long st_ctime_nsec; >+#endif >+ vki_off_t st_size; >+ vki_blkcnt_t st_blocks; >+ vki_blksize_t st_blksize; >+ vki_fflags_t st_flags; >+ vki_uint32_t st_gen; >+ vki_int32_t st_lspare; >+ struct vki_timespec st_birthtimespec; >+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec)); >+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec)); >+}; > > //---------------------------------------------------------------------- > // From linux-2.6.8.1/include/linux/sched.h >@@ -941,6 +971,30 @@ struct vki_statfs { > char f_mntonname[VKI_MNAMELEN]; > }; > >+struct vki_statfs64 { >+ vki_uint32_t f_version; >+ vki_uint32_t f_type; >+ vki_uint64_t f_flags; >+ vki_uint64_t f_bsize; >+ vki_uint64_t f_iosize; >+ vki_uint64_t f_blocks; >+ vki_uint64_t f_bfree; >+ vki_int64_t f_bavail; >+ vki_uint64_t f_files; >+ vki_int64_t f_ffree; >+ vki_uint64_t f_syncwrites; >+ vki_uint64_t f_asyncwrites; >+ vki_uint64_t f_syncreads; >+ vki_uint64_t f_asyncreads; >+ vki_uint64_t f_spare[10]; >+ vki_uint32_t f_namemax; >+ vki_uid_t f_owner; >+ vki_fsid_t f_fsid; >+ char f_charspare[80]; >+ char f_fstypename[VKI_MFSNAMELEN]; >+ char f_mntfromnname[VKI_MNAMELEN]; >+ char f_mntonname[VKI_MNAMELEN]; >+}; > #define MAXFIDSZ 16 > > struct vki_fid { >diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h >index 605a42f..ffa241d 100644 >--- a/include/vki/vki-scnums-freebsd.h >+++ b/include/vki/vki-scnums-freebsd.h >@@ -412,6 +412,10 @@ > #define __NR_shmctl 512 > #define __NR_accept4 541 > #define __NR_pipe2 542 >+#define __NR_fstat64 551 >+#define __NR_fstatat64 552 >+#define __NR_getdirentries64 554 >+#define __NR_fstatfs64 556 > > #define __NR_fake_sigreturn 1000 > >-- >2.14.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 219715
: 186198 |
186200
|
200906