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

llvm-hs segmentation fault with output of clang -g #349

Open
andrew-wja opened this issue Jun 17, 2021 · 2 comments
Open

llvm-hs segmentation fault with output of clang -g #349

andrew-wja opened this issue Jun 17, 2021 · 2 comments

Comments

@andrew-wja
Copy link
Member

The EncodeM and DecodeM instances for debug metadata are currently quite fragile, and there are several places where a segmentation fault could be triggered by debug metadata structures which we don't handle, or don't handle correctly.

In particular, there are multiple places where we use maybe (return nullPtr) encodeM to pass a null pointer to the LLVM C/C++ API where we have Nothing on the Haskell side. An audit of the encoding needs to be carried out to make sure that we only pass null pointers to LLVM where the LLVM API explicitly accepts a null pointer as an indicator of the absence of something, and not anywhere else. We currently have at least one null pointer being passed to an LLVM API function which dereferences it, leading to the segmentation fault when attempting to load the IR produced by clang -g.

@andrew-wja andrew-wja added this to the LLVM 12 Support milestone Jun 17, 2021
@andrew-wja andrew-wja added the bug label Jul 7, 2021
@aboeglin
Copy link

aboeglin commented Jun 6, 2023

@andrew-wja
Can this explain the failing tests? I'd be happy to look into it but I'd need some guidance.

@aboeglin
Copy link

aboeglin commented Jun 7, 2023

Nevermind, I dug into it last night and the failing tests are related to wrong types for DICompileUnit and DILocalVariable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants