Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752839AbeAJUz7 (ORCPT + 1 other); Wed, 10 Jan 2018 15:55:59 -0500 Received: from mail.skyhub.de ([5.9.137.197]:54164 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbeAJUz5 (ORCPT ); Wed, 10 Jan 2018 15:55:57 -0500 Date: Wed, 10 Jan 2018 21:55:44 +0100 From: Borislav Petkov To: Linus Torvalds Cc: Josh Poimboeuf , Thomas Gleixner , 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: <20180110205544.k2e534nkk27lkpjc@pd.tnic> References: <20180110003139.10531-1-andi@firstfloor.org> <1515568506.22302.72.camel@infradead.org> <1515578735.22302.91.camel@infradead.org> <20180110112815.mgciyf5acwacphkq@pd.tnic> <20180110201532.5jnji6ypfl6slzvb@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) 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 12:26:25PM -0800, Linus Torvalds wrote: > > I think Boris had a patch floating around to add an instruction decoder > > to alternatives, so you can do a call/jmp anywhere. > > .. and no, we're not doing that. Christ. > > People, we need to try to be *robust* here. That's doubly (triply!) > true of things like altinstructions where people - very much by design > - won't even *test* the alternatives very much, because very much by > design the altinstructions are only used on certain architectures or > in certain situations. Ok, so the problem was: how to fixup jumps which are not the first instruction which is being replaced but a following one in the instruction bytes with which we replace. I used the insn decoder to get insn boundaries so that I can know whether bytes 0xeb or 0xe9 are the actual JMP opcode and not some other bytes from the stream. So how do you suggest I do that without the decoder? I still need some sort of parsing to find out where the boundaries are... Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.