-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
msan false positive on FreeBSD in isprint() after setlocale() #65532
Comments
Did you recompile libc with MSan enabled? |
No, I assumed the interceptors would be enough. Typically msan need everything except libc to be instrumented. |
Unrelated to this issue, I read this patch and use the following command to build again in freebsd-src
However, it shows this error when building libc:
I want to ask if I miss some compilation argument to build the world with sanitizer support? |
When I am building the world, I suffer from the following error:
I think hexdump is not the libc function thus it would't disable asan in the build-tool stage then finally cause this error. I try to build mpsutil manually without asan, however, there are more libraries define their own hexdump and cause same error. Thus I think it is not a good workaround. Currently, I don't have any idea now, maybe we should erase hexdump interception in asan? |
I discover that hexdump is a library call on FreeBSD. So it will be hooked by msan. I don't know if there is any solution for this. Does @emaste have any idea if we want to fix this error? |
I defer to @markjdb or @DimitryAndric |
This has been fixed in that LLVM no longer intercepts hexdump(). It didn't really make sense. I've been doing a bit of work with MSan and it has a lot of problems with false positives. For instance, getc() isn't intercepted for some reason. Nor is cgetent(), used by ncurses. If I don't instrument libc, then the interceptors cause problems. Consider fts_sort() in libc. It may reallocate an array (realloc is hooked by MSan), then populates the array, then sorts it with qsort (also hooked by MSan). MSan of course doesn't see that the array is initialized and raises a false positive. I tried instrumenting libc with MSan, and that's a can of worms as well since it and libthr run a number of initializers before __msan_init() is called. Inline accesses to the shadow map triggers SIGSEGV and I don't see an LLVM option to disable that. I've tried selectively disabling instrumentation of certain libc and libthr files (e.g., we can't instrument getenv() or sysconf()), but it's fragile and tedious, and I haven't gotten it to work so far. Maybe MSan exposes a hook that would let libc map the shadow regions very early on, but I don't think so. |
The following program:
when compiled with
clang16 -fsanitize=memory
on FreeBSD:crashes with a use-of-uninitialized-value error that (I hope) is wrong:
The text was updated successfully, but these errors were encountered: