Bug 11320 - ABI incompatibility: EINVAL when calling ioctl(, EVIOCSFF) from 32-bit program on 64-bit kernel
Summary: ABI incompatibility: EINVAL when calling ioctl(, EVIOCSFF) from 32-bit progra...
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Dmitry Torokhov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-13 10:22 UTC by Vitaliy Margolen
Modified: 2008-08-15 06:31 UTC (History)
0 users

See Also:
Kernel Version: 2.6.25.11-0.1-default
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Vitaliy Margolen 2008-08-13 10:22:54 UTC
Problem Description:
When making a ioctl(fd, EVIOCSFF) call from 32-bit program running on 64-bit arch I'm always receiving EINVAL. Further investigation lead to the cause:

Definition of the EVIOCSFF uses sizeof(struct ff_effect) which differs between 32-bit and 64-bit. 64-bit kernel does not recognize EVIOCSFF thus returning EINVAL.

Steps to reproduce:

A simple test program:

#include <linux/input.h>
#include <stdio.h>
int main(int argc, char * argv[])
{
     printf("sizeof(struct ff_effect) = %d EVIOCSFF=%#x\n", sizeof(struct ff_effect), EVIOCSFF);

     return 0;
}

$ gcc test_size.c -o test_size && ./test_size
sizeof(struct ff_effect) = 48 EVIOCSFF=0x40304580
$ gcc -m32 test_size.c -o test_size32 && ./test_size32
sizeof(struct ff_effect) = 44 EVIOCSFF=0x402c4580
Comment 1 Dmitry Torokhov 2008-08-13 10:46:15 UTC
Please try 2.6.27-rc3 or apply this commit:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f2278f31d6feb9036eaa79f2e8abcce850420abd
Comment 2 Vitaliy Margolen 2008-08-14 20:04:10 UTC
The above patch does fix the problem for me. Thank you.

Note You need to log in before you can comment on or make changes to this bug.