1 PAC
AMR64
offersPAC
(Pointer Authentication Code) mechanism.
what is calledPAC
To put it simply, the key stored on the chip hardware, a "context", and the "pointer address" are encrypted, resulting in a "signature", which is then written to the pointer's high value.bit
Up.
The reason why the computed 'signature' can be written to the pointer's highbit
This is because in practice, not all pointer64bit
are used, usually highbit
All will be reserved for other uses.
If someone maliciously modifies the pointer address while the program is running, and the signed pointer address is used later, acting on the verify instruction, an error will be reported.
The verification process is the same as the signature calculation process, except that it compares whether the signature values calculated before and after are the same. If the validation is successful, the signature will be retrieved from the highbit
Removed from the top.
2 Command Syntax
PACIBSP
3 Command Semantics
The above instruction performs the function return addressPAC
That is to say, to theX30
value ofPAC
or to theLR
The value of the registers for thePAC
。
existPAC
The process has2
One kind of key, one kind of keyA
The other is the keyB
。
directivesPACIBSP
hit the nail on the headB
means to use the keyB
at the same timeSP
Indicates that "context" uses theSP
The value of the register.
Here is a runPACIBSP
Later.X30
Example of a change in the value of.
// PAC ahead
(lldb) p/x $x30
(unsigned long) 0x000000010817f7bc
// PAC empress
(lldb) p/x $x30
(unsigned long) 0x3f57fc010817f7bc
As you can see from the output above, theX30
highbit
existPAC
Changes have occurred since then.
4 Similar directives
4.1 PACIB
PACIB <Xd>, <Xn|SP>
keys
: KeyB
。
(textual) context
: Xn
The value of the register or theSP
The value of the register.
pointer address
: Xd
The value of the register
4.2 PACIB1716
PACIB1716
keys
: KeyB
。
(textual) context
:: RegistersX16
The value of the
pointer address
:: RegistersX17
The value of the
4.3 PACIBZ
PACIBZ
keys
: KeyB
。
(textual) context
: 0
。
pointer address
: X30
Registers orLR
The value of the register.
4.4 PACIZB
PACIZB <Xd>
keys
: KeyB
。
(textual) context
: 0
。
pointer address
:: RegistersXd
The value of the
4.5 Key A Command
directivesPACIASP
PACIA
PACIA1716
PACIAZ
PACIZA
In addition to using the keyA
carry outPAC
Other than that, everything else is the same as the correspondingPACIB*
The instructions are the same.