SUMMARY on yocto/oe-core qemux86-64 glibc 3.17.0 release: swapcontext.c fails because the threads were killed inside of nanosleep STEPS TO REPRODUCE OBSERVED RESULT ``` runqemu kvm valgrind --tool=drd --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2 ./swapcontext ==277== drd, a thread error detector ==277== Copyright (C) 2006-2020, and GNU GPL'd, by Bart Van Assche. ==277== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info ==277== Command: ./swapcontext ==277== ==277== ==277== Process terminating with default action of signal 14 (SIGALRM) ==277== at 0x36C74C3943: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:43) ==277== by 0x36C74C8726: nanosleep (nanosleep.c:25) ==277== ==277== For lists of detected and suppressed errors, rerun with: -s ==277== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 26 from 2) Alarm clock ``` EXPECTED RESULT i think the test should pass because it generated 0 error. the nanosleep is called inside of f
If i remove the nanosleep statement, inside of `f` the original bug report 432381 's error message appears drd: drd_main.c:378 (drd_stop_using_mem): Assertion 'a1 <= a2' failed
What is the purpose of nanosleep, can it be safely removed? Is there a filter to allow both scenario (stopped in f and stopped in nanosleep) to be correct?
Created attachment 137186 [details] proposed patch revert commit 719d23b7a9c3b02411dee7d5d4d3744938bb768c
I do know that the commit I reverted mentioned portability. Do you know which platform has problems with timerfd?
Reverting commit 719d23b7a9c3 ("drd/tests/swapcontext: Improve portability") is not an option. Valgrind source code must build and run on all supported operating systems. Not all supported operating systems support poll().
(In reply to Bart Van Assche from comment #5) > Reverting commit 719d23b7a9c3 ("drd/tests/swapcontext: Improve portability") > is not an option. Valgrind source code must build and run on all supported > operating systems. Not all supported operating systems support poll(). seems like Mac doesn't support poll, maybe select would be a better choice? I tested the "proposed patch" and test passes. any advice to solve this issue?
maybe the root cause is just the stderr.exp being to sensitive...
Please provide a .stderr.exp file that makes the test pass on your test setup.
stderr.exp that would pass the test. ``` Process terminating with default action of signal 14 (SIGALRM) at 0x........: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:?) by 0x........: nanosleep (nanosleep.c:?) ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ```
Created attachment 137357 [details] proposed patch v2 basically to avoid printing the stacktrace with a handled signal.
"Patch v2" has been applied on the master branch. Thanks for the patch!
thanks! passes on yocto ptest
https://sourceware.org/git/?p=valgrind.git;a=commit;h=4c8c4a9c3a92300e3e6500e5a278ca37514a1fdb