-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Manual poisoning for pool/heap when using address sanitizer #4584
Conversation
@@ -1322,6 +1322,7 @@ void ponyint_cycle_terminate(pony_ctx_t* ctx) | |||
ponyint_become(ctx, cycle_detector); | |||
final(ctx, cycle_detector); | |||
ponyint_destroy(ctx, cycle_detector); | |||
ponyint_become(ctx, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the change. I'm on my phone so maybe I missed it, but I don't see it used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ponyint_become
saves the cycle_detector
pointer into the ctx
on line 1322.. then final
runs the finaliser/cleanup for the cycle detector.. then ponyint_destroy
destroys the cycle_detector
.. the new ponyint_become(ctx, NULL)
is to ensure that the ctx
don't retain a reference to the now invalid cycle_detector
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack
i believe the missing header file:
error can be resolved by installing the |
There's a different error now with that in a new builder that I ran with. Shall I push that change and you can continue working on getting this to pass CI? |
@SeanTAllen one more docker image change would be useful.. currently, ubsan can't find a symbolizer and the backtraces aren't very useful:
i believe the as for the failure, i have a feeling that the |
@dipinhora i wary of installing llvm in the image and then accidentally picking up the wrong one. if we build it as part of our llvm build, that should be able to work, yes? |
i would assume so.. not sure how ubsan finds a symbolizer to use but i'm guessing it looks for it via the path.. maybe it's documented somewhere... 8*/ |
can you see if you can run that down? i think it is probably a better, less foot-gunny approach. |
yep.. the ubsan docs (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#stack-traces-and-report-symbolization) say:
|
It appears we don't build llvm-sanitizer at the moment. If you need help figuring that part out, @chalcolith would be a good resource. |
we do build
|
I misread your comment. In particular, the binary name. |
@dipinhora when you have a chance, you should rebase against main which now has the updated ubuntu24 builders across the board. |
f1b429c
to
f9db5d4
Compare
done |
@dipinhora is this good now? I believe everything we discussed is in place now. I wanted to verify. |
src/libponyrt/mem/pool.h
Outdated
@@ -43,6 +49,28 @@ size_t ponyint_pool_used_size(size_t index); | |||
|
|||
size_t ponyint_pool_adjust_size(size_t size); | |||
|
|||
#ifndef POOL_USE_DEFAULT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the order reversed here.
Can you make this say #ifdef POOL_USE_DEFAULT
and make the default case come first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switched
src/libponyc/codegen/genfun.c
Outdated
// must be at least the size of 3 or else we get a heap buffer overflow | ||
if((2 * sizeof(LLVMTypeRef)) == tparam_size) | ||
tparam_size += tparam_size + sizeof(LLVMTypeRef); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's going on here. Joe and I are trying to sort it out and we are very confused at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this, "if tparam_size was 0 so that it is now 2, we want to make it 3"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i assume this was found by the sanitizer?
either way, i find the logic confusing. is there a reason it feels so "obfuscated"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to ignore you @SeanTAllen because @jemc rewrote the code already..
kind of.. the CI is no longer failing.. but ubsan is still having trouble with finding the symbolizer (https://github.com/ponylang/ponyc/actions/runs/12802214635/job/35693500329#step:11:451):
even though i explicitly checked and it should be in the path correctly (https://github.com/ponylang/ponyc/actions/runs/12802214635/job/35693500329#step:11:70):
i'm planning on giving it another try to get it working but if it doesn't i'm going to give up on the symbolization from the sanitizers for now.. |
So the address sanitizer can better detect issues Including adding an address and undefined behavior sanitizer CI build and a couple of minor fixes identified by the address sanitizer
Co-authored-by: Joe Eli McIlvain <[email protected]>
4cb5799
to
75b17ca
Compare
@SeanTAllen this is now ready from my perspective.. |
So the address sanitizer can better detect issues
Including adding an address and undefined behavior sanitizer CI build and a couple of minor fixes identified by the address sanitizer