The EVIOCGRAB ioctl takes as argument just one parameter and tests whether it's truthy: It does *not* dereference the argument. Valgrind, however, doesn't agree, and logs a warning like the following when one calls ioctl(fd, EVIOCGRAB, 1): ``` ==6155== Thread 3: ==6155== Syscall param ioctl(generic) points to unaddressable byte(s) ==6155== at 0x4A9723B: ioctl (ioctl.c:36) ... ==6155== Address 0x1 is not stack'd, malloc'd or (recently) free'd ``` STEPS TO REPRODUCE 1. Run valgrind on a program that calls ioctl(some_fd, EVIOCGRAB, 1); (or any other truthy value) OBSERVED RESULT False positive warning. EXPECTED RESULT No warning; this is safe code. SOFTWARE/OS VERSIONS This is on Debian Sid, but I've reproduced it on Fedora as well. This affects (at least) Linuxes 6.12.4 and 6.12.6. Valgrind v3.2.0 and 3.24.0. ADDITIONAL INFORMATION Let me know if there's any other info I can provide. Thanks :)
This was an easy fix: commit 59eb5a4af60d4beb2c6910a1fa6cdf8d1f3a56f2 (HEAD -> master) Author: Mark Wielaard <mark@klomp.org> Date: Wed Jan 8 16:52:03 2025 +0100 linux: support EVIOCGRAB ioctl EVIOCGRAB just takes an int argument. https://bugs.kde.org/show_bug.cgi?id=498143 We do support some, but not all, input device ioctls. Please file another report if others are missing.
Also pushed to VALGRIND_3_24_BRANCH commit b732f86998e39ca8714330f487804428b54c481c Author: Mark Wielaard <mark@klomp.org> Date: Wed Jan 8 16:52:03 2025 +0100 linux: support EVIOCGRAB ioctl EVIOCGRAB just takes an int argument. https://bugs.kde.org/show_bug.cgi?id=498143 (cherry picked from commit 59eb5a4af60d4beb2c6910a1fa6cdf8d1f3a56f2)
Thanks! Glad the fix was simple :)