Closed nbriggs closed 4 years ago
FreeBSD ioctl coding does not use direction 0 to indicate no arguments, so:
diff --git a/none/tests/ioctl_moans.c b/none/tests/ioctl_moans.c index 3af6d4f0f..d35075834 100644 --- a/none/tests/ioctl_moans.c +++ b/none/tests/ioctl_moans.c @@ -11,6 +11,8 @@ is not == 0 everywhere. */ # if defined(VGO_linux) #define IOCTL_REQUEST_BASE (0x12345670 | _IOC(_IOC_NONE,0,0,0)) +# elif defined(VGO_freebsd) +#define IOCTL_REQUEST_BASE (0x12345670 | _IO(0,0)) # else #define IOCTL_REQUEST_BASE 0x12345670 # endif
Also, syswrap-freebsd.c doesn't handle the tracking of the unknown ioctls in the same manner that syswrap-generic.c does thus:
diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 10f684f65..ebd3f2212 100755 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3835,20 +3835,28 @@ PRE(sys_ioctl) * commands becomes very tiresome. */ } else if (/* size == 0 || */ dir == _VKI_IOC_NONE) { - static Int moans = 3; - if (moans > 0 && !VG_(clo_xml)) { - moans--; - VG_(message)(Vg_UserMsg, - "Warning: noted but unhandled ioctl 0x%lx" - " with no size/direction hints\n", - ARG2); - VG_(message)(Vg_UserMsg, - " This could cause spurious value errors" - " to appear.\n"); - VG_(message)(Vg_UserMsg, - " See README_MISSING_SYSCALL_OR_IOCTL for " - "guidance on writing a proper wrapper.\n" ); - } + static UWord unknown_ioctl[10]; + static Int moans = sizeof(unknown_ioctl) / sizeof(unknown_ioctl[0]); + + if (moans > 0 && !VG_(clo_xml)) { + /* Check if have not already moaned for this request. */ + UInt i; + for (i = 0; i < sizeof(unknown_ioctl)/sizeof(unknown_ioctl[0]); i++) { + if (unknown_ioctl[i] == ARG2) + break; + if (unknown_ioctl[i] == 0) { + unknown_ioctl[i] = ARG2; + moans--; + VG_(umsg)("Warning: noted but unhandled ioctl 0x%lx" + " with no size/direction hints.\n", ARG2); + VG_(umsg)(" This could cause spurious value errors to appear.\n"); + VG_(umsg)(" See README_MISSING_SYSCALL_OR_IOCTL for " + "guidance on writing a proper wrapper.\n" ); + //VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); + return; + } + } + } } else { if ((dir & _VKI_IOC_WRITE) && size > 0) PRE_MEM_READ( "ioctl(generic)", ARG3, size);
Pushed with To https://github.com/paulfloyd/freebsd_valgrind.git de86498bc..1d5dac090 freebsd -> freebsd
FreeBSD ioctl coding does not use direction 0 to indicate no arguments, so:
Also, syswrap-freebsd.c doesn't handle the tracking of the unknown ioctls in the same manner that syswrap-generic.c does thus: