[Lldb-commits] [PATCH] D118794: [lldb][AArch64] Remove non-address bits from addresses passed to ptrace on Linux

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 2 07:45:18 PST 2022

DavidSpickett created this revision.
Herald added a subscriber: kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This commit makes lldb-server on Linux strip non-address bits from addresses
passed to the following ptrace operations:

- POKEDATA (memory write)
- PEEKDATA (memory read)
- process_vm_readv (memory read)
- POKEMTETAGS (memory tag write)
- PEEKMTETAGS (memory tag read)

(anything that needs a virtual address of the tracee)

When we only had the top byte set, we were getting away with it
because the hardware did the masking for us. Though according to
we should be removing them.

"When the AArch64 Tagged Address ABI is enabled for a thread, the
following behaviours are guaranteed:

All syscalls except the cases mentioned in section 3 can accept any
valid tagged pointer."

Since we don't enable the tagged address ABI, the implication
is that the opposite is true. Even if certain ptrace calls happen
to work now, they might not in future.

For pointer signatures usually they would be authenticated before
use and ptrace doesn't know to do that. So we must remove the
signature before use.

I've used the data_mask here for all addresses because Linux
currently does not set different code and data masks. Since AArch64's
"data_mask" is the pointer signature mask only, the top byte is removed

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118794.405275.patch
Type: text/x-patch
Size: 10258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220202/5c7e2dfd/attachment-0001.bin>

More information about the lldb-commits mailing list