From patchwork Mon Dec 5 10:59:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 29638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2179563wrr; Mon, 5 Dec 2022 03:00:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ToVCVGFDHhvBiSmualcBZfmEgQf/d+wacCEgw0iXmdifTrGO3iBcCqkTuTWy63TYniVGo X-Received: by 2002:a17:902:d38c:b0:188:4c74:e1f1 with SMTP id e12-20020a170902d38c00b001884c74e1f1mr64776095pld.98.1670238040826; Mon, 05 Dec 2022 03:00:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670238040; cv=none; d=google.com; s=arc-20160816; b=FwGLcaUeYwKoTJUUr4oK5eFR9sc27Rhpu2g4HHPiU4m+wTXAYfgzoSgrGMDQupKPBI NOAcPOYkXBEBMzDcG7ZtmcOgdrRmRWLygZIhG4g/AJR1jyog5f9sjwQbcHOSTF8NrJQm VcTLsgcQ4yVkIMkq8KcJM+eecHNSZqHQd9vHMZVQyCWY+D/VuS4EaIANq1vs3ZnoZSR7 3xj4jwBTdRNs/gH2QCzF6FnsgHd11XsUzDVPYn+Gn9E62xcZQ01Mks6fTDpMxqTunjHW /9bnFODipLo6mfaVE3l05VHPbH95q78sJhmd7FE5Lr51670cBfWzqCOh6hZ3n/Y/sRTY AL7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=hvAvPykNMRYlrbzOwQu7gWUpRqhoBIZ03TOr0pZ9ZRI=; b=Pl4dQYosuF9JhSZZWSS13UTPXIVH8bKO5lDaOm+qheyVVa83ah2Oy8iN3mZsiyBMKV ZFn+98xTtYfH77CckAZpQIV69i51kuEPDITIPbiVyNfOLI8mjf4FkKGPpLGkVkXDYknm Xb8sNqggrbaY4w+cKKvr+jgaAc/y+7qWLpNKWkFwpqzayoqWj06doQ4LlQFcAPLely+F 4pjyfRzkpC06XTq07Wq2dVmn/ltfHtZmNTD6UOe3TARYjJYeWxaAU8wW9gPghlg/dfxv R3VXJDC3ipSGnfgmL0YMzbIIpZcNDI+j+uWfVCOz5UnCvME4XXAdP9UglxllrC1hHCcJ 6DLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mkRei7Hn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b00478add2c2a6si4328198pgk.653.2022.12.05.03.00.27; Mon, 05 Dec 2022 03:00:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mkRei7Hn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbiLEK72 (ORCPT + 99 others); Mon, 5 Dec 2022 05:59:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiLEK7Y (ORCPT ); Mon, 5 Dec 2022 05:59:24 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD56DDF9B; Mon, 5 Dec 2022 02:59:23 -0800 (PST) Date: Mon, 05 Dec 2022 10:59:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670237962; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hvAvPykNMRYlrbzOwQu7gWUpRqhoBIZ03TOr0pZ9ZRI=; b=mkRei7HnxmV7UMGuVNhSuHv9j6HB3wf9OkOu+4yZEKFFiRga1zth/EHHFlyUtOmbhD24MN g5NKOZN9S/wg0C2N6TqDj0wz1idGmNcsFAJeOTo+tN/nPnSrKuHEcdFE9nexPtAtf0fTQv a3tpylOZ3XuqPgXBoXR/9+y17h7a9C3TxFTIQGyIqOxa/uWyC5QVdlt1heIMFDq5b1g7wi CJfqbY7urJ9iJsY826oDY5E4wNRWr1PPjkk5B6LmfEY02eQsaVk14iYgOT0aRgX+aEDO5l 13C/iTPwoWYdxqq8/0Uwp9O1bujhxH7QwmOtvtDRvLEsbV1xUn3lAwR2ikRJPg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670237962; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hvAvPykNMRYlrbzOwQu7gWUpRqhoBIZ03TOr0pZ9ZRI=; b=Pld4Gmg78gPryYe0JPDmhdQ8FkOEQnocOyZ2BGVCLB8U98cAq5Bx4cKoMsOxHEVbg1KF7A nvdl4F6bP3ZX4nCQ== From: "tip-bot2 for Oleg Nesterov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix Cc: Seiji Nishikawa , Denys Vlasenko , Oleg Nesterov , Thomas Gleixner , "Masami Hiramatsu (Google)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221204173933.GA31544@redhat.com> References: <20221204173933.GA31544@redhat.com> MIME-Version: 1.0 Message-ID: <167023796182.4906.2250449121984358359.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751371523955609181?= X-GMAIL-MSGID: =?utf-8?q?1751371523955609181?= The following commit has been merged into the x86/urgent branch of tip: Commit-ID: cefa72129e45313655d53a065b8055aaeb01a0c9 Gitweb: https://git.kernel.org/tip/cefa72129e45313655d53a065b8055aaeb01a0c9 Author: Oleg Nesterov AuthorDate: Sun, 04 Dec 2022 18:39:33 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 11:55:18 +01:00 uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix Intel ICC -hotpatch inserts 2-byte "0x66 0x90" NOP at the start of each function to reserve extra space for hot-patching, and currently it is not possible to probe these functions because branch_setup_xol_ops() wrongly rejects NOP with REP prefix as it treats them like word-sized branch instructions. Fixes: 250bbd12c2fe ("uprobes/x86: Refuse to attach uprobe to "word-sized" branch insns") Reported-by: Seiji Nishikawa Suggested-by: Denys Vlasenko Signed-off-by: Oleg Nesterov Signed-off-by: Thomas Gleixner Acked-by: Masami Hiramatsu (Google) Link: https://lore.kernel.org/r/20221204173933.GA31544@redhat.com --- arch/x86/kernel/uprobes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index b63cf8f..6c07f6d 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -722,8 +722,9 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) switch (opc1) { case 0xeb: /* jmp 8 */ case 0xe9: /* jmp 32 */ - case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */ break; + case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */ + goto setup; case 0xe8: /* call relative */ branch_clear_offset(auprobe, insn); @@ -753,6 +754,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) return -ENOTSUPP; } +setup: auprobe->branch.opc1 = opc1; auprobe->branch.ilen = insn->length; auprobe->branch.offs = insn->immediate.value;