This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Test for syscall templates


On Fri, Feb 10, 2017 at 07:51:07AM -0500, Zack Weinberg wrote:
> tatus: RO
> Content-Length: 1507
> Lines: 31
> 
> On Fri, Feb 10, 2017 at 5:10 AM, Yury Norov <ynorov@caviumnetworks.com> wrote:
> >
> > The following test sets the errno to invalid value (0xdead), and then calls
> > write() with intentionally wrong file descriptor to force kernel to return
> > EBADF which should be stored at errno location by SYSCALL_ERROR_HANDLER().
> >
> > The test is failed before and passed after [1] for aarch64/ilp32 [2-3].
> >
> > This is RFC because I'm not sure this is right way to check the macro
> > as it implicitly assumes that the write() is implemented with templates,
> > which may be wrong for some platform, or will become wrong in future.
> 
> What you're testing here is errno.  You're verifying that a particular
> syscall does set errno to a meaningful value when it fails.
> 
> The way to make this a better test, and ensure you're not just testing
> one of several possible implementations of the
> trap-to-kernel-then-set-errno sequence, is to apply the same test to
> _as many syscalls as practical_.  I think it would be enough to get
> all of the ones that can fail due to invalid arguments.  Testing for
> _all_ the error cases is out of scope for glibc's testsuite -- that's
> more of an LTP thing -- and there are quite a few that can only fail
> due to resource exhaustion or inadequate permissions, both of which
> require more machinery to set up than we have.

I wrote this test to address this comment of Adhemerval:

>> My only concern is if and why glibc own testsuite did not trigger this
>> kind of issue in any tests and in this case if it was by chance or lack
>> of coverage. If glibc own testsuite does not trigger this in any case,
>> I think a regression should be added.

https://sourceware.org/ml/libc-alpha/2017-02/msg00129.html

So I only tried to test error path of syscall template. If you think
that the correct way to do it is to call each syscall that may fail
in each possible scenario - then I think glibc don't need the test
like that, and we'd run LTP to find bugs of that sort - like I did in
this case.
 
> This should probably be two test programs: posix/test-errno.c would
> test all the syscalls in POSIX, and
> sysdeps/unix/sysv/linux/test-errno.c would test all the Linux-specific
> ones.

> zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]