-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scripted cleanup #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripted cleanup #1
Conversation
This is a scripted change done using the following command:
find . -type d -name .git -prune -o \
-type f \! -name \*\~ \! -name .\#\* \
\! -name \*.gz \! -name \*.pdf \! -name \*.patch -print0 | \
xargs -0 sed -i -e '$a\'
Signed-off-by: Chris Dearman <chris@mips.com>
This is a scripted change done using the following command:
find . -type d -name .git -prune -o \
-type f \! -name \*\~ \! -name .\#\* \
\! -name \*.gz \! -name \*.pdf \! -name \*.patch -print0 | \
xargs -0 sed -i -e 's/[\t ]*$//'
Signed-off-by: Chris Dearman <chris@mips.com>
|
patches must be sent to the ltp list for review. you can use |
|
On Thu, Oct 18, 2012 at 12:27 PM, Mike Frysinger
|
|
You don't need to merge the pull request, just download the patch and apply it with git am, like: And close the pull request. |
|
I pulled the branch and verified that the changes were sane via diff: diff -NaruwBb --exclude '.git' ltp.2/ scripted-cleanup/ Thanks! |
|
@yaneurabeya, I was looking at the patch, and while it looks mostly ok, I think the file Got damaged... could you verify please? |
|
the sticking point isn't how to apply things, it's the review portion. review happens on the mailing list. |
|
On 10/18/2012 02:25 PM, Lucas Meneghel Rodrigues wrote:
Good catch. Thanks for spotting this. Unfortunately the patch to fix this is also too large to send to the ML I've uploaded the patch to github and made another pull request so that Thanks Chris Dearman Desk: +1 408 530 5092 Cell: +1 408 398 5531 |
This testcase crashed in about 1/200 of runs on s390x system with 2 CPUs: Core was generated by `./7-1.run-test'. Program terminated with signal 11, Segmentation fault. #0 _dl_fini () at dl-fini.c:228 228 if (l->l_init_called) (gdb) bt #0 _dl_fini () at dl-fini.c:228 #1 0x000003fffd345c62 in __run_exit_handlers (status=<optimized out>, listp=0x3fffd4b4a78 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:77 #2 0x000003fffd345ca4 in __GI_exit (status=<optimized out>) at exit.c:99 #3 0x000003fffd3294e6 in __libc_start_main (main=0x80000b18 <main>, argc=<optimized out>, ubp_av=0x3ffff970108, init=<optimized out>, fini=0x80000d4c <__libc_csu_fini>, rtld_fini=0x3fffd50821c <_dl_fini>, stack_end=0x3ffff970050) at libc-start.c:257 #4 0x0000000080000a26 in _start () (gdb) x/1x l 0x9fd4f2918: Cannot access memory at address 0x9fd4f2918 The crash was presumably caused by race, where variable defined in main() got out of scope before operation started by aio_read() completed. Patched version succesfully made 100000 iterations. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
This patch introduces wait so that testcases exit doesn't race with completion of aio_fsync. This is to avoid SIGSEGV: #0 0x000003fffd1f4a24 in _IO_flush_all_lockp () at genops.c:850 #1 0x000003fffd1f4b8e in _IO_cleanup () at genops.c:1010 #2 0x000003fffd1a88f6 in __run_exit_handlers () at exit.c:90 #3 0x000003fffd1a89b0 in __GI_exit () at exit.c:99 #4 0x000003fffd18c822 in __libc_start_main () at libc-start.c:292 #5 0x0000000080000b76 in _start () Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Test can hang during startup in following scenario:
main new thread
--------------------------------------------------+-------------------------------------
int create_thread(int prio, pthread_t * tid) |
... |
pthread_create(tid, &attr, thread_func, NULL);|
while (!thread_started) { |
| void *thread_func(void *data)
| thread_started = 1;
| pthread_cond_signal(&cond);
pthread_mutex_lock(&c_mutex); |
132: pthread_cond_wait(&cond, &c_mutex); |
|65: pthread_mutex_lock(&mutex);
|
(gdb) bt
#0 0x00007fd588808f6d in __lll_lock_wait () from /lib64/libpthread.so.0
#1 0x00007fd588804d31 in _L_lock_790 () from /lib64/libpthread.so.0
#2 0x00007fd588804c37 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x0000000000400bba in thread_func (data=0x0) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:65
#4 0x00007fd588802de3 in start_thread () from /lib64/libpthread.so.0
#5 0x00007fd5885300dd in clone () from /lib64/libc.so.6
(gdb) t 2
(gdb) bt
#0 0x00007fd5888066f5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000400d9b in create_thread (prio=5, tid=0x7fffdb562678) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:132
#2 0x0000000000400e82 in main () at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:174
Fix this by using same c_mutex in thread_func for updating
thread_started and signalling cond.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
If request is already in progress, wait for it to complete, so it doesn't race with exit of testcase (aiocb is allocated on main's stack), to avoid aio_cancel_1-1 and 2-1 sporadically crashing. For example: Core was generated by `./aio_cancel_2-1.run-test '. Program terminated with signal 11, Segmentation fault. (gdb) bt #0 0x00003fffa6e81158 in __GI__exit (status=0) #1 0x00003fffa6df3054 in __run_exit_handlers (...) #2 0x00003fffa6df3134 in __GI_exit (status=<optimized out>) #3 0x00003fffa6dd4588 in generic_start_main (main=0x10000bbc ...) #4 0x00003fffa6dd4774 in __libc_start_main (...) #5 0x0000000000000000 in ?? () Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
Description of Problem: There is a race condition if we map a same file on different processes. Region tracking is protected by mmap_sem and hugetlb_instantiation_mutex. When we do mmap, we don't grab a hugetlb_instantiation_mutex, but only mmap_sem (exclusively). This doesn't prevent other tasks from modifying the region structure, so it can be modified by two processes concurrently. Testcase hugemmap06.c is the trigger to cause system crash: crash> bt -s PID: 4492 TASK: ffff88033e437520 CPU: 2 COMMAND: "hugemmap06" #0 [ffff88033dbb3960] machine_kexec+395 at ffffffff8103d1ab #1 [ffff88033dbb39c0] crash_kexec+114 at ffffffff810cc4f2 #2 [ffff88033dbb3a90] oops_end+192 at ffffffff8153c840 #3 [ffff88033dbb3ac0] die+91 at ffffffff81010f5b #4 [ffff88033dbb3af0] do_general_protection+338 at ffffffff8153c332 #5 [ffff88033dbb3b20] general_protection+37 at ffffffff8153bb05 [exception RIP: list_del+40] RIP: ffffffff812a3598 RSP: ffff88033dbb3bd8 RFLAGS: 00010292 RAX: dead000000100100 RBX: ffff88013cf37340 RCX: 0000000000002dc2 RDX: dead000000200200 RSI: 0000000000000046 RDI: 0000000000000009 RBP: ffff88033dbb3be8 R8: 0000000000015598 R9: 0000000000000000 R10: 000000000000000f R11: 0000000000000009 R12: 000000000000000a R13: ffff88033d64b9e8 R14: ffff88033e5b9720 R15: ffff88013cf37340 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0000 #6 [ffff88033dbb3bf0] region_add+154 at ffffffff811698da #7 [ffff88033dbb3c40] alloc_huge_page+669 at ffffffff8116a61d #8 [ffff88033dbb3ce0] hugetlb_fault+1083 at ffffffff8116b9bb #9 [ffff88033dbb3d90] handle_mm_fault+917 at ffffffff81153295 #10 [ffff88033dbb3e00] __do_page_fault+326 at ffffffff8104f156 #11 [ffff88033dbb3f20] do_page_fault+62 at ffffffff8153e78e #12 [ffff88033dbb3f50] page_fault+37 at ffffffff8153bb35 RIP: 00000000004027c6 RSP: 00007f7cadef9e80 RFLAGS: 00010297 RAX: 000000005a49238f RBX: 00007ffcb2d19320 RCX: 000000357498e084 RDX: 000000357498e0b0 RSI: 00007f7cadef9e5c RDI: 000000357498e4e0 RBP: 0000000000000008 R8: 000000357498e0a0 R9: 000000357498e100 R10: 00007f7cadefa9d0 R11: 0000000000000206 R12: 0000000000000007 R13: 0000000000000002 R14: 0000000000000003 R15: 00002aaaac000000 ORIG_RAX: ffffffffffffffff CS: 0033 SS: 002b The fix are all these below commits: f522c3ac00(mm, hugetlb: change variable name reservations to resv) 9119a41e90(mm, hugetlb: unify region structure handling) 7b24d8616b(mm, hugetlb: fix race in region tracking) 1406ec9ba6(mm, hugetlb: improve, cleanup resv_map parameters) Signed-off-by: Li Wang <liwang@redhat.com> Signed-off-by: Jan Stancek <jstancek@redhat.com>
checkpoint_wake is currently sleeping also in case when it wakes up all processes. This creates problem for combination of checkpoints and process_state_wait, because it creates false impression, that child is sleeping on operation following checkpoint_wake (#2), while it really sleeps inside checkpoint_wake (#1). child parent TST_CHECKPOINT_WAKE #1 TST_CHECKPOINT_WAIT TST_PROCESS_STATE_WAIT(child, 'S') kill(child, SIGINT) sleep() #2 This patch avoids sleep in checkpoint_wake if all processes has been already woken up. Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
This case is the reproducer of ftrace userstacktrace bug.
BUG: unable to handle kernel paging request at 00000000417683c0
IP: [<ffffffff8105c834>] update_curr+0x124/0x1e0
PGD 41a796067 PUD 0
Thread overran stack, or stack corrupted
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_map
The bug was fixed by:
1dbd195 (tracing: Fix preempt count leak)
Signed-off-by: Li Wang <liwang@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
This test was using sbrk() to position MAP_FIXED mappings, which
creates problems when something extends heap prior to test.
For example:
sbrk(0) is 0x13d8000
heap is extended in call to tst_tmpdir()
mkdir("/tmp/mmaXIz1uo", 0700) = 0
brk(0) = 0x13d8000
brk(0x13f9000) = 0x13f9000
brk(0) = 0x13f9000
test starts mapping/writing to areas it shouldn't:
mmap(0x13de000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED, 3, 0x8000) = 0x13de000
mmap(0x13e5000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED, 3, 0xa000) = 0x13e5000
mmap(0x13ea000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED, 3, 0xa000) = 0x13ea000
which results in crash:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7aa57a0 in __memset_sse2 () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-161.el7.x86_64
(gdb) bt
#0 0x00007ffff7aa57a0 in __memset_sse2 () from /lib64/libc.so.6
#1 0x00007ffff7a99ba2 in _int_malloc () from /lib64/libc.so.6
#2 0x00007ffff7a9bfbc in malloc () from /lib64/libc.so.6
#3 0x00007ffff7ad65c1 in __alloc_dir () from /lib64/libc.so.6
#4 0x00000000004031d8 in rmobj (obj=0x61e010 "/tmp/mmaLheQvJ", errmsg=errmsg@entry=0x7fffffffe0f8) at tst_tmpdir.c:145
#5 0x00000000004038cd in tst_rmdir () at tst_tmpdir.c:335
#6 0x0000000000402cf6 in main (argc=<optimized out>, argv=0x7fffffffe328) at mmapstress04.c:278
This patch rewrites test in newlib style. It also drops initial
offset parameter as it isn't used by any runtest. LARGE_FILE
ifdefs have been dropped as we can easily enable _64 build
if needed.
Mapping file as MAP_FIXED doesn't seem to be necessary, but I decided
to adhere to original.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Only newlib testcases support SAFE macros in cleanup(). When SAFE_UNLINK fails, it creates infinite loop between tst_brk_ and cleanup: #0 tst_res__ at tst_res.c:153 #1 0x0000000000407ba8 in tst_brk__ at tst_res.c:480 #2 0x00000000004081fe in tst_brkm_ at tst_res.c:577 #3 0x000000000040a7c9 in safe_unlink at safe_macros.c:358 #4 0x0000000000404abd in cleanup () at pipeio.c:497 #5 0x0000000000407bc7 in tst_brk__ at tst_res.c:498 #6 0x00000000004081fe in tst_brkm_ at tst_res.c:577 #7 0x000000000040c1d6 in def_handler at tst_sig.c:231 #8 <signal handler called> #9 0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #10 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90 #11 0x00000000004081af in tst_brkm_ at tst_res.c:581 #12 0x000000000040a7c9 in safe_unlink at safe_macros.c:358 #13 0x0000000000404abd in cleanup () at pipeio.c:497 #14 0x0000000000407bc7 in tst_brk__ at tst_res.c:498 #15 0x00000000004081fe in tst_brkm_ at tst_res.c:577 #16 0x000000000040c1d6 in def_handler at tst_sig.c:231 #17 <signal handler called> #18 0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #19 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90 #20 0x00000000004081af in tst_brkm_ at tst_res.c:581 #21 0x000000000040a7c9 in safe_unlink at safe_macros.c:358 #22 0x0000000000404abd in cleanup () at pipeio.c:497 ... Signed-off-by: Jan Stancek <jstancek@redhat.com>
Testcases which spawn children via clone(CLONE_VM) are prone to races in dynamic linker during symbol resolution. CLONE_VM is causing both parent and child process to share same TLS, which rarely leads to a crashes, for example: Program terminated with signal 4, Illegal instruction. [Switching to thread 1 (LWP 30351)] (gdb) bt #0 _dl_x86_64_restore_sse () at ../sysdeps/x86_64/dl-trampoline.S:389 #1 0x00007fefa1360625 in _dl_fixup (l=<optimized out>, reloc_arg=<optimized out>) at ../elf/dl-runtime.c:121 #2 0x00007fefa13670c0 in _dl_runtime_resolve () at ../sysdeps/x86_64/dl-trampoline.S:87 #3 0x0000000000402e4f in test_FILES () at clone02.c:332 #4 child_fn () at clone02.c:272 #5 0x00007fefa10887ad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113 [Switching to thread 2 (LWP 30350)] (gdb) bt #0 0x00007fefa104f1f2 in __libc_wait (stat_loc=stat_loc@entry=0x7ffe0edb537c) at ../sysdeps/unix/sysv/linux/wait.c:30 #1 0x000000000040294a in main (ac=<optimized out>, av=<optimized out>) at clone02.c:154 See also: http://www.mail-archive.com/utrace-devel@redhat.com/msg01944.html Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
…ume the thread has read the arg before you start creating the next thread.
…ume the thread has read the arg before you start creating the next thread. Signed-off-by: Sean MacLennan <smaclennan@diablo-technologies.com>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall
range and permissions were fixed with kernel commit 103efcd9aac1 ("fix
perms/range of vsyscall vma in /proc/*/maps"). While some newer systems
run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find
regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug
(fixed with b6558c4a2378 ("fix [vdso] page permissions") and
e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso
pages were not included in core dumps which caused incomplete
backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
linux-test-project#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
linux-test-project#2 0x0804845f in handle_alrm (signo=14) at small.c:9
linux-test-project#3 0x005f0420 in ?? ()
linux-test-project#4 0x0000000e in ?? ()
linux-test-project#5 0x00000033 in ?? ()
linux-test-project#6 0x00000000 in ?? ()
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall
range and permissions were fixed with kernel commit 103efcd9aac1 ("fix
perms/range of vsyscall vma in /proc/*/maps"). While some newer systems
run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find
regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug
(fixed with b6558c4a2378 ("fix [vdso] page permissions") and
e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso
pages were not included in core dumps which caused incomplete
backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
linux-test-project#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
linux-test-project#2 0x0804845f in handle_alrm (signo=14) at small.c:9
linux-test-project#3 0x005f0420 in ?? ()
linux-test-project#4 0x0000000e in ?? ()
linux-test-project#5 0x00000033 in ?? ()
linux-test-project#6 0x00000000 in ?? ()
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall
range and permissions were fixed with kernel commit 103efcd9aac1 ("fix
perms/range of vsyscall vma in /proc/*/maps"). While some newer systems
run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find
regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug
(fixed with b6558c4a2378 ("fix [vdso] page permissions") and
e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso
pages were not included in core dumps which caused incomplete
backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
linux-test-project#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
linux-test-project#2 0x0804845f in handle_alrm (signo=14) at small.c:9
linux-test-project#3 0x005f0420 in ?? ()
linux-test-project#4 0x0000000e in ?? ()
linux-test-project#5 0x00000033 in ?? ()
linux-test-project#6 0x00000000 in ?? ()
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall
range and permissions were fixed with kernel commit 103efcd9aac1 ("fix
perms/range of vsyscall vma in /proc/*/maps"). While some newer systems
run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find
regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug
(fixed with b6558c4a2378 ("fix [vdso] page permissions") and
e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso
pages were not included in core dumps which caused incomplete
backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
linux-test-project#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
linux-test-project#2 0x0804845f in handle_alrm (signo=14) at small.c:9
linux-test-project#3 0x005f0420 in ?? ()
linux-test-project#4 0x0000000e in ?? ()
linux-test-project#5 0x00000033 in ?? ()
linux-test-project#6 0x00000000 in ?? ()
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Test checks if vsyscall and vdso VMAs are reported correctly. vsyscall
range and permissions were fixed with kernel commit 103efcd9aac1 ("fix
perms/range of vsyscall vma in /proc/*/maps"). While some newer systems
run with CONFIG_LEGACY_VSYSCALL_NONE, this test may serve to find
regressions on systems still running with vsyscalls.
Second part of the test checks regression of vdso permissions bug
(fixed with b6558c4a2378 ("fix [vdso] page permissions") and
e5b97dde514f ("add VM_ALWAYSDUMP")). As a consequence of this bug, vdso
pages were not included in core dumps which caused incomplete
backtraces:
Program terminated with signal 11, Segmentation fault.
#0 0x005f0402 in ?? ()
Thread 1 (process 14859):
#0 0x005f0402 in ?? ()
#1 0x00336366 in ?? () from /lib/i686/nosegneg/libc.so.6
#2 0x0804845f in handle_alrm (signo=14) at small.c:9
#3 0x005f0420 in ?? ()
#4 0x0000000e in ?? ()
#5 0x00000033 in ?? ()
#6 0x00000000 in ?? ()
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Test started failing with recent glibc (glibc-2.34.9000-38.fc36), which detects that buffer in pread is potentially too small: tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s *** buffer overflow detected ***: terminated tst_test.c:1484: TBROK: Test killed by SIGIOT/SIGABRT! (gdb) bt #0 __pthread_kill_implementation at pthread_kill.c:44 #1 0x00007ffff7e46f73 in __pthread_kill_internal at pthread_kill.c:78 #2 0x00007ffff7df6a36 in __GI_raise at ../sysdeps/posix/raise.c:26 #3 0x00007ffff7de082f in __GI_abort () at abort.c:79 #4 0x00007ffff7e3b01e in __libc_message at ../sysdeps/posix/libc_fatal.c:155 #5 0x00007ffff7ed945a in __GI___fortify_fail at fortify_fail.c:26 #6 0x00007ffff7ed7dc6 in __GI___chk_fail () at chk_fail.c:28 #7 0x00007ffff7ed8214 in __pread_chk at pread_chk.c:26 #8 0x0000000000404d1a in pread at /usr/include/bits/unistd.h:74 #9 verify_pread (n=<optimized out>) at pread02.c:44 #10 0x000000000040dc19 in run_tests () at tst_test.c:1246 #11 testrun () at tst_test.c:1331 #12 fork_testrun () at tst_test.c:1462 #13 0x000000000040e9a1 in tst_run_tcases #14 0x0000000000404bde in main Extend it to number of bytes we are trying to read from fd. Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
The maximum field width of a string conversion does not include the
null byte. So we can overflow the buffer by one byte.
This can be triggered in ioctl_loop01 with -fsanitize=address even if
the file contents are far less than the buffer size:
tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
tst_device.c:93: TINFO: Found free device 1 '/dev/loop1'
ioctl_loop01.c:85: TPASS: /sys/block/loop1/loop/partscan = 0
ioctl_loop01.c:86: TPASS: /sys/block/loop1/loop/autoclear = 0
=================================================================
==293==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xf5c03420 at pc 0xf7952bf8 bp 0xff9cf9f8 sp 0xff9cf5d0
WRITE of size 1025 at 0xf5c03420 thread T0
#0 0xf7952bf7 (/lib/libasan.so.8+0x89bf7) (BuildId: f8d5331e88e5c1b8a8a55eda0a8e20503ea0d2b9)
#1 0xf7953879 in __isoc99_vfscanf (/lib/libasan.so.8+0x8a879) (BuildId: f8d5331e88e5c1b8a8a55eda0a8e20503ea0d2b9)
#2 0x8071f85 in safe_file_scanf /home/rich/qa/ltp/lib/safe_file_ops.c:139
#3 0x80552ea in tst_assert_str /home/rich/qa/ltp/lib/tst_assert.c:60
#4 0x804f17a in verify_ioctl_loop /home/rich/qa/ltp/testcases/kernel/syscalls/ioctl/ioctl_loop01.c:87
#5 0x8061599 in run_tests /home/rich/qa/ltp/lib/tst_test.c:1380
#6 0x8061599 in testrun /home/rich/qa/ltp/lib/tst_test.c:1463
#7 0x8061599 in fork_testrun /home/rich/qa/ltp/lib/tst_test.c:1592
#8 0x806877a in tst_run_tcases /home/rich/qa/ltp/lib/tst_test.c:1686
#9 0x804e01b in main ../../../../include/tst_test.h:394
#10 0xf7188294 in __libc_start_call_main (/lib/libc.so.6+0x23294) (BuildId: 87c7a50c8792985dd164f5af2d45b8e91d9f4391)
#11 0xf7188357 in __libc_start_main@@GLIBC_2.34 (/lib/libc.so.6+0x23357) (BuildId: 87c7a50c8792985dd164f5af2d45b8e91d9f4391)
#12 0x804e617 in _start ../sysdeps/i386/start.S:111
Address 0xf5c03420 is located in stack of thread T0 at offset 1056 in frame
#0 0x805525f in tst_assert_str /home/rich/qa/ltp/lib/tst_assert.c:57
This frame has 1 object(s):
[32, 1056) 'sys_val' (line 58) <== Memory access at offset 1056 overflows this variable
Fixes: f4919b1 ("lib: Add TST_ASSERT_FILE_INT and TST_ASSERT_FILE_STR")
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
On Intel sapphire rapids server, BIOS could allocate one memory block for CXL node when the server boot up, and this node "MemUsed" is 0 when CXL is not used like as follow: " cat /sys/devices/system/node/node2/meminfo Node 2 MemTotal: 4194304 kB Node 2 MemFree: 4194304 kB Node 2 MemUsed: 0 kB ... " And it caused get_mempolicy01/02 and set_mempolicy01/02/03/04 cases to fail like as follow sample: " tag=get_mempolicy01 stime=1683272855 cmdline="get_mempolicy01" contacts="" analysis=exit <<<test_output>>> incrementing stop tst_test.c:1560: TINFO: Timeout per run is 0h 00m 30s tst_numa.c:200: TINFO: Found 3 NUMA memory nodes tst_numa.c:165: TWARN: Failed to parse '/sys/devices/system/node/node2/meminfo' get_mempolicy01.c:188: TINFO: test #1: policy: MPOL_DEFAULT, no target get_mempolicy01.c:191: TPASS: policy: MPOL_DEFAULT, no target passed get_mempolicy01.c:188: TINFO: test #2: policy: MPOL_BIND get_mempolicy01.c:191: TPASS: policy: MPOL_BIND passed get_mempolicy01.c:188: TINFO: test #3: policy: MPOL_INTERLEAVE get_mempolicy01.c:191: TPASS: policy: MPOL_INTERLEAVE passed get_mempolicy01.c:188: TINFO: test #4: policy: MPOL_PREFERRED, no target get_mempolicy01.c:191: TPASS: policy: MPOL_PREFERRED, no target passed get_mempolicy01.c:188: TINFO: test #5: policy: MPOL_PREFERRED get_mempolicy01.c:191: TPASS: policy: MPOL_PREFERRED passed get_mempolicy01.c:188: TINFO: test #6: policy: MPOL_DEFAULT, flags: MPOL_F_ADDR, no target get_mempolicy01.c:191: TPASS: policy: MPOL_DEFAULT, flags: MPOL_F_ADDR, no target passed get_mempolicy01.c:188: TINFO: test #7: policy: MPOL_BIND, flags: MPOL_F_ADDR get_mempolicy01.c:191: TPASS: policy: MPOL_BIND, flags: MPOL_F_ADDR passed get_mempolicy01.c:188: TINFO: test #8: policy: MPOL_INTERLEAVE, flags: MPOL_F_ADDR get_mempolicy01.c:191: TPASS: policy: MPOL_INTERLEAVE, flags: MPOL_F_ADDR passed get_mempolicy01.c:188: TINFO: test #9: policy: MPOL_PREFERRED, flags: MPOL_F_ADDR, no target get_mempolicy01.c:191: TPASS: policy: MPOL_PREFERRED, flags: MPOL_F_ADDR, no target passed get_mempolicy01.c:188: TINFO: test #10: policy: MPOL_PREFERRED, flags: MPOL_F_ADDR get_mempolicy01.c:191: TPASS: policy: MPOL_PREFERRED, flags: MPOL_F_ADDR passed Summary: passed 10 failed 0 broken 0 skipped 0 warnings 1 ... -------- ------ ---------- get_mempolicy01 FAIL 4 " So fixed the fake failure when CXL node memory is not being used. Signed-off-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
The readahead time-consuming is quit depending on the platform IO speed, test get timeout once the default max_runtime is used up. readahead02.c:223: TINFO: Test #1: readahead on overlayfs file ... readahead02.c:286: TINFO: read_testfile(0) took: 63382903 usec readahead02.c:287: TINFO: read_testfile(1) took: 47943122 usec ... readahead02.c:312: TPASS: using cache as expected readahead02.c:223: TINFO: Test #2: POSIX_FADV_WILLNEED on file readahead02.c:128: TINFO: creating test file of size: 67108864 readahead02.c:241: TINFO: read_testfile(0) Test timeouted, sending SIGKILL! Let's raise the maximum runtime dynamically. Signed-off-by: Li Wang <liwang@redhat.com>
63e8c1e introduced a regression on 32 bit compilation when compiled with -fstack-protector-strong, because struct timespec is probably too small for timespec64. PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS="-m32 -fstack-protector-strong" LDFLAGS="-m32 -fstack-protector-strong" ./configure ... # gdb ./abort01 (gdb) set follow-fork-mode child (gdb) run Starting program: testcases/kernel/syscalls/abort/abort01 Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-2.31-150300.52.2.x86_64 tst_test.c:1690: TINFO: LTP version: 20230929-7-gff6cdc67f tst_test.c:1576: TINFO: Timeout per run is 0h 00m 30s [Attaching after process 3357 fork to child process 3360] [New inferior 2 (process 3360)] [Detaching after fork from parent process 3357] [Inferior 1 (process 3357) detached] *** stack smashing detected ***: terminated Thread 2.1 "abort01" received signal SIGABRT, Aborted. [Switching to process 3360] 0xf7fd2559 in __kernel_vsyscall () (gdb) bt #0 0xf7fd2559 in __kernel_vsyscall () linux-test-project#1 0xf7e08aa2 in raise () from /lib/libc.so.6 linux-test-project#2 0xf7e09efd in abort () from /lib/libc.so.6 linux-test-project#3 0xf7e4d91b in __libc_message () from /lib/libc.so.6 linux-test-project#4 0xf7eeb2cc in __fortify_fail () from /lib/libc.so.6 linux-test-project#5 0xf7eeb299 in __stack_chk_fail () from /lib/libc.so.6 linux-test-project#6 0x0805c501 in syscall_supported_by_kernel (sysnr=403) at tst_clocks.c:27 linux-test-project#7 0x0805c80d in tst_clock_gettime (clk_id=1, ts=0x807cfb0 <tst_start_time>) at tst_clocks.c:66 linux-test-project#8 0x080531df in heartbeat () at tst_test.c:1374 linux-test-project#9 0x08053ba2 in testrun () at tst_test.c:1458 linux-test-project#10 fork_testrun () at tst_test.c:1608 linux-test-project#11 0x08055afa in tst_run_tcases (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at tst_test.c:1704 linux-test-project#12 0x0804b3f0 in main (argc=1, argv=0xffffc414) at ../../../../include/tst_test.h:401 (gdb) Test timeouted, sending SIGKILL! Test timeouted, sending SIGKILL! Fixes: 63e8c1e ("tst_clocks: Fix unaddressable byte warning") Reported-by: Petr Cervinka <pcervinka@suse.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
63e8c1e introduced a regression on 32 bit compilation when compiled with -fstack-protector-strong, because struct timespec is probably too small for timespec64. PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS="-m32 -fstack-protector-strong" LDFLAGS="-m32 -fstack-protector-strong" ./configure ... # gdb ./abort01 (gdb) set follow-fork-mode child (gdb) run Starting program: testcases/kernel/syscalls/abort/abort01 Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-2.31-150300.52.2.x86_64 tst_test.c:1690: TINFO: LTP version: 20230929-7-gff6cdc67f tst_test.c:1576: TINFO: Timeout per run is 0h 00m 30s [Attaching after process 3357 fork to child process 3360] [New inferior 2 (process 3360)] [Detaching after fork from parent process 3357] [Inferior 1 (process 3357) detached] *** stack smashing detected ***: terminated Thread 2.1 "abort01" received signal SIGABRT, Aborted. [Switching to process 3360] 0xf7fd2559 in __kernel_vsyscall () (gdb) bt #0 0xf7fd2559 in __kernel_vsyscall () linux-test-project#1 0xf7e08aa2 in raise () from /lib/libc.so.6 linux-test-project#2 0xf7e09efd in abort () from /lib/libc.so.6 linux-test-project#3 0xf7e4d91b in __libc_message () from /lib/libc.so.6 linux-test-project#4 0xf7eeb2cc in __fortify_fail () from /lib/libc.so.6 linux-test-project#5 0xf7eeb299 in __stack_chk_fail () from /lib/libc.so.6 linux-test-project#6 0x0805c501 in syscall_supported_by_kernel (sysnr=403) at tst_clocks.c:27 linux-test-project#7 0x0805c80d in tst_clock_gettime (clk_id=1, ts=0x807cfb0 <tst_start_time>) at tst_clocks.c:66 linux-test-project#8 0x080531df in heartbeat () at tst_test.c:1374 linux-test-project#9 0x08053ba2 in testrun () at tst_test.c:1458 linux-test-project#10 fork_testrun () at tst_test.c:1608 linux-test-project#11 0x08055afa in tst_run_tcases (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at tst_test.c:1704 linux-test-project#12 0x0804b3f0 in main (argc=1, argv=0xffffc414) at ../../../../include/tst_test.h:401 (gdb) Test timeouted, sending SIGKILL! Test timeouted, sending SIGKILL! Fixes: 63e8c1e ("tst_clocks: Fix unaddressable byte warning") Link: https://lore.kernel.org/ltp/20231012091546.607702-1-pvorel@suse.cz/ Reported-by: Petr Cervinka <pcervinka@suse.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
63e8c1e introduced a regression on 32 bit compilation when compiled with -fstack-protector-strong, because struct timespec is probably too small for timespec64. PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS="-m32 -fstack-protector-strong" LDFLAGS="-m32 -fstack-protector-strong" ./configure ... # gdb ./abort01 (gdb) set follow-fork-mode child (gdb) run Starting program: testcases/kernel/syscalls/abort/abort01 Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-2.31-150300.52.2.x86_64 tst_test.c:1690: TINFO: LTP version: 20230929-7-gff6cdc67f tst_test.c:1576: TINFO: Timeout per run is 0h 00m 30s [Attaching after process 3357 fork to child process 3360] [New inferior 2 (process 3360)] [Detaching after fork from parent process 3357] [Inferior 1 (process 3357) detached] *** stack smashing detected ***: terminated Thread 2.1 "abort01" received signal SIGABRT, Aborted. [Switching to process 3360] 0xf7fd2559 in __kernel_vsyscall () (gdb) bt #0 0xf7fd2559 in __kernel_vsyscall () #1 0xf7e08aa2 in raise () from /lib/libc.so.6 #2 0xf7e09efd in abort () from /lib/libc.so.6 #3 0xf7e4d91b in __libc_message () from /lib/libc.so.6 #4 0xf7eeb2cc in __fortify_fail () from /lib/libc.so.6 #5 0xf7eeb299 in __stack_chk_fail () from /lib/libc.so.6 #6 0x0805c501 in syscall_supported_by_kernel (sysnr=403) at tst_clocks.c:27 #7 0x0805c80d in tst_clock_gettime (clk_id=1, ts=0x807cfb0 <tst_start_time>) at tst_clocks.c:66 #8 0x080531df in heartbeat () at tst_test.c:1374 #9 0x08053ba2 in testrun () at tst_test.c:1458 #10 fork_testrun () at tst_test.c:1608 #11 0x08055afa in tst_run_tcases (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at tst_test.c:1704 #12 0x0804b3f0 in main (argc=1, argv=0xffffc414) at ../../../../include/tst_test.h:401 (gdb) Test timeouted, sending SIGKILL! Test timeouted, sending SIGKILL! Fixes: 63e8c1e ("tst_clocks: Fix unaddressable byte warning") Reported-by: Petr Cervinka <pcervinka@suse.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Marius Kittler <mkittler@suse.de> Signed-off-by: Petr Vorel <pvorel@suse.cz>
And skip EFAULT for glibc as it can segfault in VDSO: #0 __arch_chacha20_blocks_nostack () at arch/x86/entry/vdso/vgetrandom-chacha.S:146 146 movups state0,0x00(output) (gdb) bt #0 __arch_chacha20_blocks_nostack () at arch/x86/entry/vdso/vgetrandom-chacha.S:146 #1 0x00007fcd3ce6417a in __cvdso_getrandom_data (rng_info=0x7fcd3ce5f280, buffer=0xffffffffffffffff, len=64, flags=1, opaque_state=0x7fcd3ce5df00, opaque_len=<optimized out>) at arch/x86/entry/vdso/../../../../lib/vdso/getrandom.c:237 #2 __cvdso_getrandom (buffer=<optimized out>, len=64, flags=1, opaque_state=0x7fcd3ce5df00, opaque_len=<optimized out>) at arch/x86/entry/vdso/../../../../lib/vdso/getrandom.c:259 #3 __vdso_getrandom (buffer=0xffffffffffffffff, len=64, flags=1, opaque_state=0x7fcd3ce5df00, opaque_len=<optimized out>) at arch/x86/entry/vdso/vgetrandom.c:11 #4 0x00007fcd3cc7faf3 in getrandom_vdso (buffer=0xffffffffffffffff, length=64, flags=0, cancel=<optimized out>) at ../sysdeps/unix/sysv/linux/getrandom.c:204 #5 0x0000000000401ff7 in verify_getrandom (i=0) at getrandom05.c:40 Signed-off-by: Jan Stancek <jstancek@redhat.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com>
./nfs10.sh -v 3 -t udp nfs10 1 TINFO: Running: nfs10.devel.sh -v 3 -t udp nfs10 1 TINFO: Tested kernel: Linux ts 6.13.0-rc1-1.g492f944-default linux-test-project#1 SMP PREEMPT_DYNAMIC Mon Dec 2 08:55:00 UTC 2024 (492f944) x86_64 x86_64 x86_64 GNU/Linux nfs10 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface nfs10 1 TINFO: add local addr 10.0.0.2/24 nfs10 1 TINFO: add local addr fd00:1:1:1::2/64 nfs10 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface nfs10 1 TINFO: add remote addr 10.0.0.1/24 nfs10 1 TINFO: add remote addr fd00:1:1:1::1/64 nfs10 1 TINFO: Network config (local -- remote): nfs10 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 nfs10 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 nfs10 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 nfs10 1 TINFO: Using /tmp/LTP_nfs10.fMhZnmFim0 as tmpdir (tmpfs filesystem) tst_device.c:299: TWARN: Failed to create test_dev.img: ENOSPC (28) Usage: tst_device acquire [size [filename]] tst_device release /path/to/device tst_device clear /path/to/device nfs10 1 TWARN: Failed to acquire device => This should be TBROK, but it wasn't due TST_CLEANUP being defined in tst_brk() (any test with TST_CLEANUP=1 did not exit when tst_brk TBROK was called from tst_test.sh due failure in early phase). Fixing it by splitting $TST_DO_CLEANUP variable into two functions: * $TST_DO_CLEANUP is a guarder for running cleanup function only once (similar to $TST_DO_EXIT). * Introduce new variable $TST_TEST_STARTED to indicate that test was started. Previously $TST_DO_CLEANUP was misused for this because the name suggests it (regression in 5c36ae3). Also print TWARN when cleanup function is not found due '. tst_test.sh' (or other shell library which loads it) is not at the end of the test (before tst_run). After 0402163 all tests load library late enough, but it's better to keep this check. Fixes: 5c36ae3 ("tst_test.sh: Call cleanup function only after test start") Signed-off-by: Petr Vorel <pvorel@suse.cz>
./nfs10.sh -v 3 -t udp nfs10 1 TINFO: Running: nfs10.devel.sh -v 3 -t udp nfs10 1 TINFO: Tested kernel: Linux ts 6.13.0-rc1-1.g492f944-default linux-test-project#1 SMP PREEMPT_DYNAMIC Mon Dec 2 08:55:00 UTC 2024 (492f944) x86_64 x86_64 x86_64 GNU/Linux nfs10 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface nfs10 1 TINFO: add local addr 10.0.0.2/24 nfs10 1 TINFO: add local addr fd00:1:1:1::2/64 nfs10 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface nfs10 1 TINFO: add remote addr 10.0.0.1/24 nfs10 1 TINFO: add remote addr fd00:1:1:1::1/64 nfs10 1 TINFO: Network config (local -- remote): nfs10 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 nfs10 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 nfs10 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 nfs10 1 TINFO: Using /tmp/LTP_nfs10.fMhZnmFim0 as tmpdir (tmpfs filesystem) tst_device.c:299: TWARN: Failed to create test_dev.img: ENOSPC (28) Usage: tst_device acquire [size [filename]] tst_device release /path/to/device tst_device clear /path/to/device nfs10 1 TWARN: Failed to acquire device => This should be TBROK, but it wasn't due TST_CLEANUP being defined in tst_brk() (any test with TST_CLEANUP=1 did not exit when tst_brk TBROK was called from tst_test.sh due failure in early phase). Fixing it by splitting $TST_DO_CLEANUP variable into two functions: * $TST_DO_CLEANUP is a guarder for running cleanup function only once (similar to $TST_DO_EXIT). * Introduce new variable $TST_TEST_STARTED to indicate that test was started. Previously $TST_DO_CLEANUP was misused for this because the name suggests it (regression in 5c36ae3). Also print TWARN when cleanup function is not found due '. tst_test.sh' (or other shell library which loads it) is not at the end of the test (before tst_run). After 0402163 all tests load library late enough, but it's better to keep this check. Fixes: 5c36ae3 ("tst_test.sh: Call cleanup function only after test start") Signed-off-by: Petr Vorel <pvorel@suse.cz>
Evaluation "-gt 0" needs to be together with expectation of empty
$expected_violations. Therefore use [ ... -a ... ] comparator to avoid
-eq comparison against empty $expected_violations.
# LTPROOT=/opt/ltp PATH="/opt/ltp/testcases/bin:$PATH" LTP_IMA_LOAD_POLICY=1 ima_keys.sh
ima_keys 1 TINFO: /proc/cmdline: BOOT_IMAGE=/boot/vmlinuz-6.14.0-rc3-1.gb6b4102-default security=apparmor ignore_loglevel ima_policy=tcb
# LTPROOT=/opt/ltp PATH="/opt/ltp/testcases/bin:$PATH" ima_violations.sh
...
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 1 TFAIL: open_writers violation not added
ima_violations 2 TINFO: verify ToMToU violation
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 2 TFAIL: ToMToU violation not added
ima_violations 3 TINFO: verify open_writers using mmapped files
tst_test.c:1900: TINFO: LTP version: 20250130-22-gcd2215702f
tst_test.c:1904: TINFO: Tested kernel: 6.14.0-rc3-1.gb6b4102-default linux-test-project#1 SMP PREEMPT_DYNAMIC Thu Feb 20 12:26:55 UTC 2025 (b6b4102) x86_64
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_kconfig.c:676: TINFO: CONFIG_FAULT_INJECTION kernel option detected which might slow the execution
tst_test.c:1722: TINFO: Overall timeout per run is 0h 02m 00s
ima_mmap.c:38: TINFO: sleep 3s
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 3 TFAIL: open_writers violation not added
NOTE: This does not fix ima_violations.sh fails after caused by user
defined policy loaded by ima_keys.sh (via LTP_IMA_LOAD_POLICY=1).
Fixes: 726ed71 ("ima_violations.sh: Update validate() to support multiple violations")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Evaluation "-gt 0" needs to be together with expectation of empty
$expected_violations. Therefore use [ ... -a ... ] comparator to avoid
-eq comparison against empty $expected_violations.
# LTPROOT=/opt/ltp PATH="/opt/ltp/testcases/bin:$PATH" LTP_IMA_LOAD_POLICY=1 ima_keys.sh
ima_keys 1 TINFO: /proc/cmdline: BOOT_IMAGE=/boot/vmlinuz-6.14.0-rc3-1.gb6b4102-default security=apparmor ignore_loglevel ima_policy=tcb
# LTPROOT=/opt/ltp PATH="/opt/ltp/testcases/bin:$PATH" ima_violations.sh
...
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 1 TFAIL: open_writers violation not added
ima_violations 2 TINFO: verify ToMToU violation
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 2 TFAIL: ToMToU violation not added
ima_violations 3 TINFO: verify open_writers using mmapped files
tst_test.c:1900: TINFO: LTP version: 20250130-22-gcd2215702f
tst_test.c:1904: TINFO: Tested kernel: 6.14.0-rc3-1.gb6b4102-default #1 SMP PREEMPT_DYNAMIC Thu Feb 20 12:26:55 UTC 2025 (b6b4102) x86_64
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_kconfig.c:676: TINFO: CONFIG_FAULT_INJECTION kernel option detected which might slow the execution
tst_test.c:1722: TINFO: Overall timeout per run is 0h 02m 00s
ima_mmap.c:38: TINFO: sleep 3s
/opt/ltp/testcases/bin/ima_violations.sh: line 95: [: 0: unary operator expected
ima_violations 3 TFAIL: open_writers violation not added
NOTE: This does not fix ima_violations.sh fails after caused by user
defined policy loaded by ima_keys.sh (via LTP_IMA_LOAD_POLICY=1).
Link: https://lore.kernel.org/ltp/20250314124242.459072-1-pvorel@suse.cz/
Fixes: 726ed71 ("ima_violations.sh: Update validate() to support multiple violations")
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Before this patch: ./hugemmap15 tst_test.c:1137: TCONF: Signal handler for this architecture hasn't been written After this patch: ./hugemmap15 tst_hugepage.c:84: TINFO: 3 hugepage(s) reserved tst_tmpdir.c:316: TINFO: Using /tmp/LTP_hug7F2RcZ as tmpdir (tmpfs filesystem) tst_test.c:1097: TINFO: Mounting none to /tmp/LTP_hug7F2RcZ/hugetlbfs fstyp=hugetlbfs flags=0 tst_test.c:1900: TINFO: LTP version: 20250130-164-gae2792765 tst_test.c:1904: TINFO: Tested kernel: 6.6.0-27.0.v2503.ky11.loongarch64 linux-test-project#1 SMP Mon Mar 10 13:32:48 UTC 2025 loongarch64 tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s hugemmap15.c:104: TINFO: SIGILL at 0x7fffedffff80 (sig_expected=0x7fffedffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe9ffff80 (sig_expected=0x7fffe9ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe5ffff80 (sig_expected=0x7fffe5ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe1ffff80 (sig_expected=0x7fffe1ffff80) ...... hugemmap15.c:104: TINFO: SIGILL at 0x7ffef1ffff80 (sig_expected=0x7ffef1ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7ffef1ffff80 (sig_expected=0x7ffef1ffff80) hugemmap15.c:221: TPASS: Successfully tested dcache to icache flush Summary: passed 1 failed 0 broken 0 skipped 0 warnings 0 Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>
Before this patch: ./hugemmap15 tst_test.c:1137: TCONF: Signal handler for this architecture hasn't been written After this patch: ./hugemmap15 tst_hugepage.c:84: TINFO: 3 hugepage(s) reserved tst_tmpdir.c:316: TINFO: Using /tmp/LTP_hug7F2RcZ as tmpdir (tmpfs filesystem) tst_test.c:1097: TINFO: Mounting none to /tmp/LTP_hug7F2RcZ/hugetlbfs fstyp=hugetlbfs flags=0 tst_test.c:1900: TINFO: LTP version: 20250130-164-gae2792765 tst_test.c:1904: TINFO: Tested kernel: 6.6.0-27.0.v2503.ky11.loongarch64 #1 SMP Mon Mar 10 13:32:48 UTC 2025 loongarch64 tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s hugemmap15.c:104: TINFO: SIGILL at 0x7fffedffff80 (sig_expected=0x7fffedffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe9ffff80 (sig_expected=0x7fffe9ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe5ffff80 (sig_expected=0x7fffe5ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7fffe1ffff80 (sig_expected=0x7fffe1ffff80) ... hugemmap15.c:104: TINFO: SIGILL at 0x7ffef1ffff80 (sig_expected=0x7ffef1ffff80) hugemmap15.c:104: TINFO: SIGILL at 0x7ffef1ffff80 (sig_expected=0x7ffef1ffff80) hugemmap15.c:221: TPASS: Successfully tested dcache to icache flush Signed-off-by: wangxuewen <wangxuewen@kylinos.cn> Reviewed-by: Li Wang <liwang@redhat.com>
"dmem" cgroup controller [1] was added in 6.14 [2]. Add it to fix cgroup_regression_test.sh: cgroup_regression_test 1 TINFO: Tested kernel: Linux susetest 6.14.0-1-default linux-test-project#1 SMP PREEMPT_DYNAMIC Tue Mar 25 06:23:18 UTC 2025 (ab99d4c) x86_64 x86_64 x86_64 GNU/Linux ... cgroup_regression_test 7 TBROK: 'tst_cgctl require' exited New cgroup should be v2 only. [1] https://docs.kernel.org/next/admin-guide/cgroup-v2.html#dmem [2] https://kernelnewbies.org/Linux_6.14#dmem_cgroup_for_better_control_of_GPU_memory_resources Reported-by: Avinesh Kumar <akumar@suse.de> Signed-off-by: Petr Vorel <pvorel@suse.cz>
"dmem" cgroup controller [1] was added in 6.14 [2]. Add it to fix cgroup_regression_test.sh: cgroup_regression_test 1 TINFO: Tested kernel: Linux susetest 6.14.0-1-default linux-test-project#1 SMP PREEMPT_DYNAMIC Tue Mar 25 06:23:18 UTC 2025 (ab99d4c) x86_64 x86_64 x86_64 GNU/Linux ... cgroup_regression_test 7 TBROK: 'tst_cgctl require' exited New cgroup should be v2 only. [1] https://docs.kernel.org/next/admin-guide/cgroup-v2.html#dmem [2] https://kernelnewbies.org/Linux_6.14#dmem_cgroup_for_better_control_of_GPU_memory_resources Reported-by: Avinesh Kumar <akumar@suse.de> Signed-off-by: Petr Vorel <pvorel@suse.cz>
"dmem" cgroup controller [1] was added in 6.14 [2]. Add it to fix cgroup_regression_test.sh: cgroup_regression_test 1 TINFO: Tested kernel: Linux susetest 6.14.0-1-default linux-test-project#1 SMP PREEMPT_DYNAMIC Tue Mar 25 06:23:18 UTC 2025 (ab99d4c) x86_64 x86_64 x86_64 GNU/Linux ... cgroup_regression_test 7 TBROK: 'tst_cgctl require' exited New cgroup should be v2 only. [1] https://docs.kernel.org/next/admin-guide/cgroup-v2.html#dmem [2] https://kernelnewbies.org/Linux_6.14#dmem_cgroup_for_better_control_of_GPU_memory_resources Reported-by: Avinesh Kumar <akumar@suse.de> Signed-off-by: Petr Vorel <pvorel@suse.cz>
The dirtyc0w_shmem test spawns a child process using execlp. This child process then calls tst_brk(), which exits early with a non-zero status because execlp does not inherit the parent's lib_pid variable. Consequently, the parent process incorrectly reports an "Invalid child exit value". This commit addresses this by ensuring the child process has access to the necessary lib_pid and main_pid by passing them through a shared results structure. This prevents the premature exit in the child and the subsequent error report in the parent. Related commit: a1f8270 ("lib/tst_test.c: Fix tst_brk() handling") Detail failure log: tst_tmpdir.c:317: TINFO: Using /tmp/LTP_dirSOGVBC as tmpdir (btrfs filesystem) tst_test.c:1938: TINFO: LTP version: 20250507.4a0e3a8fa tst_test.c:1942: TINFO: Tested kernel: 6.4.0-150700.51-default #1 SMP Wed Apr 30 21:35:43 UTC 2025 (6930611) s390x tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz' tst_kconfig.c:678: TINFO: CONFIG_FAULT_INJECTION kernel option detected which might slow the execution tst_test.c:1760: TINFO: Overall timeout per run is 0h 04m 00s dirtyc0w_shmem.c:54: TINFO: Mounting tmp_dirtyc0w_shmem to /tmp/LTP_dirSOGVBC/tmp_dirtyc0w_shmem fstyp=tmpfs flags=0 dirtyc0w_shmem_child.c:160: TCONF: System does not have userfaultfd minor fault support for shmem <<<<<<<<<< 1 tst_test.c:481: TBROK: Invalid child (8163) exit value 32 <<<<<<<< 2 dirtyc0w_shmem.c:102: TINFO: Umounting /tmp/LTP_dirSOGVBC/tmp_dirtyc0w_shmem tmp_dirtyc0w_shmem.c call execlp to create new process run dirtyc0w_shmem_child bin. SAFE_EXECLP("dirtyc0w_shmem_child", "dirtyc0w_shmem_child", NULL) Within dirtyc0w_shmem_child.c trigger tst_brk(TCONF, "System does not have userfaultfd minor fault support for shmem") Since execlp does not inherit the parent process's variables lib_pid, so it will return TCONF(32) directly. void tst_vbrk_(const char *file, const int lineno, int ttype, const char *fmt, va_list va) { ... if (!lib_pid) exit(TTYPE_RESULT(ttype)); <<<<< ... } So finally captured by check_child_status report an error. static void check_child_status(pid_t pid, int status) { ... if (WEXITSTATUS(status)) tst_brk(TBROK, "Invalid child (%i) exit value %i", pid, WEXITSTATUS(status)); <<<< } Signed-off-by: Wei Gao <wegao@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Li Wang <liwang@redhat.com>
Set hugeshmctl02 to require exactly 2 HugeTLB pages and bail out cleanly if unavailable. To prevent shmget EINVAL failures seen when the environment cannot provide enough hugepages. Stabilizes the test across constrained systems while keeping functional intent intact. === error log === cmdline="hugeshmctl02 -s 1 -i 5;" tst_hugepage.c:84: TINFO: 1 hugepage(s) reserved tst_test.c:1709: TINFO: LTP version: 20240129 tst_test.c:1595: TINFO: Timeout per run is 0h 00m 30s hugeshmctl02.c:105: TINFO: Testing variant: libc shmctl() hugeshmctl02.c:119: TBROK: shmget #1: EINVAL (22) Signed-off-by: Li Wang <liwang@redhat.com> Cc: Luiz Capitulino <luizcap@redhat.com> Reviewed-by: Petr Vorel <pvorel@suse.cz>
These two patches are scripted cleanups of the LTP sources
The first ensures that all text files end with a newline
The second removes trailing whiitespace from test6files