Tom Hughes wrote:
On 03/01/2008, Nicholas Nethercote <[EMAIL PROTECTED]> wrote:

If a kernel type isn't present, a vki_* version should be added.
See the comment at the top of include/vki/vki-linux.h.

But don't trust the man pages, they mostly describe glibc's wrappers for the
syscalls.  These mostly are the same as the kernel syscalls, but not always.
Only trust the kernel code.  Unfortunately, I can't remember where in the
kernel code the syscall prototypes are defined.

There isn't one place - each call will be in a place appropriate to
the systems it works on. In this case fs/sync.c is the file, and the
prototype is:

  asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t
nbytes, unsigned int flags)

So vki_loff_t is the thing to use.

Fixed.  Thanks!


The wrapper should probably also validate the file descriptor like
other wrappers which have file descriptor arguments do.

I couldn't find any wrappers that do anything special with their file descriptor arguments. (Look at sys_llseek in syswrap-linux.c, for example...)

I've attached an updated patch.

-Rusty


Tom


diff -ru -x Makefile -x md5sums -x debian -x 'config*' valgrind-3.3.0/coregrind/m_syswrap/priv_syswrap-linux.h valgrind-3.3.0-original/coregrind/m_syswrap/priv_syswrap-linux.h
--- valgrind-3.3.0/coregrind/m_syswrap/priv_syswrap-linux.h	2007-12-21 11:50:33.000000000 -0800
+++ valgrind-3.3.0-original/coregrind/m_syswrap/priv_syswrap-linux.h	2007-12-10 15:18:43.000000000 -0800
@@ -220,9 +220,6 @@
 DECL_TEMPLATE(linux, sys_rt_sigqueueinfo);
 DECL_TEMPLATE(linux, sys_rt_sigsuspend);
 
-// Linux-specific?
-DECL_TEMPLATE(linux, sys_sync_file_range);
-
 /* ---------------------------------------------------------------------
    Wrappers for sockets and ipc-ery.  These are split into standalone
    procedures because x86-linux hides them inside multiplexors
diff -ru -x Makefile -x md5sums -x debian -x 'config*' valgrind-3.3.0/coregrind/m_syswrap/syswrap-amd64-linux.c valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-amd64-linux.c
--- valgrind-3.3.0/coregrind/m_syswrap/syswrap-amd64-linux.c	2007-12-21 11:45:57.000000000 -0800
+++ valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-amd64-linux.c	2007-12-10 15:18:43.000000000 -0800
@@ -1371,8 +1371,6 @@
 //   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
-
-   LINX_(__NR_sync_file_range,   sys_sync_file_range),  // 277
 };
 
 const UInt ML_(syscall_table_size) = 
diff -ru -x Makefile -x md5sums -x debian -x 'config*' valgrind-3.3.0/coregrind/m_syswrap/syswrap-linux.c valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-linux.c
--- valgrind-3.3.0/coregrind/m_syswrap/syswrap-linux.c	2008-01-07 11:03:22.000000000 -0800
+++ valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-linux.c	2007-12-10 15:18:43.000000000 -0800
@@ -1625,15 +1625,6 @@
    POST_MEM_WRITE( ARG3, sizeof(vki_timer_t) );
 }
 
-PRE(sys_sync_file_range)
-{
-  PRINT("sys_sync_file_range ( %d, %lld, %lld, %d )",
-	ARG1,ARG2,ARG3,ARG4);
-  PRE_REG_READ4(long, "sync_file_range",
-		int, fd, vki_loff_t, offset, vki_loff_t, nbytes,
-		unsigned int, flags);
-}
-
 PRE(sys_timer_settime)
 {
    PRINT("sys_timer_settime( %lld, %d, %p, %p )", (ULong)ARG1,ARG2,ARG3,ARG4);
diff -ru -x Makefile -x md5sums -x debian -x 'config*' valgrind-3.3.0/coregrind/m_syswrap/syswrap-x86-linux.c valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-x86-linux.c
--- valgrind-3.3.0/coregrind/m_syswrap/syswrap-x86-linux.c	2008-01-07 11:03:43.000000000 -0800
+++ valgrind-3.3.0-original/coregrind/m_syswrap/syswrap-x86-linux.c	2007-12-10 15:18:43.000000000 -0800
@@ -2217,8 +2217,6 @@
    LINX_(__NR_set_robust_list,	 sys_set_robust_list),  // 311
    LINXY(__NR_get_robust_list,	 sys_get_robust_list),  // 312
 
-   LINX_(__NR_sync_file_range,   sys_sync_file_range),  // 314
-
    LINX_(__NR_utimensat,         sys_utimensat),        // 320
 };
 
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to