Skip to content
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

ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. #796

Closed
yogurfrul opened this issue Apr 8, 2017 · 25 comments

Comments

@yogurfrul
Copy link

I work ASAN with GCC6.3, for later libFuzzer test.
But I got error as :
==48458==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

I can fix it by export LD_PRELOAD=/path/libasan.so.3
But I still confused,my code is ok with GCC4.9 and ASAN libasan.so.1.
So I try force link libasan.so by -lasan in the first place, it don't work.

Then I add -v to link command ,I found something
/usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/collect2 -plugin /usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/liblto_plugin.so -plugin-opt=/usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccVmBBY4.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lasan

gcc 6.3 use collect2 to do link instead of ld ,and it link ld-linux-x86-64.so.2 before libasan.so.

Do I get the real reason?
Any help will be appreciated.

@kcc
Copy link
Contributor

kcc commented Apr 10, 2017

-lasan is never the right way to fix this.
Most likely your gcc installation is broken and I can hardly help here.
But I would suggest to link asan statically (which is the default with clang).
With gcc, use -static-libasan.

@yogurfrul
Copy link
Author

when I use -static-libasan to generate an .so file ,and dlopen it failed:
undefined symbol: __asan_option_detect_stack_use_after_return
nm libasan.a
U __asan_option_detect_stack_use_after_return 00000000000009b8 B __asan_option_detect_stack_use_after_return U __asan_option_detect_stack_use_after_return
nm libasan.so
0000000000548d78 B __asan_option_detect_stack_use_after_return

@chefmax
Copy link

chefmax commented Apr 15, 2017

This happens because with -static-libasan linker still does not inject ASan runtime into .so files. You need link your binary with ASan (add -fsanitize=address -static-libasan to linkage flags) to make it work.

@yogurfrul
Copy link
Author

I have add -fsanitize=address -static-libasan to LD_FLAGS ,then I get the error up

@yogurfrul
Copy link
Author

Q: I've built my shared library with ASan. Can I run it with unsanitized executable?

A: Yes! You'll need to build your library with dynamic version of ASan and then run executable with LD_PRELOAD=path/to/asan/runtime/lib.

@yogurfrul
Copy link
Author

I found this in https://github.com/google/sanitizers/wiki/AddressSanitizer

@yogurfrul
Copy link
Author

My code is gen an executable which would dlopen some shared library cam.so etc ,I ues same version of gcc 6.3 and same sanitizer flags -lasan ,
then I found that ldd executable asan lib point to libasan.so.3 ,however ldd cam.so asan lib point to libasan.so.1.
maybe that's why I need LD_PRELOAD to fix the first error.But why my executable and shaered library link different asan.so.
I try to use -static-libasan, when I dlopen cam.so I got the second error
undefined symbol: __asan_option_detect_stack_use_after_return

@chefmax
Copy link

chefmax commented Apr 17, 2017

I have add -fsanitize=address -static-libasan to LD_FLAGS ,then I get the error up

There is no LD_FLAGS in autotools, use LDFLAGS.

My code is gen an executable which would dlopen some shared library cam.so etc ,I ues same version of gcc 6.3 and same sanitizer flags -lasan

As @kcc mentioned, -lasan is never the right way to fix any ASan related errors. Don't use it ever, use -fsanitize=address instead.

however ldd cam.so asan lib point to libasan.so.1.

It seems that your build is just broken -- cam.so seems to be built with GCC 4.9.

when I use -static-libasan to generate an .so file ,and dlopen it failed:
undefined symbol: __asan_option_detect_stack_use_after_return

I guess using -static-libasan with shared libraries is not well supported on GCC side, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64234 for details. This bug is very unlikely to be fixed, so just use LD_PRELOAD trick (as mentioned in FAQ) to make ASan work for you.

@yogurfrul
Copy link
Author

I found the LD_PRELOAD trick in FAQ is useful for running unsanitized executable with sanitized lib.
my problem is running sanitized executable which would dlopen some sanitized shared library .
I can't fix it by LD_PRELOAD using -static-libasan
However, I use -lasan and LD_PRELOAD ,it works ...

@chefmax
Copy link

chefmax commented Apr 23, 2017

I found the LD_PRELOAD trick in FAQ is useful for running unsanitized executable with sanitized lib.
my problem is running sanitized executable which would dlopen some sanitized shared library .
I can't fix it by LD_PRELOAD using -static-libasan

Using LD_PRELOAD with -static-libasan is completely pointless. It's not suprising that this doesn't work.

However, I use -lasan and LD_PRELOAD ,it works ...

Ok, could you do following things:

  1. Build your executable with -fsanitize=address flag.
  2. Build your shared library with -fsanitize=address flag.
  3. Check that this configuration doesn't work for you.
  4. Post readelf -d <your executable> here.
  5. Post readelf -d <your shared library> here.
    ?

@yogurfrul
Copy link
Author

yogurfrul commented Apr 24, 2017

Of course,I have done 1 and 2 first of all. All of my words and error depends on building my executable and shared library with -fsanitize=address flag.
1.my executable
compile with gcc -fsanitize=address -fno-omit-frame-pointer -fsanitize-coverage=trace-pc
link with gcc -static-libasan -fsanitize=address libFuzzer.a
2.my shared library
compile with gcc -fsanitize=address -fno-omit-frame-pointer
link with gcc-ar -fsanitize=address -static-libasan
3. I got error when dlopen my shared library
undefined symbol: __asan_option_detect_stack_use_after_return
4.

    Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)              Shared library: [libbase.so]
 0x0000000000000001 (NEEDED)              Shared library: [libgtest.so]
 0x0000000000000001 (NEEDED)              Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)              Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)              Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)              Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)              Shared library: [liblog.so]
 0x0000000000000001 (NEEDED)              Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)              Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)              Shared library: [libcamera_metadata.so]
 0x0000000000000001 (NEEDED)              Shared library: [libsync.so]
 0x0000000000000001 (NEEDED)              Shared library: [libcutils.so]
 0x0000000000000001 (NEEDED)              Shared library: [libutils.so]
 0x0000000000000001 (NEEDED)              Shared library: [libbacktrace.so]
 0x0000000000000001 (NEEDED)              Shared library: [libbionic_stub.so]
 0x0000000000000001 (NEEDED)              Shared library: [libskia.so]
 0x0000000000000001 (NEEDED)              Shared library: [libtinyxml2.so]
 0x0000000000000001 (NEEDED)              Shared library: [libGLESv2.so]
 0x0000000000000001 (NEEDED)              Shared library: [libEGL.so]
 0x0000000000000001 (NEEDED)              Shared library: [libz-host.so]
 0x0000000000000001 (NEEDED)              Shared library: [libcamera_client.so]
 0x0000000000000001 (NEEDED)              Shared library: [libicuuc.so]
 0x0000000000000001 (NEEDED)              Shared library: [libicui18n.so]
 0x0000000000000001 (NEEDED)              Shared library: [libexpat.so]
 0x0000000000000001 (NEEDED)              Shared library: [libgif.so]
 0x0000000000000001 (NEEDED)              Shared library: [libimg_utils.so]
 0x0000000000000001 (NEEDED)              Shared library: [libnvm.so]
 0x0000000000000001 (NEEDED)              Shared library: [libexif.so]
 0x0000000000000001 (NEEDED)              Shared library: [libperfhub_client.so]
 0x0000000000000001 (NEEDED)              Shared library: [libhiOTPCalib.so]
 0x0000000000000001 (NEEDED)              Shared library: [libhardware.so]
 0x0000000000000001 (NEEDED)              Shared library: [libyuv.so]
 0x0000000000000001 (NEEDED)              Shared library: [libjpeg.so.62]
 0x0000000000000001 (NEEDED)              Shared library: [libpng.so]
 0x0000000000000001 (NEEDED)              Shared library: [libgcc_s.so.1]
 0x000000000000000c (INIT)               0x41ccd8
 0x000000000000000d (FINI)               0xf48d30
 0x0000000000000020 (PREINIT_ARRAY)      0x1709000
 0x0000000000000021 (PREINIT_ARRAYSZ)    0x8
 0x0000000000000019 (INIT_ARRAY)         0x1709008
 0x000000000000001b (INIT_ARRAYSZ)       3176 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x1709c70
 0x000000000000001c (FINI_ARRAYSZ)       560 (bytes)
 0x0000000000000004 (HASH)               0x400278
 0x0000000000000005 (STRTAB)             0x40c5e0
 0x0000000000000006 (SYMTAB)             0x402c38
 0x000000000000000a (STRSZ)              50433 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x170d290
 0x0000000000000002 (PLTRELSZ)           11208 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x41a110
 0x0000000000000007 (RELA)               0x4199c0
 0x0000000000000008 (RELASZ)             1872 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x4197b0
 0x000000006fffffff (VERNEEDNUM)         8
 0x000000006ffffff0 (VERSYM)             0x418ae2
 0x0000000000000000 (NULL)               0x0
`
5.`Dynamic section at offset 0x9af90 contains 29 entries:
    Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)              Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)              Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)              Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)              Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)              Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)              Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x2e810
 0x000000000000000d (FINI)               0x8475c
 0x0000000000000019 (INIT_ARRAY)         0x29a000
 0x000000000000001b (INIT_ARRAYSZ)       720 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x29a2d0
 0x000000000000001c (FINI_ARRAYSZ)       360 (bytes)
 0x0000000000000004 (HASH)               0x158
 0x0000000000000005 (STRTAB)             0x3a00
 0x0000000000000006 (SYMTAB)             0xd00
 0x000000000000000a (STRSZ)              16159 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x29b258
 0x0000000000000002 (PLTRELSZ)           6024 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x2d088
 0x0000000000000007 (RELA)               0x7d80
 0x0000000000000008 (RELASZ)             152328 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x7ce0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x7920
 0x000000006ffffff9 (RELACOUNT)          6023
 0x0000000000000000 (NULL)               0x0

++++++++++++++++++++++
And I modify "-static-libasan" to "-lasan" flag ,it works witn LD_PRELOAD=/path/to/libasan.so
I do konw I shouldn't use gcc with -lasan , but why it fix my problem.
If I must use -static-libasan ,what shouLd I do?

@chefmax
Copy link

chefmax commented Apr 24, 2017

Please don't use -static-libasan, it doesn't work with GCC and dlopen, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64234. Can you repeat your actions but without -static-libasan now?

@yogurfrul
Copy link
Author

yogurfrul commented Apr 25, 2017

1&2:
delete -static-libasan from flags of executable and shared library.
3:the same error:
==242462==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
4.
Dynamic section at offset 0xffade8 contains 61 entries:

    Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libasan.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libbase.so]
 0x0000000000000001 (NEEDED)             Shared library: [libgtest.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [liblog.so]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libcamera_metadata.so]
 0x0000000000000001 (NEEDED)             Shared library: [libsync.so]
 0x0000000000000001 (NEEDED)             Shared library: [libcutils.so]
 0x0000000000000001 (NEEDED)             Shared library: [libutils.so]
 0x0000000000000001 (NEEDED)             Shared library: [libbacktrace.so]
 0x0000000000000001 (NEEDED)             Shared library: [libbionic_stub.so]
 0x0000000000000001 (NEEDED)             Shared library: [libskia.so]
 0x0000000000000001 (NEEDED)             Shared library: [libtinyxml2.so]
 0x0000000000000001 (NEEDED)             Shared library: [libGLESv2.so]
 0x0000000000000001 (NEEDED)             Shared library: [libEGL.so]
 0x0000000000000001 (NEEDED)             Shared library: [libz-host.so]
 0x0000000000000001 (NEEDED)             Shared library: [libcamera_client.so]
 0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libicui18n.so]
 0x0000000000000001 (NEEDED)             Shared library: [libexpat.so]
 0x0000000000000001 (NEEDED)             Shared library: [libgif.so]
 0x0000000000000001 (NEEDED)             Shared library: [libimg_utils.so]
 0x0000000000000001 (NEEDED)             Shared library: [libnvm.so]
 0x0000000000000001 (NEEDED)             Shared library: [libexif.so]
 0x0000000000000001 (NEEDED)             Shared library: [libperfhub_client.so]
 0x0000000000000001 (NEEDED)             Shared library: [libhiOTPCalib.so]
 0x0000000000000001 (NEEDED)             Shared library: [libhardware.so]
 0x0000000000000001 (NEEDED)             Shared library: [libyuv.so]
 0x0000000000000001 (NEEDED)             Shared library: [libjpeg.so.62]
 0x0000000000000001 (NEEDED)             Shared library: [libpng.so]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x000000000000000c (INIT)               0x41a118
 0x000000000000000d (FINI)               0xe670c0
 0x0000000000000020 (PREINIT_ARRAY)      0x15f8000
 0x0000000000000021 (PREINIT_ARRAYSZ)    0x8
 0x0000000000000019 (INIT_ARRAY)         0x15f8008
 0x000000000000001b (INIT_ARRAYSZ)       3152 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x15f8c58
 0x000000000000001c (FINI_ARRAYSZ)       560 (bytes)
 0x0000000000000004 (HASH)               0x400278
 0x0000000000000005 (STRTAB)             0x40a450
 0x0000000000000006 (SYMTAB)             0x402770
 0x000000000000000a (STRSZ)              47382 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x15fb270
 0x0000000000000002 (PLTRELSZ)           12744 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x416f50
 0x0000000000000007 (RELA)               0x4169b0
 0x0000000000000008 (RELASZ)             1440 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x4167d0
 0x000000006fffffff (VERNEEDNUM)         7
 0x000000006ffffff0 (VERSYM)             0x415d66
 0x0000000000000000 (NULL)               0x0

5 Dynamic section at offset 0x85ea0 contains 26 entries:

  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libasan.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x27468
 0x000000000000000d (FINI)               0x7407c
 0x0000000000000019 (INIT_ARRAY)         0x285000
 0x000000000000001b (INIT_ARRAYSZ)       720 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x2852d0
 0x000000000000001c (FINI_ARRAYSZ)       360 (bytes)
 0x0000000000000004 (HASH)               0x158
 0x0000000000000005 (STRTAB)             0x3760
 0x0000000000000006 (SYMTAB)             0xca0
 0x000000000000000a (STRSZ)              14831 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x286140
 0x0000000000000002 (PLTRELSZ)           4896 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x26148
 0x0000000000000007 (RELA)               0x7530
 0x0000000000000008 (RELASZ)             125976 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x74e0
 0x000000006fffffff (VERNEEDNUM)         2
 0x000000006ffffff0 (VERSYM)             0x7150
 0x000000006ffffff9 (RELACOUNT)          4975
 0x0000000000000000 (NULL)               0x0

I would try install my gcc 6.3 again

@chefmax
Copy link

chefmax commented Apr 25, 2017

And LD_PRELOAD=<path_to_libasan/libasan.so> ./a.out doesn't work?
Also, please check /etc/ld.so.preload file -- is it empty? If not, you should drop it to make ASan work (or use LD_PRELOAD).

@yogurfrul
Copy link
Author

it works as before,
I add -v to link flag ,I see compiler auto add flag -lasan. gcc use shared library libasan.so automatically.

@chefmax
Copy link

chefmax commented Apr 25, 2017

Again, please check /etc/ld.so.preload file. Also, posting LD_DEBUG=files ./a.out output here might help in understanding what's going on.

@yogurfrul
Copy link
Author

yogurfrul commented Apr 25, 2017

vim /etc/ld.so.preload

libachk.so

LD_DEBUG=files ./datatable_fuzzer

    107038:
    107038:     file=libachk.so [0];  needed by ./datatable_fuzzer [0]
    107038:     file=libachk.so [0];  generating link map
    107038:       dynamic: 0x00007f35dd430800  base: 0x00007f35dd330000   size: 0x00000000001009e8
    107038:         entry: 0x00007f35dd330700  phdr: 0x00007f35dd330040  phnum:                  4
    107038:
    107038:
    107038:     file=libasan.so.3 [0];  needed by ./datatable_fuzzer [0]
    107038:     file=libasan.so.3 [0];  generating link map
    107038:       dynamic: 0x00007f35dc59af88  base: 0x00007f35dc277000   size: 0x0000000000f9a7d0
    107038:         entry: 0x00007f35dc296150  phdr: 0x00007f35dc277040  phnum:                  6
    107038:
    107038:
    107038:     file=libbase.so [0];  needed by ./datatable_fuzzer [0]
    107038:     file=libbase.so [0];  generating link map
    107038:       dynamic: 0x00007f35dc276060  base: 0x00007f35dc070000   size: 0x00000000002065d0
    107038:         entry: 0x00007f35dc072fa0  phdr: 0x00007f35dc070040  phnum:                  6
    107038:

and add libasan.so to /etc/ld.so.preload file,it works!!!
and no need to use LD_PRELOAD
thank you very very much for help~

@yogurfrul
Copy link
Author

then I get this waring when run others command
ERROR: ld.so: object 'libasan.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

@chefmax
Copy link

chefmax commented Apr 25, 2017

Try to add full path to libasan.so into /etc/ld.so.preload file. Or modify it like this: libasan.so.3 libachk.so.

@chefmax
Copy link

chefmax commented Apr 26, 2017

But note that adding libasan.so to /etc/ld.so.preload will preload ASan runtime to all programs on your system and most likely this is not what you want. So I suggest you to use LD_PRELOAD instead.
In any case, this is not an issue in ASan itself but in testing environment, so I'm closing the issue.

@yugr
Copy link

yugr commented Jan 24, 2020

As an alternative for -static-libasan (which is not very well supported by GCC) you can use export ASAN_OPTIONS=verify_asan_link_order=0 to suppress the check (but you have to be sure that libraries from /etc/ld.so.preload do not intercept symbols important for Asan e.g. malloc, free, etc., otherwise things will start breaking).

johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
johnmcfarlane pushed a commit to johnmcfarlane/wss that referenced this issue Feb 2, 2020
- prevents error discussed here:
  google/sanitizers#796
zakuArbor referenced this issue in zakuArbor/proxyAuth Feb 22, 2020
@korolevbin
Copy link

But note that adding libasan.so to /etc/ld.so.preload will preload ASan runtime to all programs on your system and most likely this is not what you want. So I suggest you to use LD_PRELOAD instead. In any case, this is not an issue in ASan itself but in testing environment, so I'm closing the issue.

Editing /etc/ld.so.preload broke my all ssh sessions. DO NOT EDIT THIS FILE.

@zhangysh1995
Copy link

zhangysh1995 commented Jun 27, 2022

Before doing vim /etc/ld.so.preload, first backup the file content. For me, there is one library in this file. In my case, by emptying the file the asan error is removed and there is no side effect.

@nlguillemot
Copy link

Just mentioning another hack to solve this issue:

  char asan_opts[] = "ASAN_OPTIONS=verify_asan_link_order=0";
  putenv(asan_opts);

I have a C++ program using system() to spawn subprocesses with LD_PRELOAD and the spawned sub-processes seem to properly receive the flag specified in the code snippet above.

@qubin-ben
Copy link

try export ASAN_OPTIONS=verify_asan_link_order=0

I solve this issue by using above command。 And I am using gcc11

alegrand pushed a commit to simgrid/simgrid that referenced this issue Nov 9, 2024
samuel-lee-msft pushed a commit to microsoft/SymCrypt that referenced this issue Nov 23, 2024
…in initial library list"

Workaround for "ASan runtime does not come first in initial library list": added a task to disable ASAN link order verification by setting the `ASAN_OPTIONS` variable to `verify_asan_link_order=0`. See google/sanitizers#796
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants