[Lldb-commits] [PATCH] D100515: [lldb] Add GetCodeAddressMask and GetDataAddressMask to Process

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 15 03:24:07 PDT 2021

omjavaid added a comment.

In D100515#2690225 <https://reviews.llvm.org/D100515#2690225>, @jasonmolenda wrote:

> Thanks Jonas, I think this change to Process can cover
>   Omair's use case, where the number of bits are used hardcoded.
>   The Darwin use case were ProcessGDBRemote, DynamicLoaderDarwinKernel, and ProcessMachCore can all set the number of bits used in addressing programmatically, detected at runtime.
>   The firmware use case where people (often in a python script in a dSYM) can set the number of bits manually so it is correct in their environment, when the dynamic detection schemes are not available.

This looks very good and I have couple of highlights to make from Linux/AArch64 perspective:
qHostInfo is not sufficient for mask calculation on Linux because both data/code ptr auth masks are read by thread register context (both masks are currently same and they same for all the threads of a process). 
IMO moving the mask calculation to ABI GetCodeAddress method may be a better option. We can pull in information of addressable bits from process and also read register context for code/data masks by passing threadsp to ABI::GetCodeAddress. But in case we dont get agreement on moving mask calculation to ABI we can calculate mask somewhere inside ProcessGDBRemote and set it from there.... similar to what I have done in D99947 <https://reviews.llvm.org/D99947>.

> Justin's case where ptrace(PTRACE_GETREGSET) gets us a code and data address mask.
> Canonicalizing them as masks in Process, accepting either form, and providing the value as a mask, should make it easy to use in the ABI plugins where we have a FixCodeAddress and FixDataAddress.
> On Darwin, we use the same number of bits for both code and data, but given the way ptrace() behaves on Linux, I'm guessing this may not be the case everywhere.  Should we store both masks, and add FixCodeAddress + FixDataAddress methods in the ABI's, Justin?  What do you think?
> The Darwin support can be adapted to this centralized scheme that Jonas has written easily.  Everyone else OK with this?
> I don't feel strongly about the method name.  Justin used Process::GetPointerAuthenticationAddressMask which makes it sound specific to ARM v8.3 ptrauth.  The ARM v8.5 MTE tagging might be another use case (or TBI as Omair has noted).



More information about the lldb-commits mailing list