From patchwork Fri Apr 14 14:47:53 2023 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: 83465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp378359rwl; Fri, 14 Apr 2023 07:55:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ZinnpBSZ2iKwDFDwuXCjgsAL2UGIrICgVIJoRKylTNS3LRK1KlIlilnYptNfE37BPxdWEY X-Received: by 2002:a05:6a00:2314:b0:623:8592:75c4 with SMTP id h20-20020a056a00231400b00623859275c4mr8899172pfh.29.1681484142448; Fri, 14 Apr 2023 07:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681484142; cv=none; d=google.com; s=arc-20160816; b=iUQr29kL+T5U5VBqQC6RI7Ho89FMMWoDlePS8O01p03yPv1EJt5U3CQ3PDCQhw7an4 yip7pv/ISifywZH1+2cxsVK0Pa+JwQePGFxWOt81j4kbgzAK3krqdn/FM/fuuQkvCukZ 8Ncy05hOJUoB1qQlZtiYp/Fw0qBaw0tbLQcsNW+mM9MYtQKhXNQbWksXA5VLU+ERCoSf ebrnGYbms1d5g4OMP7gghEtIxU9WA2yDqYyfQj8LCX88eGuefLlUGvGvU+kUFbN7L8m6 cnY3753pTMV+VgtAkbkFqlbuXrArBbYNChqFc7j19J/ECJMPD/B8WD8p4HqP4so7Q/ZU eG3w== 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=Vx2tQ9V501hMgE+B9bKTly7ITMMu1r81FFJ9D0d/AY4=; b=kNgMiGtS76FrDLcYEoouzy6yZZ6anm+C6T3/67xsnv9wM3mRO1JZcX/eY8rRJWw3f6 YYJkol1GRbHP857Y4e9kTLuMr+mtD+N1OnHXCs1CHrezmz34BQt/OpGTgQzEUcE7VFcv ul4zi/+BqrDoPLgIQxehbo+mYHVA2VHF636PYPkEdslZjQsoMWcpcm5uYYaqtjC+djvO CscqxYLn2dhR3k7cvGV/9IboJU32uWTGpCXEA9Wwryas/nhkAC7hw5b1dA0Cat92XMm+ 1yGGraK5zQpR//g4Eo1TlMVifRQ8vcpjYkamewlEUAwmdDDX7Vl2P5hiPNsDhB92UFfN 9dGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rXfoSBAh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hhyocZy1; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020aa79d02000000b0063b00e84755si4334088pfp.342.2023.04.14.07.55.29; Fri, 14 Apr 2023 07:55:42 -0700 (PDT) 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=rXfoSBAh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hhyocZy1; 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 S230185AbjDNOsC (ORCPT + 99 others); Fri, 14 Apr 2023 10:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231147AbjDNOr6 (ORCPT ); Fri, 14 Apr 2023 10:47:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501FD7DB6; Fri, 14 Apr 2023 07:47:56 -0700 (PDT) Date: Fri, 14 Apr 2023 14:47:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681483674; 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=Vx2tQ9V501hMgE+B9bKTly7ITMMu1r81FFJ9D0d/AY4=; b=rXfoSBAh+9zOO0O7ORnXvFEHPbqdso/LrrBW7cPQkPvoNGmcUlU4kh7yUOUJTcrmsyua8o PcsrX8xAhe3fVn1xbJMTNDt4Flz6Jg5QN5ra7c895tj2nvE/OZcmn223nNUa4n+Sqc6dc6 rX3Ru5dAEH+xVw4Ou8Ifi7rJrr8YWNRTtoMOep4QCxyM2vxN2byaFKQnLxzEcin5tgoa4r IWCu4hzMwlFgq1ChaPX8YETt24tAkOUlSyWoa8yV79oFWjgpAibDo2zlqpQIMmu2TEJqj7 J8oGN2tk+JHCDgrXDpqBX+pb7COjMB+B4D5pvWAEIbrP2DUamz2gvMJYOgkpQQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681483674; 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=Vx2tQ9V501hMgE+B9bKTly7ITMMu1r81FFJ9D0d/AY4=; b=hhyocZy1ce+CkY7npJa9xl4C45iTO0tbA+bkeTxA99vc4gHZA+0KoafuPjW+3+GLCw18E6 c/dkIwJnzd3HxyAA== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Generate ORC data for __pfx code Cc: Josh Poimboeuf , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <168148367374.404.8240503217919092997.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763003689658234902?= X-GMAIL-MSGID: =?utf-8?q?1763163915773286107?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: 5743654f5e2ebd56df99f56fca5ba4b23fe3c815 Gitweb: https://git.kernel.org/tip/5743654f5e2ebd56df99f56fca5ba4b23fe3c815 Author: Josh Poimboeuf AuthorDate: Wed, 12 Apr 2023 13:26:15 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 14 Apr 2023 16:08:30 +02:00 objtool: Generate ORC data for __pfx code Allow unwinding from prefix code by copying the CFI from the starting instruction of the corresponding function. Even when the NOPs are replaced, they're still stack-invariant instructions so the same ORC entry can be reused everywhere. Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/bc3344e51f3e87102f1301a0be0f72a7689ea4a4.1681331135.git.jpoimboe@kernel.org --- tools/objtool/check.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 8ee4d51..df634da 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4117,6 +4117,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio static int add_prefix_symbol(struct objtool_file *file, struct symbol *func) { struct instruction *insn, *prev; + struct cfi_state *cfi; insn = find_insn(file, func->sec, func->offset); if (!insn) @@ -4145,6 +4146,19 @@ static int add_prefix_symbol(struct objtool_file *file, struct symbol *func) if (!prev) return -1; + if (!insn->cfi) { + /* + * This can happen if stack validation isn't enabled or the + * function is annotated with STACK_FRAME_NON_STANDARD. + */ + return 0; + } + + /* Propagate insn->cfi to the prefix code */ + cfi = cfi_hash_find_or_add(insn->cfi); + for (; prev != insn; prev = next_insn_same_sec(file, prev)) + prev->cfi = cfi; + return 0; }