From nobody Mon Feb 9 17:35:55 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4134C04A94 for ; Wed, 5 Jul 2023 06:47:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbjGEGrw (ORCPT ); Wed, 5 Jul 2023 02:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231661AbjGEGrr (ORCPT ); Wed, 5 Jul 2023 02:47:47 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE791700; Tue, 4 Jul 2023 23:47:45 -0700 (PDT) Received: from kwepemi500019.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Qwqrr5468zMqB8; Wed, 5 Jul 2023 14:44:28 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.174) by kwepemi500019.china.huawei.com (7.221.188.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 5 Jul 2023 14:47:41 +0800 From: Li Huafei To: CC: , , , , , , , , , , , , , , , , , , , Subject: [PATCH 5.10 4/9] x86/kprobes: Identify far indirect JMP correctly Date: Wed, 5 Jul 2023 14:46:48 +0800 Message-ID: <20230705064653.226811-5-lihuafei1@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230705064653.226811-1-lihuafei1@huawei.com> References: <20230705064653.226811-1-lihuafei1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.174] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500019.china.huawei.com (7.221.188.117) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Masami Hiramatsu [ Upstream commit a194acd316f93f3435a64de3b37dca2b5a77b338 ] Since Grp5 far indirect JMP is FF "mod 101 r/m", it should be (modrm & 0x38) =3D=3D 0x28, and near indirect JMP is also 0x38 =3D=3D 0x20. So we can mask modrm with 0x30 and check 0x20. This is actually what the original code does, it also doesn't care the last bit. So the result code is same. Thus, I think this is just a cosmetic cleanup. Signed-off-by: Masami Hiramatsu Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/161469873475.49483.13257083019966335137.stg= it@devnote2 Signed-off-by: Li Huafei --- arch/x86/kernel/kprobes/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 40d5c603ce8e..d03baf1f4024 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -478,8 +478,7 @@ static void set_resume_flags(struct kprobe *p, struct i= nsn *insn) p->ainsn.is_call =3D 1; p->ainsn.is_abs_ip =3D 1; break; - } else if (((opcode & 0x31) =3D=3D 0x20) || - ((opcode & 0x31) =3D=3D 0x21)) { + } else if ((opcode & 0x30) =3D=3D 0x20) { /* * jmp near and far, absolute indirect * ip is correct. --=20 2.17.1