Skip to content
Snippets Groups Projects
Commit ebfb5cdb authored by Jessica Clarke's avatar Jessica Clarke
Browse files

SystemInformation: Change GetRealAddress to return a size_t

The return value is not a real pointer, but an integer representing the
offset of the symbol within the loaded binary/library (possibly
including a load base). On CHERI, and thus Arm's Morello prototype,
pointers are not just integers but are unforgeable hardware capabilities
that contain additional metadata (including bounds and permissions) to
provide fine-grained spatial safety. Casting a plain integer (in this
case, a ptrdiff_t) to a void * gives a warning that we normally make
fatal, as due to the unforgeability of capabilities it will not be a
valid pointer, trapping on dereference. Whilst there are ways to squash
this warning (typically by casting via (u)intptr_t), they are not
appropriate here, since the return value does not need to be a void *,
and are normally only needed for reusing void *-taking interfaces with a
plain integer (e.g. pthread_create's void * argument). Thus change the
return type to be size_t to represent that this is the non-negative
integer offset of the address from the base address.

Note that, other than the dummy call in the constructor that throws away
the result, this member function is unused.
parent 572f2a65
No related branches found
No related tags found
1 merge request!241SystemInformation: Change GetRealAddress to return a size_t
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment