|
From: Ivan S. <van...@gm...> - 2014-01-26 10:32:36
|
Currently valgrind prints lots of false positives on any alsa mixer program, due to unimplemented VKI_SNDRV_CTL_IOCTL_TLV_READ ioctl: ==2862== Conditional jump or move depends on uninitialised value(s) ==2862== at 0x4E72307: snd_tlv_get_dB_range (tlv.c:170) ==2862== by 0x4E8A74D: get_dB_range (simple_none.c:1162) ==2862== by 0x4E8A7EE: get_dB_range_ops (simple_none.c:1176) ==2862== by 0x4E8559C: snd_mixer_selem_get_playback_dB_range (simple.c:298) ==2862== Uninitialised value was created by a heap allocation ==2862== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2862== by 0x4E8A57E: init_db_range (simple_none.c:1114) ==2862== by 0x4E8A714: get_dB_range (simple_none.c:1159) ==2862== by 0x4E8A7EE: get_dB_range_ops (simple_none.c:1176) ==2862== by 0x4E8559C: snd_mixer_selem_get_playback_dB_range (simple.c:298) The problem is that this ioctl uses flexible array member and valgrind doesn't know how many elements of this array are initialized. I implemented a patch to fix this problem https://github.com/sorokin/valgrind/commit/610b24f0668a373451da82b9fd948c674a2583c6 I also implemented a few more ioctls, they are not strictly necessary (at least on program I tested on), so I can remove them from patch. During implementing new ioctls, I discovered that on my x86-64 system 'cmd' argument of 'sys_ioctl' sometimes has 32 most significant bits 0 and sometimes 1. As I understand kernel receive arguments for syscall as if they have type '[unsigned] long', but signature of 'sys_ioctl' is long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); So 32 most significant bits of 'cmd' are discarded in kernel. Therefore ioctl(15, 0xffffffffc008551a, 0x1041bf0) and ioctl(15, 0x00000000c008551a, 0x1041bf0) are the same ioctls. The patch to ignore these 32 bits in valgrind is here: https://github.com/sorokin/valgrind/commit/426ceb042b3bc04bea249ab5fb7931b452ee6bca Should you please review these patches, and if they are OK, I will submit them to KDE bugzilla, as it is said in http://valgrind.org/support/summary.html. |