aboutsummaryrefslogtreecommitdiff
path: root/testcases
AgeCommit message (Collapse)Author
2020-05-15pty04: Avoid receiving packets from all interfacesRichard Palethorpe
Raw sockets receive all packets from all interfaces as soon as they are created. They don't need to be bound to one or more interfaces like I thought. This creates the socket with a NULL packet type which appears to be unused in the Linux kernel and receives no packets. The protocol is then changed to ETH_P_ALL when binding to the netdevice we are interested in. I assume it is impossible for a packet to have zero for its packet type. Most likely using ETH_P_LOOP would have been OK too, but I suppose that is really used by some hardware. This also fixes various other problems that have been observed with this test. Such as memory allocation failures. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Cc: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz> Tested-by: Jan Stancek <jstancek@redhat.com>
2020-05-15rpc: TCONF when tests aren't compiled + remove kill warningPetr Vorel
Without this test failure was wrongly reported: rpc_test 1 TFAIL: tirpc_rpcb_getaddr 10.0.0.2 536875000 failed unexpectedly Also make sure with variable that server has started before trying to kill it. Kill server with SIGPIPE, should be enough and SIGKILL produced warning, which might be confused: /opt/ltp/testcases/bin/rpc_test.sh: line 61: 3827 Killed $SERVER $PROGNUMNOSVC Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com> Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-14kill11: Fix build on systems without SIGSTKFLTPetr Vorel
This fixes build on mipsel/mips/sparc64. Fixes: 69e287bc2 ("syscalls/kill11: convert to new library") Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-14pty04: Fix read retriesRichard Palethorpe
We need to increase the data pointer by the amount already read. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-14syscalls: Fix issues around calling syscalls with old timespecViresh Kumar
The non _time64 syscalls can only be called with the old timespec and calling them with the libc timespec or the new kernel timespec is incorrect. Similarly, calling the libc interfaces with the old timespec is incorrect as well and they should be called only with the libc timespec. This patch updates various testcases that have got this issue. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-14fanotify16: Fix build for systems without fanotify_fid_tPetr Vorel
Fixes: d20a3e8f9 ("syscalls/fanotify: New test for FAN_MODIFY_DIR") Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-14Add missing mode argument to open(..., O_CREAT)Martin Doucha
Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
2020-05-14pty04: Retry reads when short and wait longerRichard Palethorpe
Even though reads are blocking and packets are flipped into the netdevice buffer whole, it seems read may return before a full packet is read into user land. Retrying read should prevent timeouts and read failures on some machines. Also this increases the timeout to wait for the checkpoint to a large value because sometimes the kernel stalls, possibly while trying to (re)claim memory, and this causes the checkpoint wait to timeout and everything to be cleaned up. If the kernel is left in a stalled state, this can result in a stack trace which is more useful. Closes: #674 Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Reported-by: Jan Stancek <jstancek@redhat.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Acked-by: Jan Stancek <jstancek@redhat.com> Cc: Petr Vorel <pvorel@suse.cz>
2020-05-13rpc-tirpc: Fix building TI-RPC codePetr Vorel
TIRPC_LIBS variable requires including include/mk/env_pre.mk. (Not included in Makefile.inc, because all it's users include env_pre.mk themselves). Fixes: c7d2a7458 ("rpc-tirpc: Detect libtirpc with pkg-config") Fixes: 60b20c428 ("rpc: Enable and fix build basic RPC tests with glibc SunRPC") Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-13pty04: Remove unnecessary volatile and style fixRichard Palethorpe
Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
2020-05-12rpc_test.sh: Add missing TBROKPetr Vorel
Fixme: 3190368d2 ("rpc/rpc_test.sh: Rewrite into new shell API") Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-12syscalls/ioctl_loop05: Ensure do zero offset when using -i parameterYang Xu
Currently, we use return instead of zero_offset. I debug this code (early return, ext4 filesystem)as below: --------------------------------------- TEST(ioctl(dev_fd, LOOP_SET_DIRECT_IO, 1)); if (TST_RET == 0) { tst_res(TPASS, "LOOP_SET_DIRECT_IO succeeded unexpectedly"); SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0); } return; --------------------------------------- this case will be broke when using i parameter, ioctl_loop05.c:62: BROK: ioctl(3,LOOP_SET_DIRECT_IO,...) failed: EINVAL (22) It seems the last test affected this test, so I move zero status to the beginning of the test to avoid unknown error. Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-11nm01: fix regex matching internal symbolsJan Stancek
Current regex matches any word character followed by space and one of letters "abdft". So it doesn't match only symbol type, but can match for example value and size: $ grep "\w [a,b,d,f,t]" nm.out __libc_csu_init T 10000640 b4 matches ^ ^ Signed-off-by: Jan Stancek <jstancek@redhat.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Tested-by: Li Wang <liwang@redhat.com>
2020-05-08syscalls/ioctl_loop01: Add linux git tagYang Xu
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Acked-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
2020-05-07pty04: Correct struct member sizesRichard Palethorpe
Also remove min_kver because it is arbitrary. We know this test works on much older kernels, but it will probably hit bugs that have been fixed for a long time. Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> [ pvorel: change CAN_MTU to use sizeof() like it's in <linux/can.h> ] Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-07syscall/prctl06: Fix proc NoNewPrivs detectionCyril Hrubis
The prctl() syscall check does return in case of success hence the check for NoNewPrivs was never executed. Move the proc check before the sycall check to fix that. Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-06route: Increase default loop valuesPetr Vorel
by introducing $ROUTE_CHANGE_IP for shell based tests (only these rewritten into new shell API) and $ROUTE_CHANGE_NETLINK with C Netlink API based tests. Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-06net/route: Add netlink based route change testsPetr Vorel
changing destination, gateway and interface. These tests are inspired by shell tests, but send UDP packets instead of ICMP and there is no receiver of the packets thus no verification. Tests are much faster that shell tests. lhost address is not used, but NIC is set (required by interface tests). * use libmnl and new C API, requires pkg-config (and pkg.m4 macro for aclocal) for detection (but that's already needed for TI-RPC tests) * add shell wrappers * move common code for changing iface to route-lib.sh * travis: add libmnl libraries to most of travis jobs * cleanup test description and Makefile Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-06net: Add SAFE_GETADDRINFO()Petr Vorel
based on setup_addrinfo() from netstress.c. Added only to new C API, thus code kept in tst_net.c, instead of safe_net.c, which is also for legacy API. Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-06syscalls/prctl: Use TST_ASSERT_FILE_INT/STRYang Xu
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-06pty04: Fix build for kernel headers < v4.2-rc1Petr Vorel
Acked-by: Cyril Hrubis <chrubis@suse.cz> Acked-by: Jan Stancek <jstancek@redhat.com> Suggested-by: Richard Palethorpe <rpalethorpe@suse.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2020-05-06syscalls/ioctl_loop05: Do not fail on successCyril Hrubis
The code in __loop_update_dio() uses inode->i_sb->s_bdev to get the logical block size for the backing file for the loop device. If that pointer is NULL, which happens to be the case for Btrfs, the checks for alignment and block size are ignored and direct I/O can be turned on regardless of the offset and logical block size. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> CC: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
2020-05-06net/sendfile01.sh: Check with timeoutPetr Vorel
Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com>
2020-05-06tst_test.sh: eval TST_RETRY_FN_EXP_BACKOFF functionPetr Vorel
It helps to have more advanced commands without having to declare function. Suggested-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com>
2020-05-05openposix/twoptimers: handle signal correctlyYang Xu
Block this signal so that the default default disposition (program termination) does not kill the parent process before we can get the pending signal with sigwait(). Also remove the useless sleep in child that only slow downs the test. Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-05pty04: Add SLCAN ldisc and check for CVE-2020-11494Richard Palethorpe
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-05pty04: Use guarded buffers for transmissionRichard Palethorpe
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-05syscalls/lremovexattr01: use strncmp() to check attribute valueJan Stancek
Fix the test failure and following compile warning (gcc version 10.0.1): lremovexattr01.c: In function ‘verify_lremovexattr’: lremovexattr01.c:98:6: warning: ‘strcmp’ of a string of length 13 and an array of size 13 evaluates to nonzero [-Wstring-compare] 98 | if (strcmp(got_value, XATTR_VALUE)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Stancek <jstancek@redhat.com>
2020-05-05syscalls/fanotify: Use fanotify_save_fid() helperAmir Goldstein
Reduce some boiler plate code in FAN_REPORT_FID tests and save fid only once per object instead of once per expected event. Suggested-by: Matthew Bobrowski <mbobrowski@mbobrowski.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz>
2020-05-05syscalls/fanotify: New test for FAN_MODIFY_DIRAmir Goldstein
- Watch dir modify events with name info - Watch self delete events w/o name info - Test inode and filesystem marks - Check getting events for all file and dir names Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org> Acked-by: Jan Kara <jack@suse.cz>
2020-05-05syscalls/fanotify15: Add a test case for inode marksAmir Goldstein
Test reporting events with fid also with recusrive inode marks: - Test events "on self" (FAN_DELETE_SELF) on file and dir - Test events "on child" (FAN_MODIFY) on file With recursive inode marks, verify that the FAN_MODIFY event reported to parent "on child" is merged with the FAN_MODIFY event reported to child. The new test case is a regression test for commit f367a62a7cad: fanotify: merge duplicate events on parent and child Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org> Acked-by: Jan Kara <jack@suse.cz>
2020-05-05syscalls/fanotify15: Minor correctionsAmir Goldstein
- Fix calculation of events buffer size - Read file events and dir events in two batches - Generate FAN_MODIFY event explicitly with truncate() operation instead of FAN_ATTRIB event implicitly with create() operation - FAN_MODIFY and FAN_DELETE_SELF may or may not be merged - Use macro FAN_MOVE for FAN_MOVED_FROM | FAN_MOVED_TO Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org> Acked-by: Jan Kara <jack@suse.cz>
2020-05-05syscalls/inotify09: Add git tag.Cyril Hrubis
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-04connect02: Handle setsockopt(IP_ADDRFORM) kernel bugMartin Doucha
setsockopt(IP_ADDRFORM) is broken in kernel 5.6 which results in test failures. Add the fix commit hash to test tags and check setsockopt() return value manually so that the test can print the appropriate hints. Also improve post-fail cleanup. Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-04Skip Btrfs in LVM stress testsMartin Doucha
Delayed file deletion makes stress testing Btrfs on small block devices difficult. Each test case would require explicit FS cleanup synchronization. Drop Btrfs tests from LVM runfile for now. Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-04Add LVM support scriptsMartin Doucha
Add support scripts for LVM tests that can be used with external testing tools. - generate_lvm_runfile.sh - Creates runtest/lvm.local with testcases for all locally supported FS types - prepare_lvm.sh - Creates 2 LVM volume groups and mounts logical volumes for all locally supported FS types - cleanup_lvm.sh - remove LVM volume groups created by prepare_lvm.sh and release the associated loop devices Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-05-04Allow acquiring multiple loop devicesMartin Doucha
tst_acquire_device__() currently uses a hardcoded filename so only one loop device can be used at a time. Allow setting arbitrary temp filename so that multiple different loop devices can be acquired. Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-04-28syscalls/ioctl_loop08: Add LOOP_SET/GET_STATUS64 sizelimit field testYang Xu
Test its lo_sizelimit field. If lo_sizelimit is 0, it means max available. If sizelimit is less than loop_size, loopsize will be truncated. Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
2020-04-28syscalls/prctl: Use TST_ASSERT_STR/INTYang Xu
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-04-28syscalls/pipe2: Add pipe2_02_child in .gitignoreViresh Kumar
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2020-04-27syscalls/fanotify09: Check merging of events on directoriesAmir Goldstein
In a setup of mount mark and directory inode mark the FAN_ONDIR flag set on one mark should not imply that all events in the other mark mask are expected on directories as well. Add a regression test case for commit 55bf882c7f13: fanotify: fix merging marks masks with FAN_ONDIR Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2020-04-27syscalls/clock_adjtime: Add support for time64 testsViresh Kumar
This adds support for time64 tests to the existing clock_adjtime() syscall tests. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2020-04-27syscalls/epoll2: Remove PCL epoll testYang Xu
This case depends on PCL(Portable Coroutine Library), but this library isn't included in most distributions. This case can't be compile since 2004. This case is hard to maintain and useless, we can remove it. Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2020-04-27Add test for CVE 2017-1000112Martin Doucha
Fixes #489 Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2020-04-27Add tags to setsockopt04 and add it to the CVE runfileMartin Doucha
Fixes #491 Signed-off-by: Martin Doucha <mdoucha@suse.cz> Acked-by: Cyril Hrubis <metan@ucw.cz>
2020-04-27Add test for CVE 2018-8897Martin Doucha
Fixes #594 Signed-off-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <metan@ucw.cz>
2020-04-27futex/futex_wait_bitset.h: Fix misspellingSean T Allen
Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Sean T Allen <sean@seantallen.com>
2020-04-26syscalls/pipe2_02: Add new test for pipe2 O_CLOEXEC flagYang Xu
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Li Wang <liwang@redhat.com>
2020-04-26syscalls/pipe2_01: convert into new APIYang Xu
Merged pipe2_02.c into pipe2_01.c. Also, add O_DIRECT flag test. This flag was introduced since commit 9883035ae7ed ("pipes: add a "packetized pipe" mode for writing"). Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Li Wang <liwang@redhat.com>
2020-04-26pipe2: add min_kver = "2.6.35" in pipe2_04Li Wang
To change the capacity of a pipe was involved from kernel-2.6.35 version. F_SETPIPE_SZ (int; since Linux 2.6.35) F_GETPIPE_SZ (void; since Linux 2.6.35) Signed-off-by: Li Wang <liwang@redhat.com>