Darwin AArch64 application processors are run with Top Byte Ignore mode enabled so metadata may be stored in the top byte, it needs to be ignored when reading/writing memory. David Spickett handled this already in the base class Process::ReadMemory but ProcessMachCore overrides that method (to avoid the memory cache) and did not pick up the same change. I add a test case that creates a pointer with metadata in the top byte and dereferences it with a live process and with a corefile. rdar://123784501
14 lines
213 B
C
14 lines
213 B
C
#include <stdint.h>
|
|
#include <stdio.h>
|
|
union ptrbytes {
|
|
int *p;
|
|
uint8_t bytes[8];
|
|
};
|
|
int main() {
|
|
int c = 15;
|
|
union ptrbytes pb;
|
|
pb.p = &c;
|
|
pb.bytes[7] = 0xfe;
|
|
printf("%d\n", *pb.p); // break here
|
|
}
|