Re: [LTP] [PATCH] fix fanotify syscall check on compat kernel

chrubis
2014-04-17T10:16:58Z

Hi!
> > I think that the x32 ABI should be handled here as well (as in the
> > fallocate.h). Mike can you confirm?
>
> Yes, I think so.
> I even thought of changing the #if to C-Coding like
> if ((sizeof(void*) == 8)
> call 64bit_syscall
> else
> call 32bit_syscall_wrapper;

That would be still wrong on the x32 ABI where pointers are 32 bit but
syscalls get 64 bit parameters.

> I'm not sure if this can avoid the ifdefs though...

We should probably move the ifdef condition from the fallocate.h header
to some generic top-level header and use it in the syscall wrappers.

Something like:

#define LTP_USE_64_ABI __WORDSIZE == 64 || ....

Then we can use as:

#if LTP_USE_64_ABI
...
#else
...
#endif

> > Also I've been unable to make the testcases work with -m32 on x86_64
> > both with and without the patch and even when using glibc wrappers from
> > sys/fallocate.h, in all cases the error is EINVAL which suggets that the
> > parameters are passed wrongly somewhere on the way.
>
> Does it work on the same kernel with -m64 ?
> In any case, for the tests to work the kernel needs to have been compiled with the
> kernel option CONFIG_FANOTIFY_ACCESS_PERMISSIONS set. In my initial tests this
> option wasn't set and I got EINVAL too.

It does work when compiled natively, i.e. without passing the -m32 to
the compiler commandline.

Something is wrong but I haven't yet found what.