[PATCH] D72225: Align branches within 32-Byte boundary(Prefix padding)

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 00:36:26 PST 2020


skan added a comment.

In D72225#1818812 <https://reviews.llvm.org/D72225#1818812>, @MaskRay wrote:

> Here is one failure.
>
>   --x86-align-branch-prefix-size=0
>  
>       3444eca6:	64 48 8b 04 25 00 00 	mov    %fs:0x0,%rax
>       3444ecad:	00 00 
>       3444ecaf:	48 8d 80 60 f7 ff ff 	lea    -0x8a0(%rax),%rax
>       3444ecb6:	83 78 04 00          	cmpl   $0x0,0x4(%rax)
>       3444ecba:	66 0f 1f 44 00 00    	nopw   0x0(%rax,%rax,1)
>       3444ecc0:	0f 88 08 02 00 00    	js     3444eece
>  
>   --x86-align-branch-prefix-size=5
>  
>       3444fe66:	2e 2e 2e 2e 2e 64 48 	cs cs cs cs cs mov %fs:0x0,%rax
>       3444fe6d:	8b 04 25 00 00 00 00 
>       3444fe74:	48 8d 80 60 f7 ff ff 	lea    -0x8a0(%rax),%rax
>       3444fe7b:	00 83 78 04 00 0f    	add    %al,0xf000478(%rbx)   ###### incorrect
>       3444fe81:	88 08                	mov    %cl,(%rax)
>       3444fe83:	02 00                	add    (%rax),%al
>       3444fe85:	00 48 8d             	add    %cl,-0x73(%rax)
>       3444fe88:	05 73 b4 44 01       	add    $0x144b473,%eax
>
>
> I still suggest we ship something safer. If you think D72463 <https://reviews.llvm.org/D72463> is acceptable, I can delete line 2022 (`AlignBranchPrefixSize = 5;`), and we can ship just NOP padding for clang 10.0. 
>  https://lists.llvm.org/pipermail/llvm-dev/2019-December/137610.html NOP padding only has smaller code size increase and is good enough for the mitigation purposes.


Could you provide the corresponding assembly code?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72225/new/

https://reviews.llvm.org/D72225





More information about the llvm-commits mailing list