From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751896AbeAJUPo (ORCPT + 1 other); Wed, 10 Jan 2018 15:15:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59808 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751062AbeAJUPm (ORCPT ); Wed, 10 Jan 2018 15:15:42 -0500 Date: Wed, 10 Jan 2018 14:15:32 -0600 From: Josh Poimboeuf To: Thomas Gleixner Cc: Linus Torvalds , Borislav Petkov , David Woodhouse , Andi Kleen , the arch/x86 maintainers , Linux Kernel Mailing List , Paul Turner , Andrew Lutomirski , Peter Zijlstra , Tom Lendacky , Tim Chen , Greg Kroah-Hartman , Dave Hansen , Jiri Kosina , Andi Kleen Subject: Re: [PATCH] x86/alternatives: Fix optimize_nops() checking Message-ID: <20180110201532.5jnji6ypfl6slzvb@treble> References: <20180110003139.10531-1-andi@firstfloor.org> <1515568506.22302.72.camel@infradead.org> <1515578735.22302.91.camel@infradead.org> <20180110112815.mgciyf5acwacphkq@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 10 Jan 2018 20:15:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 10, 2018 at 08:55:40PM +0100, Thomas Gleixner wrote: > On Wed, 10 Jan 2018, Linus Torvalds wrote: > > > On Wed, Jan 10, 2018 at 3:28 AM, Borislav Petkov wrote: > > > > > > Make sure we scan all bytes before we decide to optimize the NOPs in > > > there. > > > > Can we also add compile-time checking (presumably in objtool, but who > > knows) that there are no relocations in the alternative section? > > Cc'ing the overlor^Haded objtool wizard > > > Because that was the other "oops, this really doesn't work with > > altinstructions" issue, wasn't it? I think .altinstruction relocations *do* work if they're for the first instruction, and it's a jump or a call. There's some alternatives code which adjusts the jump/call offset in that case, and there are some users of alternatives who rely on that. I think Boris had a patch floating around to add an instruction decoder to alternatives, so you can do a call/jmp anywhere. -- Josh