-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Memory allocated by ASAN is freed by glibc #763
Comments
GCC uses dynamic asan library by default, and this is more prone to problems like this. |
@dang if this is GCC-specific I'd be curious to see symbolized backtraces. |
Okay, I've done some testing, and it still happens with -static-libasan and with clang. Clang version is 3.8.1-1.fc24. Below is my backtrace. I'm going to try again on a fedora 25 box (so newer everything) and see if it hits there. #0 0x00007ffff526a765 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 |
Could you share the code of gsh_free function? Does it call free regularly, or maybe through pointer? |
https://github.com/dang/nfs-ganesha/blob/FSAL_MEM/src/include/abstract_mem.h#L271 So it just prints and calls free() |
Is the failing library dlopened in https://github.com/dang/nfs-ganesha/blob/FSAL_MEM/src/FSAL/fsal_manager.c#L230 ? I think we had problems with RTLD_DEEPBIND in the past (see #611) but I'm not sure about the reasons. |
Yes, the failed lib is dlopened. Each FSAL is dlopened when it's needed. However, I run with FSAL_VFS (the FSAL that uses a local filesystem, which is also dlopened) with ASAN all the time, and have not seen this issue with it. That said, issue #611 appears to be my exact issue. I'll try without DEEPBIND and report back. |
Perhaps because GCC does not add DT_NEEDED for libasan to shared libraries? Thus RTLD searches in Glibc first and uses __libc_free. |
Yep, that did it. I'll modify our build to disable DEEPBIND when using ASAN. Is this something that is likely to get fixed in the future? |
I think we should, people keep hitting this again and again. |
@dang Could you resolve this as dup? |
Sure. |
Duplicate of #166 |
I think you mean #611 |
Yes, sorry, #611 |
I have a case where memory allocated by ASAN (verified by stepping through in the debugger) is freed by glibc (again, verified by stepping through in the debugger). This trips glibc's invalid pointer check in munmap_chunk(), causing the program to abort. It seems similar to issue #70 but is on Fedora 24, not on OSX. What can I do to debug and (hopefully) fix this, as it's blocking my continued use of ASAN.
I have:
Fedora 24
gcc: 6.3.1-1.fc24
glibc: 2.23.1-11.fc24
libasan: 6.3.1-1.fc24
The code in question is OSS (it's in-progress work for nfs-ganesha) but not posted anywhere yet. This code runs correctly under valgrind. It's built with -O0 -g -gdwarf-2 -fsanitize=address -fno-omit-frame-pointer Note that other branches of nfs-ganesha run fine with ASAN, so something is different.
The text was updated successfully, but these errors were encountered: