[libc-commits] [PATCH] D75380: [libc] Add linux implementations of thrd_create and thrd_join functions.
Alex Brachet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Mar 3 00:49:22 PST 2020
abrachet accepted this revision.
abrachet added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: libc/src/threads/linux/thrd_create.cpp:27
+
+static void start_thread(thrd_t *thread, thrd_start_t func, void *arg) {
+ __llvm_libc::syscall(SYS_exit, thread->__retval = func(arg));
----------------
sivachandra wrote:
> abrachet wrote:
> > sivachandra wrote:
> > > abrachet wrote:
> > > > Make this `[[noreturn]]`
> > > Sanitizers blow up at this point. I do not understand sanitizers enough yet to explain why. I will be sharing a more holistic treatment of sanitizers in LLVM-libc soon so I will try to include talking about this there.
> > >
> > > FWIW, I have shared this problem with the sanitizer experts I have access to and they are investigating.
> > I have tried this and it is failing for me too, on a clang and compiler-rt built a few days ago. If I had to take a guess, and it really is just that, I've gone through it with lldb a couple of times and played around a bit, is that we aren't setting up tls right now which is messing with asan when it calls `__asan_handle_no_return`. If you try this with `pthread_create` or `std::thread` it works fine. If you make `start_thread` and `thrd_create` `__attribute__((no_sanitize("undefined"), no_sanitize("address"))` it also obviously stops the crashes.
> >
> > I tried making the function we pass to `thrd_create` make calls to asan by making memory reads (`__asan_report_store`) etc, it doesn't crash but perhaps future tests might.
> Yes, TLS was the first suspect. However, if I add a dummy TLS, I still see the problem. More strangely though, on a sanitizer team member's machine, the test just passes as is. This makes me feel the problem is something which I do not understand fully yet. I do not think it should block us though.
> I do not think it should block us though.
Agreed. If there is a problem it will present itself later and right now it isn't clear that there is a problem at all.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75380/new/
https://reviews.llvm.org/D75380
More information about the libc-commits
mailing list