Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1251659rwb; Thu, 1 Dec 2022 14:42:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf69lu4wkpjtVjUgF6h05RhLuvUF87K24qdQO2NSx3GadZUh14jT9wmm8bwC2RTyQ8VHZJ55 X-Received: by 2002:a50:fc8b:0:b0:46b:4b13:e18d with SMTP id f11-20020a50fc8b000000b0046b4b13e18dmr17288012edq.181.1669934548197; Thu, 01 Dec 2022 14:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669934548; cv=none; d=google.com; s=arc-20160816; b=j+uDKTTkzHtq5tVUbQxXPTwJqqWFf2qxSjq+ARr0qP79waPLIOB1J5adQiyHr4jaRg NVIHsaQ/w19ppH4nFKz/Vqmxy15a/CAs4G5MvlAC5GI6RxpLumbXKxv3NUB0izqZyhvW 44SXeAMLYjg0ilNwWFoFduhTF7tAF/qTsu6JZ7BYzXkTU42AmJ7nRTfh5oG2ZlX8meAd 9QkZ3xI4cCwUv0aTXcCi8jsfnsgJ1AUUwHhANzvX/maHroAoJiTzIUHh6rKxd5msX4SR CUI7FyPYE4eAy/dgCnCtnULSeZDQgrOwr0XcJcvveZW+UQJl1yHi2veaN09gHqbuHtHi NeEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3LKMRl+y5ieVJ4OHY9LdrRaOjBF3A1nShUK9ebVb0qA=; b=uYkpd1Y8KS/6c5+2PUxKkjckvxng2N3sSqdM8wZ3HknZ3ZDmxMMFkNdusohZkjlTjP rHnWiW66eptCPLPPDB7YD6ev9yH09UY9ecE/qptMzCnVGddm9ryXg7L90DG+Ab8Htqo5 fxWid0bu3bUb66pyPWQuv3+hsp8+w27JYe/C7YYYsxNiHn/9ypxbB5GCGO2pgf9kp1rj /AnISckCUvcvFX6EOJmeuMFyHTM6Pz8GlgZcMi+F2mu25SEvfdgLpSPnQxosh2RZ6By/ jD0Nf9WlcKZ0uO5+umLyrWFd+uC82VUA5oaC66PIKttu+DKrQcYpZHSFRpdU+8+jK3xV koaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DiwWOZnU; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c25-20020aa7c999000000b00467c3cbab04si4424764edt.66.2022.12.01.14.42.08; Thu, 01 Dec 2022 14:42:28 -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=@kernel.org header.s=k20201202 header.b=DiwWOZnU; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231246AbiLAWaN (ORCPT + 81 others); Thu, 1 Dec 2022 17:30:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbiLAWaJ (ORCPT ); Thu, 1 Dec 2022 17:30:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F677BE68B for ; Thu, 1 Dec 2022 14:30:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C06C62155 for ; Thu, 1 Dec 2022 22:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41235C433D6; Thu, 1 Dec 2022 22:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669933806; bh=crrTc4BB/TtAj4Jcr6fAdCXapLSJT2myUcnrxQqhsxw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DiwWOZnUh01DUktGLOI2LDw3VYpfaUR8WcL8tjRSlOQa1/qDEwnGy62kaOBNwha1Q lgkZMxfiZL/MxjYJ5yuXuCYgDDz80stz2WSEw17airtXhXOxLuscLYvn4jL8JlsJao 4Ph22cLapRGX1f/ap32wVeCuPurh5ZN/jn71wzi8Gmh+BrrrkSoWS0zKcpI8MwaSwj XVl+7xPBbCZyCpFOjztIEFNDc9XyDbHdwUkSaVTRysKKBj/AaN3SS1X3VdIQ+pEsR+ CR7F/swKDHbzPO/NOr000tI3GmglIjg+vfGQTna4symSAgRJkF5XkAm4HV78aIfmZh K/l1lZa2+KBtw== Date: Fri, 2 Dec 2022 07:30:02 +0900 From: Masami Hiramatsu (Google) To: Oleg Nesterov Cc: Andrew Morton , Thomas Gleixner , Denys Vlasenko , Seiji Nishikawa , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] uprobes/x86: allow to probe a "nop" insn with 0x66 prefix Message-Id: <20221202073002.cae85d5ff0c80b1a3b8b67b4@kernel.org> In-Reply-To: <20221201142644.GA27185@redhat.com> References: <20221201142644.GA27185@redhat.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 On Thu, 1 Dec 2022 15:26:44 +0100 Oleg Nesterov wrote: > From: Denys Vlasenko > > 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 > nacks NOP with REP prefix. Looks good to me. Acked-by: Masami Hiramatsu (Google) Thank you! > > Fixes: 250bbd12c2fe ("uprobes/x86: Refuse to attach uprobe to "word-sized" branch insns") > Reported-by: Seiji Nishikawa > Signed-off-by: Oleg Nesterov > --- > 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 b63cf8f7745e..6c07f6daaa22 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; > -- > 2.25.1.362.g51ebf55 > > -- Masami Hiramatsu (Google)