[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c6762fe-5cbe-42ed-ac4e-a7144b8ef7ad@zytor.com>
Date: Fri, 11 May 2018 11:53:40 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: David Laight <David.Laight@...LAB.COM>,
"'Alexey Dobriyan'" <adobriyan@...il.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH] x86: pad assembly functions with INT3
On 05/10/18 09:39, David Laight wrote:
> From: Alexey Dobriyan
>> Sent: 07 May 2018 22:38
>>
>> Use INT3 instead of NOP. All that padding between functions is
>> an illegal area, no legitimate code should jump into it.
>>
>> I've checked x86_64 allyesconfig disassembly, all changes looks sane:
>> INT3 is only used after RET or unconditional JMP.
>
> I thought there was a performance penalty (on at least some cpu)
> depending on the number of and the actual instructions used for padding.
>
> I believe that is why gcc generates a small number of very long 'nop'
> instructions when padding code.
>
There is a performance penalty for using NOP instructions *in the
fallthrough case.* In the case where the padding is never supposed to
be executed, which is what we're talking about here, it is irrelevant.
I thought I had filed a gcc enhancement request, but I can't find it
now, so I just filed this:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85751
-hpa
Powered by blists - more mailing lists