From patchwork Wed Jan 31 07:21:27 2024 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: 194559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1723797dyb; Tue, 30 Jan 2024 23:27:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IE57SHXASj+ee6ckDXfhXwaYJon/YVXRQQxJg+pkK6Qjjsr9uQmyjuKUSxSIQ95J5C626Dp X-Received: by 2002:a17:902:ee8c:b0:1d8:ce58:f4ad with SMTP id a12-20020a170902ee8c00b001d8ce58f4admr932300pld.1.1706686069692; Tue, 30 Jan 2024 23:27:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706686069; cv=pass; d=google.com; s=arc-20160816; b=eb0HNvW+JwwP81vqOdfvc+C5YlMuhMMs7tvTPijaBlbKaFqeuZfxKn9lWP/Cl87IYB K3o+YbIBvmkZGTpkMqbuqFy47rts5zbobltZm5Q+esBo0u8O5u8FGLhTXuUxwmgw33S2 8KxUOyWNPkraeK6/9Hk/MBsfOe6ymjYjXKqDJjOKHyC651nx91Nb4KZVE5CSYKDRtWfD Zef9JM1H75zf955dB6UICBZ4pwf1f90Z1ECR/9+WYfB+pc/ImPQDokfZ+ayWouEskI2G 2s24cj0GFKx2njr7ZvzDazIICDh5n9c5v2c7z+XWvBaI52J15j/nmhRp8G89m/dRh8kA Phsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=RYzIsKm6GzAF4BoeOIcGPmmIIBHYHiI9kmLDjdSJtwU=; fh=CROEB6pO7Fu1tSursTs/58IkPaEpIVHsjw8cK/B4Mzs=; b=d3Vo5rRSfUp19aG765PooLhRMnv8/Q36n3mhN2F46lQ7J9eCqkZDo5U/wBHewc9muB 7+0rxrdQrN2sppDCFIcJGh36fuUAx8i7kQY5huexwvcQpjr86GeEXDH8Apf12q2tvzQw gSJotl36hF/XSSgj1xYNePviXOVSmnQe96gYhf2H632rP8hG02YoRp0WijSIMlkvJVlQ gTWVvOCtK/Eq1vB0cAgSW9q1T0FDR7CgmPqToaSfHg9fznraMu3LA1EbDpvNUOThkGID 8AlaTn/B+uRPCyICHLQBbUrcMM/NPP8Fcum72YS61/LW8SNhXIpVxEAPjVUb/GkLOAM+ gPuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1q2Tt87w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45915-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45915-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCUdNBEzBAo4X8s7v1EjVQdub7nPvoyUeCbcAkGOJXEZXd3vmZJn7OdJjb89s+afa1tSGxnEGsM2IoW2G/05XfQ0Uw8LjQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c9-20020a170902d48900b001d923684328si1459448plg.115.2024.01.30.23.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:27:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45915-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1q2Tt87w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45915-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45915-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 543952835B7 for ; Wed, 31 Jan 2024 07:27:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FC7B82892; Wed, 31 Jan 2024 07:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1q2Tt87w"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0j3DzY//" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61E767D41D; Wed, 31 Jan 2024 07:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685691; cv=none; b=pDkgrRmhdUKKln5FLl9jiXxGlNJ6x0hZwkRNxg58v1VPt8ySzb522O3Sq19hVsqjOwN/wc3wFVPnoGUDrc430sqsjlL+oitHOu3iiF7N2SENHK9T7ooNlJgMFLsM9ZAzmNT93f5Jq4H4sGRywrVR02Gi3o5v0sJRvfZp2qONoWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685691; c=relaxed/simple; bh=9K75qWrjl6fWNtI122ummM3PWcbH5thnyEjoCILfuwA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=iFzGTVQ+28S6Nmi20PMhb8tY/Xngf2etQ4elV9dJv/F6eur6uo5BcpmQzievUjswUl1U64c1JZvSWdiga8jKQzkRwfqL6oy9PcYId59n5f4fjcwjVy8JMt8OpIm37k0+wZZJS5pOslNUM2/F2XoTNjyaMvI5cUVt3EFCEuR0luY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1q2Tt87w; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0j3DzY//; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 31 Jan 2024 07:21:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706685688; 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=RYzIsKm6GzAF4BoeOIcGPmmIIBHYHiI9kmLDjdSJtwU=; b=1q2Tt87w/+CHJsUbsECj9Dm7TSUXd+73vjnbi44K/drhYvhMY650qJcm7HUeDGkcbvqWoC 2tyMmyv4cUi3QpviXwySvXKDUsUhR8TCmdjppyUFIWeywYWu0O7dl0aUJlV+gGt8UKiRcu fMecEVpYtDjRLxyPLjCuClmtCHfe2jmbsyIbf+32xUAwTM4knSUnk5enlqHlK8zhF1YFek uxsuEeGcG9nHFpgXPVp6ej5OoZfs9LUywqaB4Ao+n5YAvNCowkCqWaNNDBl+Y6ladRwEW7 rQKkx8hD2fUXznszompQDDDcUKNavl4VDRuyydu6GCfPGSI9VbAZv1am0pUbWA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706685688; 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=RYzIsKm6GzAF4BoeOIcGPmmIIBHYHiI9kmLDjdSJtwU=; b=0j3DzY//yetjbwtIluDYI9MWvQq4Emj+AYsR+e3dbrpexCfqryE/rGgyq0k1GPaqjusff9 HsKJnaH/onmsAhCA== From: "tip-bot2 for H. Peter Anvin (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] x86/objtool: Teach objtool about ERET[US] Cc: "H. Peter Anvin (Intel)" , Xin Li , Thomas Gleixner , Shan Kang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-11-xin3.li@intel.com> References: <20231205105030.8698-11-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170668568727.398.15964471096297288131.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440761944610163 X-GMAIL-MSGID: 1789590052186687610 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 379ae086a73c804df39866d28eb4ce693e7af486 Gitweb: https://git.kernel.org/tip/379ae086a73c804df39866d28eb4ce693e7af486 Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:49:59 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 18:20:34 +01:00 x86/objtool: Teach objtool about ERET[US] Update the objtool decoder to know about the ERET[US] instructions (type INSN_CONTEXT_SWITCH). Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li Signed-off-by: Thomas Gleixner Tested-by: Shan Kang Link: https://lore.kernel.org/r/20231205105030.8698-11-xin3.li@intel.com --- tools/objtool/arch/x86/decode.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c index e327cd8..3a1d80a 100644 --- a/tools/objtool/arch/x86/decode.c +++ b/tools/objtool/arch/x86/decode.c @@ -509,11 +509,20 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec if (op2 == 0x01) { - if (modrm == 0xca) - insn->type = INSN_CLAC; - else if (modrm == 0xcb) - insn->type = INSN_STAC; - + switch (insn_last_prefix_id(&ins)) { + case INAT_PFX_REPE: + case INAT_PFX_REPNE: + if (modrm == 0xca) + /* eretu/erets */ + insn->type = INSN_CONTEXT_SWITCH; + break; + default: + if (modrm == 0xca) + insn->type = INSN_CLAC; + else if (modrm == 0xcb) + insn->type = INSN_STAC; + break; + } } else if (op2 >= 0x80 && op2 <= 0x8f) { insn->type = INSN_JUMP_CONDITIONAL;