mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Make moans about unknown ioctls more informative (#336772)
This is a slightly modified version of a patch from Ivo Raisr <ivosh@ivosh.net>. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14116
This commit is contained in:
parent
5e2364ac36
commit
980d6c2a8c
@ -3427,16 +3427,27 @@ void ML_(PRE_unknown_ioctl)(ThreadId tid, UWord request, UWord arg)
|
||||
* commands becomes very tiresome.
|
||||
*/
|
||||
} else if (/* size == 0 || */ dir == _VKI_IOC_NONE) {
|
||||
//VG_(message)(Vg_UserMsg, "UNKNOWN ioctl %#lx\n", request);
|
||||
//VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
|
||||
static Int moans = 3;
|
||||
static UWord unknown_ioctl[10];
|
||||
static Int moans = sizeof(unknown_ioctl) / sizeof(unknown_ioctl[0]);
|
||||
|
||||
if (moans > 0 && !VG_(clo_xml)) {
|
||||
moans--;
|
||||
VG_(umsg)("Warning: noted but unhandled ioctl 0x%lx"
|
||||
" with no size/direction hints\n", request);
|
||||
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" );
|
||||
/* 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] == request)
|
||||
break;
|
||||
if (unknown_ioctl[i] == 0) {
|
||||
unknown_ioctl[i] = request;
|
||||
moans--;
|
||||
VG_(umsg)("Warning: noted but unhandled ioctl 0x%lx"
|
||||
" with no size/direction hints.\n", request);
|
||||
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 {
|
||||
//VG_(message)(Vg_UserMsg, "UNKNOWN ioctl %#lx\n", request);
|
||||
|
||||
@ -49,6 +49,7 @@ dist_noinst_SCRIPTS = \
|
||||
filter_cmdline0 \
|
||||
filter_cmdline1 \
|
||||
filter_fdleak \
|
||||
filter_ioctl_moans \
|
||||
filter_linenos \
|
||||
filter_none_discards \
|
||||
filter_shell_output \
|
||||
@ -100,6 +101,7 @@ EXTRA_DIST = \
|
||||
fucomip.stderr.exp fucomip.vgtest \
|
||||
gxx304.stderr.exp gxx304.vgtest \
|
||||
ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \
|
||||
ioctl_moans.stderr.exp ioctl_moans.vgtest \
|
||||
manythreads.stdout.exp manythreads.stderr.exp manythreads.vgtest \
|
||||
map_unaligned.stderr.exp map_unaligned.vgtest \
|
||||
map_unmap.stderr.exp map_unmap.stdout.exp map_unmap.vgtest \
|
||||
@ -184,6 +186,7 @@ check_PROGRAMS = \
|
||||
fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \
|
||||
fdleak_socketpair \
|
||||
floored fork fucomip \
|
||||
ioctl_moans \
|
||||
mmap_fcntl_bug \
|
||||
munmap_exe map_unaligned map_unmap mq \
|
||||
pending \
|
||||
|
||||
8
none/tests/filter_ioctl_moans
Normal file
8
none/tests/filter_ioctl_moans
Normal file
@ -0,0 +1,8 @@
|
||||
#! /bin/sh
|
||||
|
||||
dir=`dirname $0`
|
||||
|
||||
$dir/../../tests/filter_stderr_basic |
|
||||
|
||||
# Remove "Nulgrind, ..." line and the following copyright line.
|
||||
sed "/^Nulgrind, the minimal Valgrind tool/ , /./ d"
|
||||
39
none/tests/ioctl_moans.c
Normal file
39
none/tests/ioctl_moans.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Tests Valgrind moans about unknown ioctl.
|
||||
10 unique moans should be produced.
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/* An ioctl request for a strange ioctl device driver. */
|
||||
#define IOCTL_REQUEST_BASE 0x12345670
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x0);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x0);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x2);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x3);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x4);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x5);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x5);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x6);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x7);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x8);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x9);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x0);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xa);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xb);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xc);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xd);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x1);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xe);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0x0);
|
||||
ioctl(-1, IOCTL_REQUEST_BASE + 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
none/tests/ioctl_moans.stderr.exp
Normal file
30
none/tests/ioctl_moans.stderr.exp
Normal file
@ -0,0 +1,30 @@
|
||||
Warning: noted but unhandled ioctl 0x12345670 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345671 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345672 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345673 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345674 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345675 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345676 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345677 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345678 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
Warning: noted but unhandled ioctl 0x12345679 with no size/direction hints.
|
||||
This could cause spurious value errors to appear.
|
||||
See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
|
||||
3
none/tests/ioctl_moans.vgtest
Normal file
3
none/tests/ioctl_moans.vgtest
Normal file
@ -0,0 +1,3 @@
|
||||
prog: ioctl_moans
|
||||
vgopts: -q
|
||||
stderr_filter: filter_ioctl_moans
|
||||
Loading…
x
Reference in New Issue
Block a user