While testing arm64 Linuxulator's signal trampoline code I found glibc test which fails on native FreeBSD arm64 (sporadically hangs), but pass on amd64. Seems to me a some CAS problem. Unfortunately, I'm not familiar with arm architecture. Test, adopted to the FreeBSD here: https://people.freebsd.org/~dchagin/tst-cond25.c Btw, I tested it under qemu on mac os m1, maybe problem is here?
@dmitry Can you attach the test case here. Also, is it possible to add a failing test to FreeBSD CI?
Created attachment 233787 [details] test Attached, however, as I pointed out earlier, this is a native FreeBSD Aarch64 port bug, not an Linuxulator's bug.
I can confirm this running native stable/13 on Ampere eMAG and current on Cortex A-57. The program sometimes hangs. Running in a debugger I get occasional addressing errors (segfault or bad address). I think the errors are caused by a bad interaction between lldb and system calls. Conceivably it is a scheduling problem that only shows up with a debugger.
https://reviews.freebsd.org/D35150 fixes this for me.
(In reply to Andrew Turner from comment #4) seems to me yes, thank you
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=11a6ecd4258b9108fb19420ec5db297f6d99a842 commit 11a6ecd4258b9108fb19420ec5db297f6d99a842 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-05-09 14:28:56 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2022-05-19 10:30:21 +0000 Handle cas failure when the compare succeeds When locking a priority inherit mutex we perform a compare and swap operation to try and acquire the mutex. This may fail even when the compare succeeds. Check and handle this case. PR: 263825 Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35150 sys/kern/kern_umtx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3f10d87df48a49136ea9ceefbe8171f24546f27c commit 3f10d87df48a49136ea9ceefbe8171f24546f27c Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-05-09 14:28:56 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2022-06-07 14:20:18 +0000 Handle cas failure when the compare succeeds When locking a priority inherit mutex we perform a compare and swap operation to try and acquire the mutex. This may fail even when the compare succeeds. Check and handle this case. PR: 263825 Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35150 (cherry picked from commit 11a6ecd4258b9108fb19420ec5db297f6d99a842) sys/kern/kern_umtx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
thank you!