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

clang++ shared_ptr with control flow integrity crashes #52652

Open
ambiso opened this issue Dec 13, 2021 · 1 comment
Open

clang++ shared_ptr with control flow integrity crashes #52652

ambiso opened this issue Dec 13, 2021 · 1 comment
Labels
compiler-rt:cfi Control Flow Integrity

Comments

@ambiso
Copy link

ambiso commented Dec 13, 2021

The following program:

#include <memory>

struct X {
    X() {}
    virtual ~X() {};
};

int main() {
    std::shared_ptr<X> _asd = std::make_shared<X>();
    return 0;
}

Compiled with:

$ clang++ -fsanitize=cfi-unrelated-cast -fvisibility=hidden -flto -O2 -std=c++14 test.cc

on

$ clang++ --version
clang version 13.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

crashes:

$ ./a.out
[1]    21670 illegal hardware instruction (core dumped)  ./a.out

I don't see any reason that it should crash - am I doing something wrong?

Here's the gef context one instruction before the crashing instruction (ud1):
gef-context

Please let me know if there's any more information that I could provide!
Best,
ambiso

@ambiso
Copy link
Author

ambiso commented Dec 13, 2021

This may be a regression from #48337 ?

@Endilll Endilll added compiler-rt:cfi Control Flow Integrity and removed new issue labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:cfi Control Flow Integrity
Projects
None yet
Development

No branches or pull requests

2 participants