Linux system call wrappers: truncate ioctl request number to 32 bits
As explained in https://bugs.kde.org/show_bug.cgi?id=331829, when passing
an ioctl request number as an int to a function the request number will
be sign-extended to 64 bits on 64-bit systems. Avoid that this causes
Valgrind to fail to recognize an ioctl by truncating the request number
to 32 bits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14232 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index f83b59f..20b6d0e 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -5373,6 +5373,8 @@
{
*flags |= SfMayBlock;
+ ARG2 = (UInt)ARG2;
+
// We first handle the ones that don't use ARG3 (even as a
// scalar/non-pointer argument).
switch (ARG2 /* request */) {
@@ -7103,6 +7105,8 @@
{
vg_assert(SUCCESS);
+ ARG2 = (UInt)ARG2;
+
/* --- BEGIN special IOCTL handlers for specific Android hardware --- */
# if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android) \