NetBSD/tests/lib
jym ca453df649 Add a simple test case to check executable mapping rights for mprotect(2).
- provide an exec_prot_support() routine so $ARCH can indicate whether
it supports execution protection or not, and skip test accordingly.

- have a trivial 'return_one' shellcode to copy anywhere in a page, and
call it. The decision to keep the assembly solution is mine, reasons are
twofold:

   - all pure-C implementations cannot be controlled easily:
     bounds detection (beginning/end) of return_one is unpredictable,
     or requires the use of overkill solutions like libelf. Using
     dlsym(3) was a good proposal, however I can't use it to know the
     end address of the payload. It makes copying of the shellcode a bit
     more difficult: using a constant may be too small (code has not been
     entirely copied, and can lead to errors that can be erroneously
     detected as "test passed"), or too big (depending on where it is mapped
     in memory, copying past the end of the function may trigger SIGSEGV).

   - I have to ensure that the resulting assembly is the most compact
     possible, especially as it will be reused to test other parts of
     memory (stack, data, rodata, etc.).

Only i386 and amd64 are implemented so far. Others will come in due time.
FWIW, writing the exec_prot_support() callback and the return_one payload
should be enough. Writing callback requires good knowledge of the platform,
depending on chip revision, CPU, board, MMU... the protection level may vary.

Current files are put under lib/libc/arch/* and lib/libc/common/. Feel free to
move them around the tests/ tree. Keep in mind that the common/ and arch/ code
will be used outside of libc, so please do not hide them too deep in the tree.

I checked a few architectures via build.sh cross-compile, and will keep an
eye on buildbot for potential build breakage. Feel free to contact me in
case you see any, of course.
2011-07-18 23:16:08 +00:00
..
csu Whitespace. 2011-01-02 09:33:45 +00:00
libbluetooth test that data element lists are not placed by sdp_put_attr(), as 2011-04-16 07:32:27 +00:00
libc Add a simple test case to check executable mapping rights for mprotect(2). 2011-07-18 23:16:08 +00:00
libcurses apply some -Wno-enum-compare. 2011-06-29 02:36:26 +00:00
libdes Convert the libdes tests to atf. 2010-08-25 16:46:36 +00:00
libevent Revert previous. The atf default timeout has been reverted, and the 90sec 2010-11-29 18:21:15 +00:00
libm Remove the amd64-part from the Qemu checks. The following tests fail also on 2011-07-08 05:10:05 +00:00
libobjc Test case requires the GCC specific thread extension for Objective C, so 2011-05-20 13:03:45 +00:00
libposix Turn warns on for all tests and fix all the bugs. 2011-06-11 18:03:17 +00:00
libprop PR fixed, remove expected failure. 2011-04-20 20:02:58 +00:00
libpthread As per PR lib/44818, remove 'lib/libpthread/t_status'. It takes two minutes 2011-04-06 16:04:16 +00:00
librt Fix typo. 2011-03-25 09:39:19 +00:00
librumpclient Enable the "send a lot of syscall requests before exec" code, since 2011-03-08 15:35:28 +00:00
librumphijack Instead of doing 'atf_check ... sh -c foo', just do 'atf_check ... -x foo'. 2011-05-14 17:42:28 +00:00
libskey Convert the libposix, libprop, librt, libskey and libutil tests to ATF. 2010-07-16 13:56:31 +00:00
libutil Add missing __RCSID(3), again. 2011-03-30 17:03:02 +00:00
semaphore Explicitly terminate threads to prevent crashes on exit. 2011-03-23 13:57:04 +00:00
Makefile Add libcurses test 2011-04-10 09:49:13 +00:00
Makefile.inc add Makefile.inc everywhere so that we can set WARNS=4 by default. Amazing 2010-11-03 16:10:19 +00:00