From patchwork Thu May 18 11:08:01 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: 95787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp408186vqo; Thu, 18 May 2023 04:12:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zFUJOoZhkCJZH7N3VMcQc/L575ZOi9eSektyQCSDqpfF35KKMuOOWympBwlfIGewBTJKU X-Received: by 2002:a17:902:e886:b0:1aa:e30e:29d3 with SMTP id w6-20020a170902e88600b001aae30e29d3mr2795410plg.29.1684408357854; Thu, 18 May 2023 04:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684408357; cv=none; d=google.com; s=arc-20160816; b=jesAeq3z2NUbPyRPu9sAZ5TEVsgtpvmwsC8Ghf1+UK6uxt6LLrmHjHdOpsiYb6j32E mvYcoEkrUdXHccxTS1Hl9yKytUSe/UUAYEB8PpOLXWL1c9QCcs5HFhW0levW/c7N48y4 dbh3iUAlml2L2Vi08JpAn7eH3N4u//YbZYh6Q3NEZs0/S0y2Nuw/a0IFFJxYWABm1Jgm BR/pfsdktcTMM1tAEHS78RFJvh+eEH4ECFrhHTr23kIzkANZWnzWn4Auy9PQvNx0uD7g vaQQPZCOzfP+PsGy+WuztpvfSV2JjbyazA8x9Y6Spc5/VwAB+9S5wJbntmJ8RNi2B/kc MORw== 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=Q1wSTXpmUXEtB4n5FYYFQ1BnbqrVTQgShrk+97Zeuwg=; b=AKhAmDASRB+15FgDjiM4u/VuBFObk6kzupyWN0Fjxfgv4O+gB+KqofuHe2RaXoHL3A C3cuZWtWnPIhyaDpVqbgI5TfIuE+BFh+QOa3se4TrQmM2dLy7vP8N9cQOen1/+WbMdqG HNd72mkeia5JfZJr1m0AT6I7+BXnVkoLixcQBzLOLtzwp2zz2OgBkTR8IDX4jla2hgX9 GsgQRS08MOlch8VDWkjcpwlkIWMP/tEKZK8xeSWf7/4GHOnIelzjmDm+ctT4F0fWfKyZ z1XmXAQEFYl6HB7xevMOGXsRrmbBf3Fw4GS4vFXQ8LMW1dbhyJ7rXFPAQ/tsz5Z6Tj5B q8PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MSYQfZgD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 x19-20020a170902ea9300b001ac47a1578asi1064754plb.232.2023.05.18.04.12.21; Thu, 18 May 2023 04:12:37 -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=MSYQfZgD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S231169AbjERLIo (ORCPT + 99 others); Thu, 18 May 2023 07:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjERLIb (ORCPT ); Thu, 18 May 2023 07:08:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA73F173A; Thu, 18 May 2023 04:08:05 -0700 (PDT) Date: Thu, 18 May 2023 11:08:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684408082; 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=Q1wSTXpmUXEtB4n5FYYFQ1BnbqrVTQgShrk+97Zeuwg=; b=MSYQfZgDe/x1T4pUyK2e5CpS2G78XvwcuZi2Gjcnko9U3oVbJpAsQJQC9wuyK91mvb3eEg IjNH2/g4YdLcGeEXm4/L7p6rppLM/S4Nb7BnPYxNEX0w1EDWerWVugMJKaoivpb6McJyLT HJZJzuXIOjn6/tfmSsP4kJEVd02L9++DmPODwHh4BiekG3SLRUX9A5/PYuIB6KmwZgBi+f 2frqt/AfQSzNCHu5gtmVYHY/8AfFQa/G9Z6/GFK8SC95A96JzS8CSv/vVu0fyXzJVbZVJz gXdPqcHAPC6hmQJ8ZFc8jLnwdGjuiFQ3/0micuWTRqDGci0cqkOLbdutXP1VUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684408082; 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=Q1wSTXpmUXEtB4n5FYYFQ1BnbqrVTQgShrk+97Zeuwg=; b=e5N00Cotzeu6JNWOnJlDGrnuYNm2mJ73/+5Wh4gvN/TQCKtk4saIW9PCipdX3qfd2njHeA T1mY5CMdxMyGm3Bw== 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: Ignore exc_double_fault() __noreturn warnings Cc: Miroslav Benes , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <168440808192.404.1122939902210348216.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?1763553149202187016?= X-GMAIL-MSGID: =?utf-8?q?1766230178206313939?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: 55eeab2a8a11b71586ef0ad3adf532ca5f97d4be Gitweb: https://git.kernel.org/tip/55eeab2a8a11b71586ef0ad3adf532ca5f97d4be Author: Josh Poimboeuf AuthorDate: Tue, 18 Apr 2023 14:27:51 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 16 May 2023 06:31:53 -07:00 objtool: Ignore exc_double_fault() __noreturn warnings This is a hack, but it works for now. Problem is, exc_double_fault() may or may not return, depending on whether CONFIG_X86_ESPFIX64 is set. But objtool has no visibility to the kernel config. "Fix" it by silencing the exc_double_fault() __noreturn warning. This removes the following warning: vmlinux.o: warning: objtool: xenpv_exc_double_fault+0xd: exc_double_fault() is missing a __noreturn annotation Reviewed-by: Miroslav Benes Link: https://lore.kernel.org/r/a45b085071d3a7d049a20f9e78754452336ecbe8.1681853186.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 8d1b422..8dac1e3 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4505,6 +4505,35 @@ static int validate_sls(struct objtool_file *file) return warnings; } +static bool ignore_noreturn_call(struct instruction *insn) +{ + struct symbol *call_dest = insn_call_dest(insn); + + /* + * FIXME: hack, we need a real noreturn solution + * + * Problem is, exc_double_fault() may or may not return, depending on + * whether CONFIG_X86_ESPFIX64 is set. But objtool has no visibility + * to the kernel config. + * + * Other potential ways to fix it: + * + * - have compiler communicate __noreturn functions somehow + * - remove CONFIG_X86_ESPFIX64 + * - read the .config file + * - add a cmdline option + * - create a generic objtool annotation format (vs a bunch of custom + * formats) and annotate it + */ + if (!strcmp(call_dest->name, "exc_double_fault")) { + /* prevent further unreachable warnings for the caller */ + insn->sym->warned = 1; + return true; + } + + return false; +} + static int validate_reachable_instructions(struct objtool_file *file) { struct instruction *insn, *prev_insn; @@ -4521,7 +4550,7 @@ static int validate_reachable_instructions(struct objtool_file *file) prev_insn = prev_insn_same_sec(file, insn); if (prev_insn && prev_insn->dead_end) { call_dest = insn_call_dest(prev_insn); - if (call_dest) { + if (call_dest && !ignore_noreturn_call(prev_insn)) { WARN_INSN(insn, "%s() is missing a __noreturn annotation", call_dest->name); warnings++;