Move the invocation of hooks from Scudo internal to wrapper_c.cpp and
wrapper_c_bionic.cpp respectively. Therefore, Scudo's core algorithm
doesnt need to worry about the reentrant of hooks and leave the caring
of reentrant to the hook users.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Note, I'll update scudo_hooks_test.cpp later. Now this is more like a RFC for hook users
Adding some preliminary (minor) notes, as I haven't tested this CL on Fuchsia yet.
compiler-rt/lib/scudo/standalone/wrappers_c.inc | ||
---|---|---|
44 | Should this pass Product as the second argument? | |
138 | nit: This can be moved after the if below | |
161 | Should the hook report the rounded-up size to avoid changing the current behavior? (on the other hand I'd be surprised if any existing user depends on it) | |
178 | Similarly to above, the current behavior is to call the allocate hook first, then then deallocate hook. nit: the two NewPtr != ptr checks can be grouped under only one if |
Thanks @Chia-hungDuan for looking into this!
Those changes look good to me. Do you also need to change wrappers_cpp.cpp similarly?
Remove scudo_hook_test.cpp and move the hook tests to wrappers_c_test.cpp and wrappers_cpp_test.cpp
LGTM, thanks for working on that, @Chia-hungDuan .
I have not tested this patch yet on Fuchsia, but I intend to do so shortly this week.
Should this pass Product as the second argument?