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 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.

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]