Thread (81 messages) 81 messages, 8 authors, 2022-05-25

RE: [RFC PATCH v2 20/21] x86: Add support for CONFIG_CFI_CLANG

From: David Laight <hidden>
Date: 2022-05-17 07:56:43
Also in: linux-hardening, lkml, llvm

From: Sami Tolvanen
Sent: 16 May 2022 23:03

On Mon, May 16, 2022 at 2:44 PM Peter Zijlstra [off-list ref] wrote:
quoted
On Mon, May 16, 2022 at 09:32:55PM +0000, David Laight wrote:
quoted
quoted
The compiler always generates this specific instruction sequence.
Yes, but there are several ways to encode 'cmpl imm,-6(reg)'.
Yes, but we don't care. This *always* uses the 32bit immediate form.
Even if the immediate is small.
Yes, that part is not a problem, but it's a valid point that LLVM
might not always use r8-r15 here, so I will have to check for the REX
prefix before blindly attempting to decode the instruction.
Are you allowing for the REX prefix at all?
The encoding of:
quoted
quoted
+      *   cmpl    <id>, -6(%reg)     ; 7 bytes
is
	<opcode><mod/TTT/rm><off8><imm32>
which is 7 bytes without the REX.
If reg is r11 there is an extra REX byte - for 8 in total.

Without the REX byte the decode will be using %bx.
So the testing should all have failed.
Which means that something else is wrong as well.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help