Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3422105ybi; Mon, 10 Jun 2019 10:00:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwX1AFXUn7tTbTgR1ZlHN9bCmAAPymmGJjpL3ENaMYmwouScPBsmjXAjjZ+jtJq4rZ7Nopu X-Received: by 2002:a17:902:b947:: with SMTP id h7mr28411988pls.267.1560186038524; Mon, 10 Jun 2019 10:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186038; cv=none; d=google.com; s=arc-20160816; b=vQ4WohAde+lPyN7+7RwMRByB0u87v7gnfqZqArOu64FcfUFbpZXgIaKzCTcE7i+R3+ ONzLuWKK/XYXWMYCLqwcXpiuxY4Vb7wNCCZI1r159wKDmdJloQgut5y4Ve2UIExk/r1d G7J3bRa5g/1elBtSLVBXbDXVAnL7mjcQlKZ4UItPDEpOeB9yw7ugQfpB3ulW7G4thCWe z5Ak1XkleVk7ZodJ5N0X1Ooh86by4bgSVjJxgMLdBn76cafR4ESIDWMCs4vWqX399u/f K/dki0xHlANHkU0tOWjgAQNjuCjCuM6wk9eC2SWv1TZWjkWXz64JUwH+V5kfGd/4o6ME 4Btw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OEJ0SexlKfmiE6Q7MO4okPhzMbdTfdVrHSL9h88yDFs=; b=CNPUmU5F0jwX+jodOdX4RoGCSUQS/ZzmRvgQmsgPMYpA70qaWpndXsGqAN9rdk4Si0 UKZZfs25+iW1riUdoRiwmWETONcKDKThlEK8g6mLtoYUNi8mcPu1MGE4nxkzmopKGru1 RjaWdqYtQexmnNOvt7DCv8MGkzlTgwewE13N6+l4OKKIm28KLI7giJzEX7igGCT8iyaY 2qgKtlTXgo4/csefi0UDTy17BJ5ocyj12ZB38kF0VCCskmWdCjcxwhfPizSit7/k9ICg msLd46AoFF+AFmznhZ9XpA3ubXh5oQ3BMleDb35s71ciAoC2nX93k0oWSxh9zEVY5+kT t1gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si10207336pgh.474.2019.06.10.10.00.22; Mon, 10 Jun 2019 10:00:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387709AbfFJQ6W (ORCPT + 99 others); Mon, 10 Jun 2019 12:58:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39776 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727648AbfFJQ6W (ORCPT ); Mon, 10 Jun 2019 12:58:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C12E4307D941; Mon, 10 Jun 2019 16:58:04 +0000 (UTC) Received: from treble (ovpn-121-189.rdu2.redhat.com [10.10.121.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28A36600CD; Mon, 10 Jun 2019 16:57:55 +0000 (UTC) Date: Mon, 10 Jun 2019 11:57:52 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Nadav Amit , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Subject: Re: [PATCH 08/15] x86/alternatives: Teach text_poke_bp() to emulate instructions Message-ID: <20190610165752.2feozekuqbincj3d@treble> References: <20190605130753.327195108@infradead.org> <20190605131945.005681046@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190605131945.005681046@infradead.org> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Jun 2019 16:58:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 05, 2019 at 03:08:01PM +0200, Peter Zijlstra wrote: > In preparation for static_call support, teach text_poke_bp() to > emulate instructions, including CALL. > > The current text_poke_bp() takes a @handler argument which is used as > a jump target when the temporary INT3 is hit by a different CPU. > > When patching CALL instructions, this doesn't work because we'd miss > the PUSH of the return address. Instead, teach poke_int3_handler() to > emulate an instruction, typically the instruction we're patching in. > > This fits almost all text_poke_bp() users, except > arch_unoptimize_kprobe() which restores random text, and for that site > we have to build an explicit emulate instruction. > > Cc: Daniel Bristot de Oliveira > Cc: Nadav Amit > Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Josh Poimboeuf -- Josh