Skip to content

Add LBT_USE_RTLD_DEEPBIND capability #48

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

Merged
merged 1 commit into from
Jul 8, 2021
Merged

Conversation

staticfloat
Copy link
Member

Certain tools such as sanitizers don't like us loading libraries with
RTLD_DEEPBIND, so since we already have the workarounds in place for
systems that don't have RTLD_DEEPBIND at all, let's change these from
using compile-time constants to instead use a runtime switch that can be
overridden through setting the environment variable
LBT_USE_RTLD_DEEPBIND=0 before running our program.

@staticfloat
Copy link
Member Author

@tkf can you try this out, regarding #47 ?

@staticfloat staticfloat force-pushed the sf/lbt_use_rtld_deepbind branch from 8cc5c4a to 66f63ea Compare July 8, 2021 17:04
Certain tools such as sanitizers don't like us loading libraries with
`RTLD_DEEPBIND`, so since we already have the workarounds in place for
systems that don't have `RTLD_DEEPBIND` at all, let's change these from
using compile-time constants to instead use a runtime switch that can be
overridden through setting the environment variable
`LBT_USE_RTLD_DEEPBIND=0` before running our program.
@staticfloat staticfloat force-pushed the sf/lbt_use_rtld_deepbind branch from 66f63ea to 0804de5 Compare July 8, 2021 18:52
@staticfloat
Copy link
Member Author

@giordano do you have any idea what's wrong with the drone setup?

@giordano
Copy link
Collaborator

giordano commented Jul 8, 2021

No, the alpine image started failing a few weeks ago but I've never got around to look into it 😞

@tkf
Copy link

tkf commented Jul 8, 2021

regarding #47

Thanks a lot! I can confirm that this branch works with

make debug  # let it fail
cp /PATH/TO/THIS/libblastrampoline/src/build/libblastrampoline.so usr/lib/libblastrampoline.so
LBT_USE_RTLD_DEEPBIND=0 make debug

To be concrete, $PWD/Make.user contains

TOOLCHAIN=$(TOOLCHAIN_WORKTREE)/usr/tools

# use our new toolchain
USECLANG=1
override CC=$(TOOLCHAIN)/clang
override CXX=$(TOOLCHAIN)/clang++
export ASAN_SYMBOLIZER_PATH=$(TOOLCHAIN)/llvm-symbolizer

USE_BINARYBUILDER_LLVM=1

override SANITIZE=1
override SANITIZE_ADDRESS=1

# make the GC use regular malloc/frees, which are hooked by ASAN
override WITH_GC_DEBUG_ENV=1

# default to a debug build for better line number reporting
override JULIA_BUILD_MODE=debug

# enable LLVM assertions (which also enables pass debug output)
#override LLVM_ASSERTIONS=1

# make ASAN consume less memory
export ASAN_OPTIONS=detect_leaks=0:fast_unwind_on_malloc=0:allow_user_segv_handler=1:malloc_context_size=2

JULIA_PRECOMPILE=1

and $TOOLCHAIN_WORKTREE/Make.user contains

USE_BINARYBUILDER_LLVM=1
BUILD_LLVM_CLANG=1

On $TOOLCHAIN_WORKTREE I ran make -C deps install-llvm install-clang install-llvm-tools to isntall enough binaries in $(TOOLCHAIN_WORKTREE)/usr/tools.

@staticfloat staticfloat merged commit ee05371 into main Jul 8, 2021
@giordano giordano deleted the sf/lbt_use_rtld_deepbind branch July 8, 2021 22:18
@giordano giordano linked an issue Jul 8, 2021 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

Turn off DEEPBIND for sanitizers?
3 participants