From patchwork Thu Jan 25 18:21:34 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: 192236 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp171754dyb; Thu, 25 Jan 2024 10:28:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlxSq1LCzk6Wn6jOAGTzOyInw/a95MI4dTbbTUMGvDd966l85bCA9To57QwAfLgKNN2rVd X-Received: by 2002:a17:906:394:b0:a2b:11f2:eee with SMTP id b20-20020a170906039400b00a2b11f20eeemr3866eja.87.1706207324795; Thu, 25 Jan 2024 10:28:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706207324; cv=pass; d=google.com; s=arc-20160816; b=q6GtrD7XqiOkGhDBIKfkHVLEluPeFQrwLsAjFgxeqHGe5VuGmi8PnjuDqXQpWvhIEs uNasv3JaAuvGOkwrJIfojl31kP4PQ9zSAOhOiGH4u16lTBRyRIgJX1HEdxz+U/QPrCtr 8TyCQpXkb4+0Re/2FQyJ4lTcnOfAbC73cdtfft/UoMb2kW0r9ZqXbd+cwrBdJ2imoWuw nLE/1Gi723UHF98cXuoHoWlD6n8HFMFQwTTsDx8ugH6U3WD4OtgU08OoSK+mshyZoGls FItqWv7YozrJ5/P65Mvv84LwTrFa9yzS1NRO7u51BfW465Xo9mhipWVMCvc5neFiKIVt q17g== 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=WAns/H3cdr5O84K7fAoURzvtY40Ehfid4EFVStwf8qs=; fh=U/Hd0cPmVpmsXI9UC370Q88/l4pozXEkKxB1Pi0MTn0=; b=L7rrd/9P7Z5HAQOvNwiUgPQgN+igJdJZYdPLCN9XMyowtH3sE4BT8qQ9WVDOxBWdYw yX4Ga5S9ShHUGckbD+n+A1bcW7Ksx5ye0raexA6xfX6ikQaxqdKteMmSVKZvA1Ymz6N6 swow2V98oKJg1Zbc5Hjr8V6sbehyipvlCIwQ4ucxj3JTkPF1ge1pETWnzBx2X6tZlmmf A+43SpOAgMl9qi4JW84mHvb4sh+2RXML7Cm7Cy+uPPp+MW4ET+s0SThjOso5TQxqQ5jB M46JnL3reTQklkWd4yXRBWeDZx59nC00xjrzdRC40UL/y9ieGtufLDfITYXAUzgmUlhg IDLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cSfjDHE1; 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-39106-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39106-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f10-20020a170906560a00b00a2d481455c2si1144217ejq.607.2024.01.25.10.28.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:28:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39106-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cSfjDHE1; 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-39106-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39106-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6AA821F22E6E for ; Thu, 25 Jan 2024 18:28:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 132E514198E; Thu, 25 Jan 2024 18:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cSfjDHE1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cC9wotL/" 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 72BA613B786; Thu, 25 Jan 2024 18:21:36 +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=1706206898; cv=none; b=G13u98RU2KCeCa1hNHbw2mVY0tr1VHqYfBd8Zq4t625z2yrosZGGhf99FXpr7f8flQtQFkHRQRg/qdaDAx6ihZg846wGCmOO7wUAidD135WPqaf+zoDXLeHYVLto65Ze+yQveaDZgxWaK9FPc56doL+zFJGn5ubAxYTI+j2SVao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706206898; c=relaxed/simple; bh=/aaKbGn19uI0EKDnx/0AbnQIYzj5YEJT7IeUUVLhT2U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=AqY9+HgYtm/jRi9k1hkRjATO2nL9GhKh/38PtfgLCKvEOnT2iCZ/s1xlgHw0c9jZioLoszB+jjLU1ws3URGos01p6/V8RFtNsCF44xAGP/gfx6adlDxisaee+vrnM5mWeZ5YxZPxhEiF+z50S5agajYMEDokj65hKRqyhre2u6Y= 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=cSfjDHE1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cC9wotL/; 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: Thu, 25 Jan 2024 18:21:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706206894; 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=WAns/H3cdr5O84K7fAoURzvtY40Ehfid4EFVStwf8qs=; b=cSfjDHE1JqHdZOCmzJFi8oRxKiRzXAzGDK7qAq3U9Qpk/sztIkiZXoA8ZmQTXwwFe8Ea6y 07HUUL/7xXy5McDC2zZZq9nXSjJxiRBg9T3hzjU4gj+8Yv8MlbmAUZ65GKsHBMBhvYXVGH oCA4Heata1xZk4R+S8ZLpY9STkdJ1KX4vbf0cmxQ+lZ/QwDmI33AlBGnIIParAg0/62xR6 uyjaoAXom1Ygo/JFoNpS8l51AUfFLb7xTtVfdg9mH/dZVEdb0ajdaFizTpgnHsqn/GwBrd DmWf8eMZQLCE0/uhgh3UuWPTvzxrrYM/bVSH75Dd01kW7PXJMoJRr0ZsPcHffQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706206894; 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=WAns/H3cdr5O84K7fAoURzvtY40Ehfid4EFVStwf8qs=; b=cC9wotL/QnYmII0LAHIIW/362bxawSdqTBcQGwbevp21PEP1EFc9oUNaxeXWk3sVbl7FPy NKY0pbqdcbQ2ehCA== 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: <170620689420.398.17722955062117352928.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: 1789088052127631723 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 12c4be1f0ed9bcdc2f2f578f6101e6f4af2ee039 Gitweb: https://git.kernel.org/tip/12c4be1f0ed9bcdc2f2f578f6101e6f4af2ee039 Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:49:59 -08:00 Committer: Thomas Gleixner CommitterDate: Thu, 25 Jan 2024 19:10:30 +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;