Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5717921rwb; Mon, 5 Dec 2022 03:12:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf7sC0M0g6y1iyvkfMiXIfzDhOfSVpSkbc/rKlF/CA/pkm5QnDA9aDJnd/0UQLG/47fKkfXX X-Received: by 2002:aa7:9786:0:b0:576:5ffe:7049 with SMTP id o6-20020aa79786000000b005765ffe7049mr14714632pfp.14.1670238727534; Mon, 05 Dec 2022 03:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670238727; cv=none; d=google.com; s=arc-20160816; b=fpJmBRQ9+R1FJAHAqJ3hJE4GbP56kkiHYsFXck42u453YweEmw0eP2HBxLzg7kOdgD RQ6z+7uCsxGqckGeS287E3JktQRlop+raTPVADyHBFpp76FN50nqDSZP8bQ/KeyCRUPk 8B22KRkH84D0uLcjS8lBMhHszgvQzREnWEPeSPK2AqJAaUa2hLglGLhvpeQpM4bfcjMh VM52O02n1UNaJ8IugjDuNp+Bvh7UbG4gGRJ138dC9YTwbBKRHmh/Vf+HtZkSD+jTqkwZ J5VW+yH/+A4F5dVSY5AkNCq/BRYQxwxEuALXMNr49R16blHMPta3I/2BTQFTmJCCC+wp +iBg== 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 header.s=2020e header.b=Pld4Gmg7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl7-20020a17090b384700b00218d51d0c92si15295269pjb.184.2022.12.05.03.11.56; Mon, 05 Dec 2022 03:12:07 -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 header.s=2020e header.b=Pld4Gmg7; 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 + 82 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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;