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

Enable MSAN support again #46348

Merged
merged 1 commit into from
Aug 19, 2022
Merged

Enable MSAN support again #46348

merged 1 commit into from
Aug 19, 2022

Conversation

Keno
Copy link
Member

@Keno Keno commented Aug 15, 2022

Analogous to (and dependent on) #46336, but for msan. The biggest
change is a workaround for LLVM's lack for TLS relocation support
(I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815,
but that was x86_64-linux-gnu only, while this workaround works
everywhere - though we should consider resurrecting my patch for
performance at some point). The rest is mostly build fixes and
plumbing to get the sanitizer flags through to the dependencies.

@Keno Keno mentioned this pull request Aug 15, 2022
60 tasks
@gbaraldi
Copy link
Member

I believe JITLink has support for TLS relocation so we might get that for free when we enable it soon ™️ https://groups.google.com/g/llvm-dev/c/iTAdTFQ-ql8

@Keno Keno changed the title WIP: Enable MSAN support again Enable MSAN support again Aug 17, 2022
Analogous to (and dependent on) #46336, but for msan. The biggest
change is a workaround for LLVM's lack for TLS relocation support
(I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815,
but that was x86_64-linux-gnu only, while this workaround works
everywhere - though we should consider resurrecting my patch for
performance at some point). The rest is mostly build fixes and
plumbing to get the sanitizer flags through to the dependencies.
@Keno Keno merged commit beb3ab4 into master Aug 19, 2022
@Keno Keno deleted the kf/msanrevival branch August 19, 2022 20:02
@@ -856,8 +856,11 @@ uint8_t *RTDyldMemoryManagerJL::allocateCodeSection(uintptr_t Size,
StringRef SectionName)
{
// allocating more than one code section can confuse libunwind.
#if defined(_COMPILER_MSAN_ENABLED_)
// TODO: Figure out why msan needs this.
assert(!code_allocated);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this assert now only used when MSAN is present? The memory manager can't handle recursive allocations anyways, so the assert guards against that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this was a typo. Obviously the condition should be inverted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even so, I'm surprised that simply disabling the assert works for MSAN at all. Whenever I've disabled that assert the memory manager dies later on with a deeper error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know - I haven't looked into it further. You're welcome to it ;)

Keno added a commit that referenced this pull request Aug 20, 2022
Keno added a commit that referenced this pull request Aug 20, 2022
@@ -5,7 +5,7 @@ OPENBLAS_GIT_URL := https://github.com/xianyi/OpenBLAS.git
OPENBLAS_TAR_URL = https://api.github.com/repos/xianyi/OpenBLAS/tarball/$1
$(eval $(call git-external,openblas,OPENBLAS,,,$(BUILDDIR)))

OPENBLAS_BUILD_OPTS := CC="$(CC)" FC="$(FC)" LD="$(LD)" RANLIB="$(RANLIB)" TARGET=$(OPENBLAS_TARGET_ARCH) BINARY=$(BINARY)
OPENBLAS_BUILD_OPTS := CC="$(CC) $(SANITIZE_OPTS)" FC="$(FC) $(SANITIZE_OPTS) -L/home/keno/julia-msan/usr/lib" LD="$(LD) $(SANITIZE_LDFLAGS)" RANLIB="$(RANLIB)" BINARY=$(BINARY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-L/home/keno/julia-msan/usr/lib

Is that supposed to be something else?

@fxcoudert
Copy link
Contributor

This commit breaks build from source of suite-sparse on macOS because system linker (Apple's ld) does not recognise the --warn-unresolved-symbols option.

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.

5 participants