Generate 3d probe-and-validate wrapper functions #129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR, 3D can now generate, for a given type
T, an unverified wrapper calling a probing functionProbeon an addressaand then calling the validator forTon the memory area probed byMyProbe.If for instance in
MyModule.3dthe user writes:Then EverParse/3D generates into
MyModuleWrapper.candMyModuleWrapper.h, in addition to the ordinaryMyModuleCheckTvalidator wrapper function, a probe-and-validate wrapper function:This probe-and-validate wrapper function takes:
probeDest, that still needs to be provided by the callerprobeAddr, directly (so no need for an extra “fake input buffer” indirection)When called, the probe-and-validate wrapper function calls the
fprobing function and, if probing succeeds, calls theTvalidator on the probed buffer.The syntax of the
entrypoint probeattribute is:where the
sizeargument, giving the number of bytes to probe, is either an integer literal or a global integer variable defined with#define. The value ofsizemust be at most a 32-bit unsigned integer.