From: Julian Seward Date: Sun, 13 Oct 2002 15:06:24 +0000 (+0000) Subject: Add Jeremy Fitzhardinge's --weird-hacks=lax-ioctls patch, and add some docs. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a44f9ac6bda123c827ee84f3ff86c3f17c49d59;p=thirdparty%2Fvalgrind.git Add Jeremy Fitzhardinge's --weird-hacks=lax-ioctls patch, and add some docs. MERGE TO HEAD git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_1_0_BRANCH@1223 --- diff --git a/docs/manual.html b/docs/manual.html index cd0bc88e9b..013059ec7f 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -670,8 +670,18 @@ follows: unexpectedly in the write() system call, you may find the --trace-syscalls=yes --trace-sched=yes flags useful. +

+

  • lax-ioctls Reduce accuracy of ioctl checking. + Doesn't require the full buffer to be initialized when + writing. Without this, using some device drivers with a + large number of strange ioctl commands becomes very + tiresome. You can use this as a quick hack to workaround + unimplemented ioctls. A better long-term solution is to + write a proper wrapper for the ioctl. This is quite easy + - for details read + README_MISSING_SYSCALL_OR_IOCTL in the + source distribution. -
  • diff --git a/valgrind.in b/valgrind.in index b0082fb32e..c4c84db2d3 100755 --- a/valgrind.in +++ b/valgrind.in @@ -145,7 +145,7 @@ if [ $# = 0 ] || [ z"$dousage" = z1 ]; then echo " --D1=,, set D1 cache manually" echo " --L2=,, set L2 cache manually" echo " --weird-hacks=hack1,hack2,... [no hacks selected]" - echo " recognised hacks are: ioctl-VTIME truncate-writes" + echo " recognised hacks are: ioctl-VTIME truncate-writes lax-ioctls" echo "" echo echo " options for debugging Valgrind itself are:" diff --git a/vg_syscall_mem.c b/vg_syscall_mem.c index 632ca5bcc0..19203a15cb 100644 --- a/vg_syscall_mem.c +++ b/vg_syscall_mem.c @@ -2334,7 +2334,17 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid ) default: { UInt dir = _IOC_DIR(arg2); UInt size = _IOC_SIZE(arg2); - if (/* size == 0 || */ dir == _IOC_NONE) { + if (VG_(strstr)(VG_(clo_weird_hacks), "lax-ioctls") != NULL) { + /* + * Be very lax about ioctl handling; the only + * assumption is that the size is correct. Doesn't + * require the full buffer to be initialized when + * writing. Without this, using some device + * drivers with a large number of strange ioctl + * commands becomes very tiresome. + */ + } + else if (/* size == 0 || */ dir == _IOC_NONE) { VG_(message)(Vg_UserMsg, "Warning: noted but unhandled ioctl 0x%x" " with no size/direction hints", @@ -2345,6 +2355,9 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid ) VG_(message)(Vg_UserMsg, " See README_MISSING_SYSCALL_OR_IOCTL for guidance on" " writing a proper wrapper." ); + VG_(message)(Vg_UserMsg, + " Alternatively, suppress using flag: " + "--weird-hacks=lax-ioctls"); } else { if ((dir & _IOC_WRITE) && size > 0) must_be_readable(tst, "ioctl(generic)", arg3, size);