Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

qjs-ng doesnt work when compiled with asan #636

Closed
satk0 opened this issue Oct 28, 2024 · 12 comments · Fixed by #638
Closed

qjs-ng doesnt work when compiled with asan #636

satk0 opened this issue Oct 28, 2024 · 12 comments · Fixed by #638

Comments

@satk0
Copy link
Contributor

satk0 commented Oct 28, 2024

Hey Again, pancake has just found out, that compiling qjs-ng with asan enabled, makes qjs-ng unusable:
image

It was already solved by pancake in r2, here: radareorg/radare2@fd4bbe0

It would be great to patch it upstream. Can I get a green light for making a PR implementing just that?

@bnoordhuis
Copy link
Contributor

We build and test with asan (and ubsan and....) on the CI so it should already work out of the box.

Do you build with NDEBUG defined or without? I ask because of this:

https://github.com/quickjs-ng/quickjs/blob/eae9b23843ef6c29a2acb7caab53a9b46f772d34/quickjs.c#L2481-L2489

@saghul
Copy link
Contributor

saghul commented Oct 28, 2024

Sounds related to #521

@satk0
Copy link
Contributor Author

satk0 commented Oct 28, 2024

@saghul
Copy link
Contributor

saghul commented Oct 28, 2024

Ah, I see you are not using our build system. We define __ASAN__ when compiling under it. Can you try doing that?

@satk0
Copy link
Contributor Author

satk0 commented Oct 28, 2024

Sure, I am trying it rn, I am sure it's going to work

@satk0
Copy link
Contributor Author

satk0 commented Oct 28, 2024

Thanks, I've made a PR defining the variable you requested here: radareorg/radare2#23556

Will see what pancake will say. Will inform you on that

@trufae
Copy link
Contributor

trufae commented Oct 29, 2024

Any reason not to use the preprocessor directive instead of the custom ASAN ?
Screenshot_2024-10-28_at_10 08 13

@saghul
Copy link
Contributor

saghul commented Oct 29, 2024

Assuming this still holds true: https://stackoverflow.com/a/78444624

GCC (at least not in all versions with support for ASAN) doesn't have __has_feature so we'd have to check for __SANITIZE_ADDRESS__, which in turn Clang doesn't support.

So using our own seems more fool proof here.

@trufae
Copy link
Contributor

trufae commented Oct 29, 2024

Sounds good, i guess visual studio situation is even worse, but this ifdef at least saved me some time. But considering there’s no generic way to check this sounds like the way to go. Thanks

@satk0
Copy link
Contributor Author

satk0 commented Oct 29, 2024

Thanks for all, I can close the issue now, sorry for taking your time

@satk0 satk0 closed this as completed Oct 29, 2024
@saghul
Copy link
Contributor

saghul commented Oct 29, 2024

No problem @satk0 !

bnoordhuis added a commit to bnoordhuis/quickjs that referenced this issue Oct 29, 2024
bnoordhuis added a commit that referenced this issue Oct 29, 2024
@bnoordhuis
Copy link
Contributor

I landed a fix just now (56e5ffa) so there should be no changes necessary anymore on r2's side.

bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants