11.01.2017 Views

Pointer Authentication on ARMv8.3

whitepaper-pointer-authentication-on-armv8-3

whitepaper-pointer-authentication-on-armv8-3

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

such as ASLR and software-based CFI infeasible to implement. We wanted a scheme where we could check the<br />

validity of pointers with minimal size and performance impact, and that resists memory disclosure vulnerabilities.<br />

This ruled out using XOR with a random value and other simple ways to obfuscate or scramble pointers. We<br />

needed a cryptographically str<strong>on</strong>g algorithm.<br />

Using authenticati<strong>on</strong> instead of encrypti<strong>on</strong> was an early design decisi<strong>on</strong>. With authenticati<strong>on</strong>, the actual pointer<br />

value is still available without having to know the secret keys. This has many advantages, from allowing branch<br />

predicti<strong>on</strong> in the processor to debugging. Furthermore, with authenticati<strong>on</strong>, it becomes possible to know a when<br />

corrupti<strong>on</strong> happened rather than just jumping to a random locati<strong>on</strong> and hopefully crashing. The next secti<strong>on</strong><br />

describes the design of <str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g>.<br />

<str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g><br />

The basic idea behind <str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g> is that the actual address space in 64-bit architectures is less than<br />

64-bits. There are unused bits in pointer values that we can use to place a <str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g> Code (PAC) for<br />

this pointer. We could insert a PAC into each pointer we want to protect before writing it to memory, and verify its<br />

integrity before using it. An attacker who wants to modify a protected pointer would have to find/guess the<br />

correct PAC to be able to c<strong>on</strong>trol the program flow.<br />

Not every pointer has the same purpose in a program. We want the pointers to be valid <strong>on</strong>ly in a specific c<strong>on</strong>text.<br />

In <str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g>, this is achieved in two ways: Having separate keys for major use cases and by<br />

computing the PAC over both the pointer and a 64-bit c<strong>on</strong>text. The pointer authenticati<strong>on</strong> specificati<strong>on</strong> defines<br />

five keys: two for instructi<strong>on</strong> pointers, two for data pointers and <strong>on</strong>e for a separate general-purpose instructi<strong>on</strong> for<br />

computing a MAC over l<strong>on</strong>ger sequences of data. The instructi<strong>on</strong> encoding determines which key to use. The<br />

c<strong>on</strong>text is useful for isolating different types of pointers used with the same key. The c<strong>on</strong>text is specified as an<br />

additi<strong>on</strong>al argument together with the pointer when computing and verifying the PAC.<br />

The pointer authenticati<strong>on</strong> design has three main comp<strong>on</strong>ents: instructi<strong>on</strong>s, cryptography, and key management<br />

which will be described below.<br />

Instructi<strong>on</strong>s<br />

There are two main operati<strong>on</strong>s needed for <str<strong>on</strong>g>Pointer</str<strong>on</strong>g> <str<strong>on</strong>g>Authenticati<strong>on</strong></str<strong>on</strong>g>: computing and adding a PAC, and verifying a<br />

PAC and restoring the pointer value. These are handled by the PAC* and AUT* sets of instructi<strong>on</strong>s respectively. If<br />

verificati<strong>on</strong> fails during the AUT instructi<strong>on</strong>, the processor replaces the PAC with a specific pattern that makes the<br />

pointer value an illegal address. The actual error detecti<strong>on</strong> happens through the illegal address excepti<strong>on</strong> when an<br />

invalid pointer is dereferenced. This design decouples error handling from the instructi<strong>on</strong> and removes the need<br />

to use additi<strong>on</strong>al instructi<strong>on</strong>s for error handling. The excepti<strong>on</strong> handler can distinguish between an illegal address<br />

excepti<strong>on</strong> and an authenticati<strong>on</strong> failure by checking the pattern that the AUT instructi<strong>on</strong> uses to signal the error.<br />

In additi<strong>on</strong> to the PAC and AUT instructi<strong>on</strong>s, there are instructi<strong>on</strong>s for stripping the PAC (XPAC*), and for<br />

computing a 32-bit authenticati<strong>on</strong> code from two 64-bit inputs (PACGA). The PACGA instructi<strong>on</strong> is useful for<br />

protecting sensitive data structures in memory. For instance, it can be used to compute an authenticati<strong>on</strong> code<br />

(AC) value that covers all the heap metadata by chaining together a couple of calls to the PACGA instructi<strong>on</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!