From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B2C292066D3 for ; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980569; cv=none; b=faiuIAI73XHHEce4RCPZcsgv4oIMpEAkpavCWrrsEOvR0q0Q2aZ4lkA+qUJIxyTWk0Fi50JMAseLWn0GYR1hWEl2+EaFXi1quowhXd2k5qQCTGM86WbaQ/K93oJn6tjwvCgwGc+8aVfwBYjVUfdvdZBfEH82mWn3jkq5NY8uoXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980569; c=relaxed/simple; bh=hYgMEAw5PslVkJ+AsTy0iKOBz7QcQIybK/ajB1gRwYU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t5ZR1zuzw7ItUpBk/547BCWvJKT4Be2gFvhc6d38d1z925p9NThRgTay1wMX7rtDysOg58It1dLY7XWaleiwptaSAp0VVxhRpPeu83kI3nLOYPEXqIIPEt7PrvCdcfunURLdrNoG+nsB4fBCxkwSlUbDKdf0nVBOc0LIlZeilnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vO2Gv+dq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vO2Gv+dq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B824EC4AF54; Fri, 14 Mar 2025 19:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980569; bh=hYgMEAw5PslVkJ+AsTy0iKOBz7QcQIybK/ajB1gRwYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vO2Gv+dqJcgTOdhfxNDT5TmgwVkxozC8FpRDZeWV8z32xkI+o7nkn7H41AXcRp8ij 4gcdkHwi4rNHJLLMmWXBoDQM36s4GmvfGl3YZ6+gxvmVCw5b8YKfY2aEc0t/XzjqO+ Oc7GEwzQdXnjSYPGpC+Od0sqbwRE9x5lIKhMJT1GH87Yf9oNcCS+TrJ23PkOU4rsAY sSUeZc6qKyDMRDaRf7hW6Sw+TNF/CIdOj1aCQGJU3vsqZnfwWOCe2KQXsmOkyzrpkU 3MTz5fedwxmnunXDDthl8yO6f+6T3iJWlI0enx8joGEEMRqDzfHJ3T+WTQR6jH8Mq1 qlr5VTMD0hfLg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 01/13] x86/traps: Make exc_double_fault() consistently noreturn Date: Fri, 14 Mar 2025 12:28:59 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The CONFIG_X86_ESPFIX64 version of exc_double_fault() can return to its caller, but the !CONFIG_X86_ESPFIX64 version never does. In the latter case the compiler and/or objtool may consider it to be implicitly noreturn. However, due to the currently inflexible way objtool detects noreturns, a function's noreturn status needs to be consistent across configs. The current workaround for this issue is to suppress unreachable warnings for exc_double_fault()'s callers. Unfortunately that can result in ORC coverage gaps and potentially worse issues like inert static calls and silently disabled CPU mitigations. Instead, prevent exc_double_fault() from ever being implicitly marked noreturn by forcing a return behind a never-taken conditional. Until a more integrated noreturn detection method exists, this is likely the least objectionable workaround. Fixes: 55eeab2a8a11 ("objtool: Ignore exc_double_fault() __noreturn warning= s") Signed-off-by: Josh Poimboeuf Reviewed-by: Brendan Jackman Reviewed-by: Miroslav Benes --- arch/x86/kernel/traps.c | 18 +++++++++++++++++- tools/objtool/check.c | 31 +------------------------------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index f4263cb3d21e..9f88b8a78e50 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -461,6 +461,21 @@ __visible void __noreturn handle_stack_overflow(struct= pt_regs *regs, } #endif =20 +/* + * Prevent the compiler and/or objtool from marking the !CONFIG_X86_ESPFIX= 64 + * version of exc_double_fault() as noreturn. Otherwise the noreturn mism= atch + * between configs triggers objtool warnings. + * + * This is a temporary hack until we have compiler or plugin support for + * annotating noreturns. + */ +#ifdef CONFIG_X86_ESPFIX64 +#define always_true() true +#else +bool always_true(void); +bool __weak always_true(void) { return true; } +#endif + /* * Runs on an IST stack for x86_64 and on a special task stack for x86_32. * @@ -596,7 +611,8 @@ DEFINE_IDTENTRY_DF(exc_double_fault) =20 pr_emerg("PANIC: double fault, error_code: 0x%lx\n", error_code); die("double fault", regs, error_code); - panic("Machine halted."); + if (always_true()) + panic("Machine halted."); instrumentation_end(); } =20 diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 814d40724069..3a3a1a905199 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4441,35 +4441,6 @@ static int validate_sls(struct objtool_file *file) return warnings; } =20 -static bool ignore_noreturn_call(struct instruction *insn) -{ - struct symbol *call_dest =3D 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 =3D 1; - return true; - } - - return false; -} - static int validate_reachable_instructions(struct objtool_file *file) { struct instruction *insn, *prev_insn; @@ -4486,7 +4457,7 @@ static int validate_reachable_instructions(struct obj= tool_file *file) prev_insn =3D prev_insn_same_sec(file, insn); if (prev_insn && prev_insn->dead_end) { call_dest =3D insn_call_dest(prev_insn); - if (call_dest && !ignore_noreturn_call(prev_insn)) { + if (call_dest) { WARN_INSN(insn, "%s() is missing a __noreturn annotation", call_dest->name); warnings++; --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DB4D72066DB for ; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980569; cv=none; b=R8yqYAeJ7eZRj/+AhcjgrdMkAYFF1QoCCscAKmsnNicqTB2x2RD/NLVP/Af86xjHg/3OTTmK4V7XW3vdi1Dh9VajBMzzmPs++xPxE+ffCd3D/YD3D1CqPrfNfM/sMh4VtNTqeK8WeyCsZvxr4BU1mM4xRmWvNXjrfTUUPT2vhZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980569; c=relaxed/simple; bh=uxC5tVlc++V3xZ1VAv4k+jPVeflY2NBvsBYtkKGQnUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=az80cyvwxGw+ChSi9bepYtbW1z2L/HwX1uUqVpCRkjt+tPX7KKm7vidSrHPmOa1XCEZZs0wu3o0uhrvWhquJwjpeyTQtHG8KH3Yx5pu/3kgO3Cxb+Jnzxh2/KkNr+EncLpgJNCjBSXibjl0bSJYuy/wGgX2NuNfJ8vP+58cIZGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CNK83rmU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CNK83rmU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E204C116D0; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980569; bh=uxC5tVlc++V3xZ1VAv4k+jPVeflY2NBvsBYtkKGQnUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNK83rmUYgPUeFhMhhEwt0w1T+chZNlvMNTjtR7LiJ5r3DV20JgAvj+ZjhcwSrbF0 G/5xm4kcJGzjbr97XUwwpGuWS2VSyh+7j898et2maYmCaKlEPNw5usaA6RYN1gsvPy n/XC6qAVs6VdxaxaQlgQ8KnC6ikYSLwv4uN3Cb+4nL3qSQ6dLdrU0pZz7LjPZUlkNh pY9B9FRU1ziz1wA39gDGP0zF2C+iXYK+DR6th1hhD0NBnfyv8Q1GOeVVe3GbfAPZxo zA7INOHDxF6Dsk9PPUlF3CVfasM8RY5jHC+x2Mh0qi7h+q5yd1lTPmycQaTUByzgUi 4ZNYyDH9WjU8A== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 02/13] objtool: Fix error handling inconsistencies in check() Date: Fri, 14 Mar 2025 12:29:00 -0700 Message-ID: <0f49d6a27a080b4012e84e6df1e23097f44cc082.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure all fatal errors are funneled through the 'out' label with a negative ret. Signed-off-by: Josh Poimboeuf Reviewed-by: Brendan Jackman Reviewed-by: Miroslav Benes --- tools/objtool/check.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3a3a1a905199..2b5249af7b0f 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4586,8 +4586,10 @@ int check(struct objtool_file *file) init_cfi_state(&force_undefined_cfi); force_undefined_cfi.force_undefined =3D true; =20 - if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) + if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) { + ret =3D -1; goto out; + } =20 cfi_hash_add(&init_cfi); cfi_hash_add(&func_cfi); @@ -4604,7 +4606,7 @@ int check(struct objtool_file *file) if (opts.retpoline) { ret =3D validate_retpoline(file); if (ret < 0) - return ret; + goto out; warnings +=3D ret; } =20 @@ -4640,7 +4642,7 @@ int check(struct objtool_file *file) */ ret =3D validate_unrets(file); if (ret < 0) - return ret; + goto out; warnings +=3D ret; } =20 @@ -4703,7 +4705,7 @@ int check(struct objtool_file *file) if (opts.prefix) { ret =3D add_prefix_symbols(file); if (ret < 0) - return ret; + goto out; warnings +=3D ret; } =20 --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5CE1D2066FD for ; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; cv=none; b=Joj1KzB/q1kpVoDv3QcFj/aI7Q9Y4lFkn5ULO9pO4R8/enkXs+CGOZQ0UMRUYsuCPy3ZXqsBLWkCKT6dg1o/68uUyJszONB5O77yDsSXro4ChwPoX5NB6R7pV6PhiYMHA+8F4TDiyEGcZHDhXEHPfaPmqjQOf7aKsxLs8RGUbgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; c=relaxed/simple; bh=2l2pCAvHR0xBSXF7mla1gKooALwHNfcFtf5TIztVWEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TdbnvMReGbAQPfjGDaIMxUc3NOEPt+6LgNIHAnylDlhE5j6ES9E+C0LnltueOjvxplPoJu+ltVJkOCHxngHKaYiur6msd1uf19RNhVE66ghG/G3fnRBpCdP/CQE1bkrEaryCNdeWarEqdZND/tGJX9yRV/Lp72p5PY87W5vq1Ew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hMbEp98+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hMbEp98+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FECDC4CEEC; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980569; bh=2l2pCAvHR0xBSXF7mla1gKooALwHNfcFtf5TIztVWEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMbEp98+EagkgEr8i8/CL6AvxLLjK+BAxL+Q3kPPc1rmqflMl7KY9H6VvaO6/EDwl Hzxj6KsLk5/fBHuLYuIpT3mwHP+OdHK+XThGgac2vedk5SaSBRgvVYDpLQpsCnSkVF Aqr/AUwxkNzW6CigSWmYGSRTtD85MYKplFv8q/PdpSK7WGFdn0IRIWf/xlug+XV+7x qY7vsrBoAirX0gkzLiA+/25yK9ZNXllpkYe2nkJhIRQpr5OS2KEpAibjVJFkAvbZWT U5hnJYz9cE2ob5OyZko/bUBQJSXGc1qus/Yrfe74R4HZgxtU1/7avLX0o2WnlECoJJ OUaC4tFAXd/Xw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 03/13] objtool: Improve __noreturn annotation warning Date: Fri, 14 Mar 2025 12:29:01 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clarify what needs to be done to resolve the missing __noreturn warning. Signed-off-by: Josh Poimboeuf --- tools/objtool/Documentation/objtool.txt | 12 +++++------- tools/objtool/check.c | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/objtool/Documentation/objtool.txt b/tools/objtool/Docume= ntation/objtool.txt index 7c3ee959b63c..87950a7aaa17 100644 --- a/tools/objtool/Documentation/objtool.txt +++ b/tools/objtool/Documentation/objtool.txt @@ -319,14 +319,12 @@ the objtool maintainers. a just a bad person, you can tell objtool to ignore it. See the "Adding exceptions" section below. =20 - If it's not actually in a callable function (e.g. kernel entry code), - change ENDPROC to END. +3. file.o: warning: objtool: foo+0x48c: bar() missing __noreturn in .c/.h = or NORETURN() in noreturns.h =20 -3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn anno= tation - - The call from foo() to bar() doesn't return, but bar() is missing the - __noreturn annotation. NOTE: In addition to annotating the function - with __noreturn, please also add it to tools/objtool/noreturns.h. + The call from foo() to bar() doesn't return, but bar() is incorrectly + annotated. A noreturn function must be marked __noreturn in both its + declaration and its definition, and must have a NORETURN() annotation + in tools/objtool/noreturns.h. =20 4. file.o: warning: objtool: func(): can't find starting instruction or diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2b5249af7b0f..6b9ad3afe389 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4458,7 +4458,7 @@ static int validate_reachable_instructions(struct obj= tool_file *file) if (prev_insn && prev_insn->dead_end) { call_dest =3D insn_call_dest(prev_insn); if (call_dest) { - WARN_INSN(insn, "%s() is missing a __noreturn annotation", + WARN_INSN(insn, "%s() missing __noreturn in .c/.h or NORETURN() in nor= eturns.h", call_dest->name); warnings++; continue; --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B0B53206F1A for ; Fri, 14 Mar 2025 19:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; cv=none; b=B72RKAzvH1IxEXcUZxSqtWzbQTNtMu7LBWZxo0s80AQLLrbHO/HLChLHAIJDME9gweNdSkOtS/ZA8l5t2x8+OL4vMfuRryFVJdOB9PwBvuh/jifAUCq8fcvlkd7gEHsUHG4Boe/voHRdgh3/CeN/Yp0bvFCRoUC/yPaJ4DmRCzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; c=relaxed/simple; bh=DLEUMff4oGmotsMW0ZULYG9XAEQHCXK90L/aD28LyIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SBnGzkzqPm3fGjMwdKK5hVoTNJ2go4LHn2OCUOjndlbMRosqk4efrDphxtTVFvzslOjnfpF7Nzv9CLR69FCjKsviAbdNvBiN+bEWLMJYXijfoss2Fc3Fif8zlkdZ6k0bMXWekUcflZvaNHOXKiXhCJmDSF+NJMehtRMvb14HqNw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pNrBPqtu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pNrBPqtu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05429C4CEF0; Fri, 14 Mar 2025 19:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980570; bh=DLEUMff4oGmotsMW0ZULYG9XAEQHCXK90L/aD28LyIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNrBPqtuEqzwv1IIkRGk4k3b47cAAr6B3c1sug42H/+6YQQx+GXv8efJLP+DbfZYz CVbuNNQQYoBK5zp/Xa0XL+5iD5rzcIOCzs5ay+1wrmzAvPU8/QBaoPC3xoNQYlQcI4 VI/m1QsZuoNNK+JKyC2hh4E9NhfZD24A59KyLBndeSD+NCsUYgvQ1F+RbAtto0fUvd sMj0wp+JcOnpYZZLr55qSZ0C+oGmoTPnk1MFyjYxby4lXJYODSN2gNLjG2L3a5oTrM B029xejWIIPc8WdF7J9UhSIGLY24N5SqyC+fYJVnmv3ApCqVmarN8exea5s3cy1USW 4BjL9I3Elvevg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 04/13] objtool: Update documentation Date: Fri, 14 Mar 2025 12:29:02 -0700 Message-ID: <2552ee8b48631127bf269359647a7389edf5f002.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix some outdated information in the objtool doc. Signed-off-by: Josh Poimboeuf --- tools/objtool/Documentation/objtool.txt | 95 ++++++++++++++----------- 1 file changed, 53 insertions(+), 42 deletions(-) diff --git a/tools/objtool/Documentation/objtool.txt b/tools/objtool/Docume= ntation/objtool.txt index 87950a7aaa17..28ac57b9e102 100644 --- a/tools/objtool/Documentation/objtool.txt +++ b/tools/objtool/Documentation/objtool.txt @@ -28,6 +28,15 @@ Objtool has the following features: sites, enabling the kernel to patch them inline, to prevent "thunk funneling" for both security and performance reasons =20 +- Return thunk validation -- validates return thunks are used for + certain CPU mitigations including Retbleed and SRSO + +- Return thunk annotation -- annotates all return thunk sites so kernel + can patch them inline, depending on enabled mitigations + +- Return thunk training valiation -- validate that all entry paths + untrain a "safe return" before the first return (or call) + - Non-instrumentation validation -- validates non-instrumentable ("noinstr") code rules, preventing instrumentation in low-level C entry code @@ -53,6 +62,9 @@ Objtool has the following features: - Function entry annotation -- annotates function entries, enabling kernel function tracing =20 +- Function preamble (prefix) annotation and/or symbol generation -- used + for FineIBT and call depth tracking + - Other toolchain hacks which will go unmentioned at this time... =20 Each feature can be enabled individually or in combination using the @@ -197,19 +209,17 @@ To achieve the validation, objtool enforces the follo= wing rules: =20 1. Each callable function must be annotated as such with the ELF function type. In asm code, this is typically done using the - ENTRY/ENDPROC macros. If objtool finds a return instruction + SYM_FUNC_{START,END} macros. If objtool finds a return instruction outside of a function, it flags an error since that usually indicates callable code which should be annotated accordingly. =20 This rule is needed so that objtool can properly identify each callable function in order to analyze its stack metadata. =20 -2. Conversely, each section of code which is *not* callable should *not* - be annotated as an ELF function. The ENDPROC macro shouldn't be used - in this case. - - This rule is needed so that objtool can ignore non-callable code. - Such code doesn't have to follow any of the other rules. +2. Conversely, each section of code which is *not* callable, or is + otherwise doing funny things with the stack or registers, should + *not* be annotated as an ELF function. Rather, SYM_CODE_{START,END} + should be used along with unwind hints. =20 3. Each callable function which calls another function must have the correct frame pointer logic, if required by CONFIG_FRAME_POINTER or @@ -221,7 +231,7 @@ To achieve the validation, objtool enforces the followi= ng rules: function B, the _caller_ of function A will be skipped on the stack trace. =20 -4. Dynamic jumps and jumps to undefined symbols are only allowed if: +4. Indirect jumps and jumps to undefined symbols are only allowed if: =20 a) the jump is part of a switch statement; or =20 @@ -304,20 +314,21 @@ the objtool maintainers. 001e 2823e: 80 ce 02 or $0x2,%dh ... =20 + 2. file.o: warning: objtool: .text+0x53: unreachable instruction =20 Objtool couldn't find a code path to reach the instruction. =20 If the error is for an asm file, and the instruction is inside (or reachable from) a callable function, the function should be annotated - with the ENTRY/ENDPROC macros (ENDPROC is the important one). - Otherwise, the code should probably be annotated with the unwind hint - macros in asm/unwind_hints.h so objtool and the unwinder can know the - stack state associated with the code. + with the SYM_FUNC_START and SYM_FUNC_END macros. + + Otherwise, SYM_CODE_START can be used. In that case the code needs + to be annotated with unwind hint macros. + + If you're sure the code won't affect the reliability of runtime stack + traces and want objtool to ignore it, see "Adding exceptions" below. =20 - If you're 100% sure the code won't affect stack traces, or if you're - a just a bad person, you can tell objtool to ignore it. See the - "Adding exceptions" section below. =20 3. file.o: warning: objtool: foo+0x48c: bar() missing __noreturn in .c/.h = or NORETURN() in noreturns.h =20 @@ -326,6 +337,7 @@ the objtool maintainers. declaration and its definition, and must have a NORETURN() annotation in tools/objtool/noreturns.h. =20 + 4. file.o: warning: objtool: func(): can't find starting instruction or file.o: warning: objtool: func()+0x11dd: can't decode instruction @@ -339,23 +351,21 @@ the objtool maintainers. =20 This is a kernel entry/exit instruction like sysenter or iret. Such instructions aren't allowed in a callable function, and are most - likely part of the kernel entry code. They should usually not have - the callable function annotation (ENDPROC) and should always be - annotated with the unwind hint macros in asm/unwind_hints.h. + likely part of the kernel entry code. Such code should probably be + placed in a SYM_FUNC_CODE block with unwind hints. =20 =20 6. file.o: warning: objtool: func()+0x26: sibling call from callable instr= uction with modified stack frame =20 - This is a dynamic jump or a jump to an undefined symbol. Objtool - assumed it's a sibling call and detected that the frame pointer - wasn't first restored to its original state. + This is a branch to an UNDEF symbol. Objtool assumed it's a + sibling call and detected that the stack wasn't first restored to its + original state. =20 - If it's not really a sibling call, you may need to move the - destination code to the local file. + If it's not really a sibling call, you may need to use unwind hints + and/or move the destination code to the local file. =20 If the instruction is not actually in a callable function (e.g. - kernel entry code), change ENDPROC to END and annotate manually with - the unwind hint macros in asm/unwind_hints.h. + kernel entry code), use SYM_CODE_{START,END} and unwind hints. =20 =20 7. file: warning: objtool: func()+0x5c: stack state mismatch @@ -371,8 +381,8 @@ the objtool maintainers. =20 Another possibility is that the code has some asm or inline asm which does some unusual things to the stack or the frame pointer. In such - cases it's probably appropriate to use the unwind hint macros in - asm/unwind_hints.h. + cases it's probably appropriate to use SYM_FUNC_CODE with unwind + hints. =20 =20 8. file.o: warning: objtool: funcA() falls through to next function funcB() @@ -382,17 +392,16 @@ the objtool maintainers. can fall through into the next function. There could be different reasons for this: =20 - 1) funcA()'s last instruction is a call to a "noreturn" function like + a) funcA()'s last instruction is a call to a "noreturn" function like panic(). In this case the noreturn function needs to be added to objtool's hard-coded global_noreturns array. Feel free to bug the objtool maintainer, or you can submit a patch. =20 - 2) funcA() uses the unreachable() annotation in a section of code + b) funcA() uses the unreachable() annotation in a section of code that is actually reachable. =20 - 3) If funcA() calls an inline function, the object code for funcA() - might be corrupt due to a gcc bug. For more details, see: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D70646 + c) Some undefined behavior like divide by zero. + =20 9. file.o: warning: objtool: funcA() call to funcB() with UACCESS enabled =20 @@ -430,24 +439,26 @@ the objtool maintainers. This limitation can be overcome by massaging the alternatives with NOPs to shift the stack changes around so they no longer conflict. =20 + 11. file.o: warning: unannotated intra-function call =20 - This warning means that a direct call is done to a destination which - is not at the beginning of a function. If this is a legit call, you - can remove this warning by putting the ANNOTATE_INTRA_FUNCTION_CALL - directive right before the call. + This warning means that a direct call is done to a destination which + is not at the beginning of a function. If this is a legit call, you + can remove this warning by putting the ANNOTATE_INTRA_FUNCTION_CALL + directive right before the call. + =20 12. file.o: warning: func(): not an indirect call target =20 - This means that objtool is running with --ibt and a function expected - to be an indirect call target is not. In particular, this happens for - init_module() or cleanup_module() if a module relies on these special - names and does not use module_init() / module_exit() macros to create - them. + This means that objtool is running with --ibt and a function + expected to be an indirect call target is not. In particular, this + happens for init_module() or cleanup_module() if a module relies on + these special names and does not use module_init() / module_exit() + macros to create them. =20 =20 If the error doesn't seem to make sense, it could be a bug in objtool. -Feel free to ask the objtool maintainer for help. +Feel free to ask objtool maintainers for help. =20 =20 Adding exceptions --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C4772206F34 for ; Fri, 14 Mar 2025 19:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; cv=none; b=k0lax1Jw5hCm19hMjvUm6nza+b8+1szYyBJv3pzvN6whNJYjF8jSVkEBVpnQ+MN54LqGboKJipVe2zNBc/yEEgd64XlxQvAOhVwwiBcYyBl0B2J0/1cnX1relj9MOcT8cjnFzWDQA6lvyv4WOvITFjqmXjVNJR7LeCUVwLzhI2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980570; c=relaxed/simple; bh=VEoiTYp1V7L0ENmhPyAnmcO45S5Fd8ceq65oHR8RUF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YHb/slDUZDQoRIHgJl3Gr5RFmJ7TeXUX2YHzc3xwcFcM5tw7IxThVspW5/xDHUHiW5nV9dQiDO/BjM+JtOWtNPogRBnqRHxF+9LWgV13zXQL05x/DTvwtSpTMhIflgWzQc/8VhHeJtHzHbUPt15mg3F9Ndp+VUXB7E2mLD6p350= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NGMp10cn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NGMp10cn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AACEC4CEE9; Fri, 14 Mar 2025 19:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980570; bh=VEoiTYp1V7L0ENmhPyAnmcO45S5Fd8ceq65oHR8RUF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGMp10cnlNa/SDBtl1tX/DQi6Nsi1HB7fKbEX2xrMkdviSBVn7+fpDpMaJ64fzkxa xgf6akMD5I7MBOUmgOF2W8TaSE0oYpkey9ai9Z9fKhFtzsMh1dSndXQQjes+9ascug M+7EtmwwJ/Sr1I4bkbbtv7Xi4vA3EaVl8r3rSmNFOiwzs9aYSwX7XQRkn5O4ao9uJh wJMkd1kuypJWtO7N/YRDBoXnDkNwi9h65eE8awqlss6IvxC6X0FVGrJeWJc+bo2vGp E3gcYaGMGaI+Yljp7l/OQyktNwjO9s6gvpOv3xYH7BAEhgL86m1ik36zD6q+wkYhpp CsC/EAvm8/OiA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 05/13] objtool: Increase per-function WARN_FUNC() rate limit Date: Fri, 14 Mar 2025 12:29:03 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Increase the per-function WARN_FUNC() rate limit from 1 to 2. If the number of warnings for a given function goes beyond 2, print "skipping duplicate warning(s)". This helps root out additional warnings in a function that might be hiding behind the first one. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 2 +- tools/objtool/include/objtool/elf.h | 2 +- tools/objtool/include/objtool/warn.h | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 6b9ad3afe389..3ddaefe97f55 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4528,7 +4528,7 @@ static int disas_warned_funcs(struct objtool_file *fi= le) char *funcs =3D NULL, *tmp; =20 for_each_sym(file, sym) { - if (sym->warned) { + if (sym->warnings) { if (!funcs) { funcs =3D malloc(strlen(sym->name) + 1); strcpy(funcs, sym->name); diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index d7e815c2fd15..223ac1c24b90 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -65,10 +65,10 @@ struct symbol { u8 return_thunk : 1; u8 fentry : 1; u8 profiling_func : 1; - u8 warned : 1; u8 embedded_insn : 1; u8 local_label : 1; u8 frame_pointer : 1; + u8 warnings : 2; struct list_head pv_target; struct reloc *relocs; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index ac04d3fe4dd9..6180288927fd 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -53,14 +53,22 @@ static inline char *offstr(struct section *sec, unsigne= d long offset) free(_str); \ }) =20 +#define WARN_LIMIT 2 + #define WARN_INSN(insn, format, ...) \ ({ \ struct instruction *_insn =3D (insn); \ - if (!_insn->sym || !_insn->sym->warned) \ + BUILD_BUG_ON(WARN_LIMIT > 2); \ + if (!_insn->sym || _insn->sym->warnings < WARN_LIMIT) { \ WARN_FUNC(format, _insn->sec, _insn->offset, \ ##__VA_ARGS__); \ - if (_insn->sym) \ - _insn->sym->warned =3D 1; \ + if (_insn->sym) \ + _insn->sym->warnings++; \ + } else if (_insn->sym && _insn->sym->warnings =3D=3D WARN_LIMIT) { \ + WARN_FUNC("skipping duplicate warning(s)", \ + _insn->sec, _insn->offset); \ + _insn->sym->warnings++; \ + } \ }) =20 #define BT_INSN(insn, format, ...) \ --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 31E1F207A02 for ; Fri, 14 Mar 2025 19:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980571; cv=none; b=EIJeap3f/F4s6lr0pN2cM6wXHifJIxvxKuQjrpriv5lSWnpRmc/hhxMX2AH5qpjrrFNhrIAAsilWchdrM8OgRGazR3mQbg6to1QtVXPizf99xeqm0wm6P4OqndKDOgMa+UY3Y9HSG9OKkHULBdrSKquzdtvSkTGH1jw5TnFKaP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980571; c=relaxed/simple; bh=+NCq00Wy+1YJBoI8XRnsTBTKxGLAtQEKm5X7Ld5eVHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eJUEf0QcHsdcvobt/yoXzVUxY/H4S2MStCMcwYkOTUHGnNUeJf1LVHLUx3c+txDgvYxocNHpfyl75CIINBV+4Kjw3Age8ZdcqEODdcy7yo8D04EBJwWPyJAXFlZhXn5pRKJc9FRZ4L0oiI3XMtcKaSs0BGBTXocHkBbcJc58ZUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J91zde2B; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J91zde2B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D02AAC4CEEE; Fri, 14 Mar 2025 19:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980571; bh=+NCq00Wy+1YJBoI8XRnsTBTKxGLAtQEKm5X7Ld5eVHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J91zde2BBPnL+pJPtNfs0OzE+ts38HR2LixL2bFq9vML0VFsF3juMh9cuMLlCyXN2 +xz0RNNuq28au5/RWJb06Id3J1jubDWS6WroGOWIDZn2mYdrDjEhZoop0w/h+dd/1w 37D+612v3SFvZURb2g7soQL4r+3BVGiRK2Prvht2wh4p3Rp+svWHXtds/AqMsxSGD3 7DyNiRla5FiowRj3xn9RL8zUv1Bq+zeR+/RAY9ZI+BM7dEUvM3++tRo0G0tKE0oq39 77FP/nXkQdLTHc5pkUblXn61JkjVRgnOY6saMLkEq9bj9VFzAgVHD3As+zilF8xEzT KBftWbQF0QbTA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 06/13] objtool: Remove --unret dependency on --rethunk Date: Fri, 14 Mar 2025 12:29:04 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With unret validation enabled and IBT/LTO disabled, objtool runs on TUs with --rethunk and on vmlinux.o with --unret. So this dependency isn't valid as they don't always run on the same object. This error never triggered before because --unret is always coupled with --noinstr, so the first conditional in opts_valid() returns early due to opts.noinstr being true. Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 387d56a7f5fb..c7275cf7641b 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -151,11 +151,6 @@ static bool opts_valid(void) return true; } =20 - if (opts.unret && !opts.rethunk) { - ERROR("--unret requires --rethunk"); - return false; - } - if (opts.dump_orc) return true; =20 --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 56003209674 for ; Fri, 14 Mar 2025 19:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; cv=none; b=r/xCrsCh/Khoj7zDAvVOSoOsEQZCJTFtoYXJtDpt89r/+huo6yKVdKt8WucILbantaseUGgYTRiXKPKv8TW7SeVPIa0YvPAqmoEZYWGvWnYS1IAgP6+PdXb8pY7fPB+vzk9tfnVKK0UvrZT0pAQB0NHCk/RmiH9S2eRvE0bDCzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; c=relaxed/simple; bh=XlGdkelaaBYsB5r9HRmUpmRPjN8YbQPGBwNquGloP04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hOQVA74Vp6HVYIkerPltvDoNH0TMFLNTrwGEbADA2ajaxUnsSuO0IrWlNGAg7/fDIgrcwh91zTILbCugK/kgI29RAECrHEOIxffpCCEEkHMWrmV9/ROczwDdtTOepmYC+8AL0KGqg+J2NmVJo7+LbI6HdDUDZC6p+DHYhgDMJAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VJEbcpWs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VJEbcpWs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 359AAC4CEE3; Fri, 14 Mar 2025 19:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980571; bh=XlGdkelaaBYsB5r9HRmUpmRPjN8YbQPGBwNquGloP04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJEbcpWsO3NlSviV4z3UIgPQKHCVoB3IaK5+Fkh3QspwxP6kngzZBH29rUKnqvd3s 3sQ7vRGVO93UgK78yQ2ZgNrcBRTcMAEcdwxp3UHjgY29TQV9GEcnY+nB8ZdyyTC+Bi SPptX9LjB/7ICGnyl+uN+wdNL0YO78yQFKI7njBKsPKSnVijKPXHJlKxJNDmKdk67Z WGkAxK+6ay4mTVXJP6zqJsXeanN8sYLaxUXPVqsgzWXn7yrVzkRpE2q8EtLLEIucDX fm+pTqlsQf4X3ISV2bjFTr0Ffo5rrMa025C+lnZb3l7qhCYEhWurhp5IgcyEHKJh6b 48cvIxUu459kw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 07/13] objtool: Consolidate option validation Date: Fri, 14 Mar 2025 12:29:05 -0700 Message-ID: <8f886502fda1d15f39d7351b70d4ebe5903da627.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The option validations are a bit scattered, consolidate them. Signed-off-by: Josh Poimboeuf Reviewed-by: Brendan Jackman Reviewed-by: Miroslav Benes --- tools/objtool/builtin-check.c | 68 +++++++++++++---------------------- 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index c7275cf7641b..36d81a455b01 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -131,6 +131,26 @@ int cmd_parse_options(int argc, const char **argv, con= st char * const usage[]) =20 static bool opts_valid(void) { + if (opts.mnop && !opts.mcount) { + ERROR("--mnop requires --mcount"); + return false; + } + + if (opts.noinstr && !opts.link) { + ERROR("--noinstr requires --link"); + return false; + } + + if (opts.ibt && !opts.link) { + ERROR("--ibt requires --link"); + return false; + } + + if (opts.unret && !opts.link) { + ERROR("--unret requires --link"); + return false; + } + if (opts.hack_jump_label || opts.hack_noinstr || opts.ibt || @@ -158,45 +178,6 @@ static bool opts_valid(void) return false; } =20 -static bool mnop_opts_valid(void) -{ - if (opts.mnop && !opts.mcount) { - ERROR("--mnop requires --mcount"); - return false; - } - - return true; -} - -static bool link_opts_valid(struct objtool_file *file) -{ - if (opts.link) - return true; - - if (has_multiple_files(file->elf)) { - ERROR("Linked object detected, forcing --link"); - opts.link =3D true; - return true; - } - - if (opts.noinstr) { - ERROR("--noinstr requires --link"); - return false; - } - - if (opts.ibt) { - ERROR("--ibt requires --link"); - return false; - } - - if (opts.unret) { - ERROR("--unret requires --link"); - return false; - } - - return true; -} - int objtool_run(int argc, const char **argv) { const char *objname; @@ -216,11 +197,10 @@ int objtool_run(int argc, const char **argv) if (!file) return 1; =20 - if (!mnop_opts_valid()) - return 1; - - if (!link_opts_valid(file)) - return 1; + if (!opts.link && has_multiple_files(file->elf)) { + ERROR("Linked object detected, forcing --link"); + opts.link =3D true; + } =20 ret =3D check(file); if (ret) --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 55F36209671 for ; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; cv=none; b=VsAkRe5w8o7F9r1TisEoWHIzkV74kyO/qt/NCHsR3zNj1/qv1JpnVnwkO6WHJgBaADGOwzfD2o9lQMEA00kch1BUNhOCcaERv61FfruhzJp/X9LoZkToqI+W5s8zDIntGMZw1Zq81Rv3BdQdKNLNa6+eY0/SoTfPaO+DTQW8+TA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; c=relaxed/simple; bh=2RPx1BxZaiNmZR7J25T6h9oAjTbEay4C0cyWTnIeJzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VS9g3IQh1+kk/By2Sx0Em9wrR7XFr6JXlZoyzSxuBoGxyWFDdRfTZpFOBshySPHqcfP7vb/cPS5d9styuDlKOgRY6T7v+RET0KWOs2FJ0jfUhvFa7LAkpCh+Aoi6k5zqJhkRNCFl7r1NCg6ScLy29vsYaUwE466368kX6Njk0GI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kQXwKpl7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kQXwKpl7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B08AC4CEEC; Fri, 14 Mar 2025 19:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980571; bh=2RPx1BxZaiNmZR7J25T6h9oAjTbEay4C0cyWTnIeJzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQXwKpl7eMhqK2cO7O+skTbnPEESf+u9HNIPgPyIzU1j/9SEP/viGHf0D8TCvz/Ue xdfqDfLy8oWMy6yNIx+xrKUmj6FLQeFjukTfYfWPXO8X8Pe5VOl6XM99APVLGEq9on AsBixYpPvxIOhmQ3JwITqW8aJHhXmQVvo4H+tIATy6Da5fkE8FGzWRQKXaPCIf3yID AuZNK9mh/U5k2Geyx4/IW0q91SYSFtn082AEnFyvRCZxe7lbEYYlTi29yPJu8r5I5t 5eWyexav763x6xyw0OTXcIUctaPwTo+xxy7ycK2nyLaXOpLcDItOGNxcr29rgABCNO oPsqqaOJa9zJQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 08/13] objtool: Upgrade "Linked object detected" warning to error Date: Fri, 14 Mar 2025 12:29:06 -0700 Message-ID: <8380bbf3a0fa86e03fd63f60568ae06a48146bc1.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Force the user to fix their cmdline if they forget the '--link' option. Signed-off-by: Josh Poimboeuf Reviewed-by: Brendan Jackman --- tools/objtool/builtin-check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 36d81a455b01..79843512a51b 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -198,8 +198,8 @@ int objtool_run(int argc, const char **argv) return 1; =20 if (!opts.link && has_multiple_files(file->elf)) { - ERROR("Linked object detected, forcing --link"); - opts.link =3D true; + ERROR("Linked object requires --link"); + goto err; } =20 ret =3D check(file); --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B5F6220A5DE for ; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; cv=none; b=M0rWL6VGouZQOQR5AuBdzBKW/+KhlvZcbcY7tLiRd/hjSiTCsN9w1PPB9WQvZyVKTK2TNsfiGK8Ve5TVD6DWqVzFz/JjLcWIYX8hA5uClKNOi4myv9e4TvKObBF9FRh0RwA1S64WKs/AHVjqrWY7nZY56+6P+HPp3cOi0KFmGxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; c=relaxed/simple; bh=KyZF3sb610UPzWkHD9K7JAZK25xgze011L6w0Ci3vzk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IOrZdj9pmjqfg/L5Yzl3pLQdzzM0yxkbfr+O/oD0nElBCcmO1EFt2GFeDp+6mYeWr4xep+NbBheaKHgs7/PbGMt+gIJlOhxpRAPxUasVJ+9n1580mJrihUTlPf7UgHISTJ7HVyDvraHFHAr+YJMKR7z9sC1iNal3jrVqxF7bfAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QdO/gDMV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QdO/gDMV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DEEBC4CEF0; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980572; bh=KyZF3sb610UPzWkHD9K7JAZK25xgze011L6w0Ci3vzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QdO/gDMVZrIFMYTUvBe3omaxZEZfrPtvwZXNakSbQwfrzuLXKtEQt3/1fQxi9UNET Q4oO3Zjxcsm2fCyr+ivzQLSRr1nD/2Y2WuHMuVatgxX3dV1S2YeMg42ey7/ce3V2dI o6+hWfbC/XXbzy/mTXoKpwcmSdA0LCLUKt3KO/gYsfKJGHnMBBpxFGV1lSXpMx07wX 9u1rJThjMcfNgEQGIHnH/HUuLjZ4yEYdh+ueqGREohxrbELGF7cDTNft78F4w6OuXx qfCpmTwRZvSTSLHwl91nTO8X8yedEzUQVSaT3ZuptG7HUA1PFbGn2pRPfUPEbC1oCI WBJ19rLqhHbqg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 09/13] objtool: Add --output option Date: Fri, 14 Mar 2025 12:29:07 -0700 Message-ID: <0da308d42d82b3bbed16a31a72d6bde52afcd6bd.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add option to allow writing the changed binary to a separate file rather than changing it in place. Libelf makes this suprisingly hard, so take the easy way out and just copy the file before editing it. Also steal the -o short option from --orc. Nobody will notice ;-) Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes --- tools/objtool/builtin-check.c | 98 ++++++++++++++++++++----- tools/objtool/elf.c | 3 - tools/objtool/include/objtool/builtin.h | 1 + tools/objtool/objtool.c | 15 ++-- tools/objtool/orc_dump.c | 7 +- 5 files changed, 89 insertions(+), 35 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 79843512a51b..3de3afa0a19c 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -6,6 +6,10 @@ #include #include #include +#include +#include +#include +#include #include #include =20 @@ -14,6 +18,8 @@ "error: objtool: " format "\n", \ ##__VA_ARGS__) =20 +const char *objname; + struct opts opts; =20 static const char * const check_usage[] =3D { @@ -71,7 +77,7 @@ static const struct option check_options[] =3D { OPT_BOOLEAN('i', "ibt", &opts.ibt, "validate and annotate IBT"), OPT_BOOLEAN('m', "mcount", &opts.mcount, "annotate mcount/fentry calls fo= r ftrace"), OPT_BOOLEAN('n', "noinstr", &opts.noinstr, "validate noinstr rules"), - OPT_BOOLEAN('o', "orc", &opts.orc, "generate ORC metadata"), + OPT_BOOLEAN(0, "orc", &opts.orc, "generate ORC metadata"), OPT_BOOLEAN('r', "retpoline", &opts.retpoline, "validate and annotate ret= poline usage"), OPT_BOOLEAN(0, "rethunk", &opts.rethunk, "validate and annotate rethunk= usage"), OPT_BOOLEAN(0, "unret", &opts.unret, "validate entry unret placement"), @@ -84,15 +90,16 @@ static const struct option check_options[] =3D { OPT_CALLBACK_OPTARG(0, "dump", NULL, NULL, "orc", "dump metadata", parse_= dump), =20 OPT_GROUP("Options:"), - OPT_BOOLEAN(0, "backtrace", &opts.backtrace, "unwind on error"), - OPT_BOOLEAN(0, "backup", &opts.backup, "create .orig files before modific= ation"), - OPT_BOOLEAN(0, "dry-run", &opts.dryrun, "don't write modifications"), - OPT_BOOLEAN(0, "link", &opts.link, "object is a linked object"), - OPT_BOOLEAN(0, "module", &opts.module, "object is part of a kernel module= "), - OPT_BOOLEAN(0, "mnop", &opts.mnop, "nop out mcount call sites"), - OPT_BOOLEAN(0, "no-unreachable", &opts.no_unreachable, "skip 'unreachable= instruction' warnings"), - OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses= in warnings"), - OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), + OPT_BOOLEAN(0, "backtrace", &opts.backtrace, "unwind on error"), + OPT_BOOLEAN(0, "backup", &opts.backup, "create .orig files before modif= ication"), + OPT_BOOLEAN(0, "dry-run", &opts.dryrun, "don't write modifications"), + OPT_BOOLEAN(0, "link", &opts.link, "object is a linked object"), + OPT_BOOLEAN(0, "module", &opts.module, "object is part of a kernel modu= le"), + OPT_BOOLEAN(0, "mnop", &opts.mnop, "nop out mcount call sites"), + OPT_BOOLEAN(0, "no-unreachable", &opts.no_unreachable, "skip 'unreachab= le instruction' warnings"), + OPT_STRING('o', "output", &opts.output, "file", "output file name"), + OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section address= es in warnings"), + OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), OPT_BOOLEAN('v', "verbose", &opts.verbose, "verbose warnings"), =20 OPT_END(), @@ -178,24 +185,75 @@ static bool opts_valid(void) return false; } =20 +static int copy_file(const char *src, const char *dst) +{ + size_t to_copy, copied; + int dst_fd, src_fd; + struct stat stat; + off_t offset =3D 0; + + src_fd =3D open(src, O_RDONLY); + if (src_fd =3D=3D -1) { + ERROR("can't open '%s' for reading", src); + return 1; + } + + dst_fd =3D open(dst, O_WRONLY | O_CREAT | O_TRUNC); + if (dst_fd =3D=3D -1) { + ERROR("can't open '%s' for writing", dst); + return 1; + } + + if (fstat(src_fd, &stat) =3D=3D -1) { + perror("fstat"); + return 1; + } + + if (fchmod(dst_fd, stat.st_mode) =3D=3D -1) { + perror("fchmod"); + return 1; + } + + for (to_copy =3D stat.st_size; to_copy > 0; to_copy -=3D copied) { + copied =3D sendfile(dst_fd, src_fd, &offset, to_copy); + if (copied =3D=3D -1) { + perror("sendfile"); + return 1; + } + } + + close(dst_fd); + close(src_fd); + return 0; +} + int objtool_run(int argc, const char **argv) { - const char *objname; struct objtool_file *file; int ret; =20 - argc =3D cmd_parse_options(argc, argv, check_usage); - objname =3D argv[0]; + cmd_parse_options(argc, argv, check_usage); =20 if (!opts_valid()) return 1; =20 + objname =3D argv[0]; + if (opts.dump_orc) return orc_dump(objname); =20 + if (!opts.dryrun && opts.output) { + /* copy original .o file to output file */ + if (copy_file(objname, opts.output)) + return 1; + + /* from here on, work directly on the output file */ + objname =3D opts.output; + } + file =3D objtool_open_read(objname); if (!file) - return 1; + goto err; =20 if (!opts.link && has_multiple_files(file->elf)) { ERROR("Linked object requires --link"); @@ -204,10 +262,16 @@ int objtool_run(int argc, const char **argv) =20 ret =3D check(file); if (ret) - return ret; + goto err; =20 - if (file->elf->changed) - return elf_write(file->elf); + if (!opts.dryrun && file->elf->changed && elf_write(file->elf)) + goto err; =20 return 0; + +err: + if (opts.output) + unlink(opts.output); + + return 1; } diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 6f64d611faea..be4f4b62730c 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1302,9 +1302,6 @@ int elf_write(struct elf *elf) struct section *sec; Elf_Scn *s; =20 - if (opts.dryrun) - return 0; - /* Update changed relocation sections and section headers: */ list_for_each_entry(sec, &elf->sections, list) { if (sec->truncate) diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/includ= e/objtool/builtin.h index fcca6662c8b4..25cfa01758b9 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -35,6 +35,7 @@ struct opts { bool mnop; bool module; bool no_unreachable; + const char *output; bool sec_address; bool stats; bool verbose; diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index f40febdd6e36..53cd881c6b95 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -18,7 +18,6 @@ =20 bool help; =20 -const char *objname; static struct objtool_file file; =20 static bool objtool_create_backup(const char *_objname) @@ -79,18 +78,14 @@ static bool objtool_create_backup(const char *_objname) return true; } =20 -struct objtool_file *objtool_open_read(const char *_objname) +struct objtool_file *objtool_open_read(const char *filename) { - if (objname) { - if (strcmp(objname, _objname)) { - WARN("won't handle more than one file at a time"); - return NULL; - } - return &file; + if (file.elf) { + WARN("won't handle more than one file at a time"); + return NULL; } - objname =3D _objname; =20 - file.elf =3D elf_open_read(objname, O_RDWR); + file.elf =3D elf_open_read(filename, O_RDWR); if (!file.elf) return NULL; =20 diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c index a62247efb64f..05ef0e297837 100644 --- a/tools/objtool/orc_dump.c +++ b/tools/objtool/orc_dump.c @@ -10,7 +10,7 @@ #include #include =20 -int orc_dump(const char *_objname) +int orc_dump(const char *filename) { int fd, nr_entries, i, *orc_ip =3D NULL, orc_size =3D 0; struct orc_entry *orc =3D NULL; @@ -26,12 +26,9 @@ int orc_dump(const char *_objname) Elf_Data *data, *symtab =3D NULL, *rela_orc_ip =3D NULL; struct elf dummy_elf =3D {}; =20 - - objname =3D _objname; - elf_version(EV_CURRENT); =20 - fd =3D open(objname, O_RDONLY); + fd =3D open(filename, O_RDONLY); if (fd =3D=3D -1) { perror("open"); return -1; --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C5F9520A5EB for ; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; cv=none; b=p+f79N7OrmG4m9L/115rXHtSeUQXJsSe1r4gpjvCul1+5Rv1lSo9vLvubGizZ5V5QqHZ9ZX46AZVU3O3LBIcuTvroGR06907oMAvNx39IFiM3fnwHE79qC+X3q2z/ORGuAsM9C5bG89zOo3MOX5X0CONMgVTzHji+QB8TCnAHZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980572; c=relaxed/simple; bh=8bNnqgfdWIJ00VMJF4b2nsxmpSSKNLE/p89AYncO9Eg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K1lFlgOzOMmVAW4e5fkr7wWUr3O63/pA6LOeRfbeMmI1iCvUeuoOMhZPASPjobFEAvEFI0jpdD/e5agt23fkZmAH24PkSd8mGZk9LLaQ8GsA6UNX3leBDzMby4n4OG++LMIWerhJPWMLM/OyOA2nOQOXJ7Q8Qs4CxuQBm3zBZhs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UsMLPkhY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UsMLPkhY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68939C4CEEE; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980572; bh=8bNnqgfdWIJ00VMJF4b2nsxmpSSKNLE/p89AYncO9Eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsMLPkhYiEARsQr06oH2RGIPJ7B4nanjkY/Rp14b1v1t4mqo9ybI/sqK27qLXSsmv 2ayCRxRNL/pdJ7hrCL3EW+Ji+7PU5GruLIK5fNprdOn6aNMq+fNlZZl/bHbpf/Mzx4 lsKQpzUTEzRMonKSx17RKC+5/rSP3MLNswg/Wx1rfDpPHIoXA1h8fp0nPXVzI20Xwl qmqGvBoTksZ2K0Wlviax055KIhsZjp8oY0AZcwoYEp6kpSqf5e6SxMU5xG3FbHnTUz 71R3e2p3sh4hZEKyyMAAo4GeYvL9yktjODP0JvdAbBLl4CQfoQ+Ojf2Bu3oymvx2e4 PYnbWwcslJp0g== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 10/13] objtool: Add --Werror option Date: Fri, 14 Mar 2025 12:29:08 -0700 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Any objtool warning has the potential of reflecting (or triggering) a major bug in the kernel or compiler which could result in crashing the kernel or breaking the livepatch consistency model. In preparation for failing the build on objtool errors/warnings, add a new --Werror option. [ jpoimboe: commit log, comments, error out on fatal errors too ] Co-developed-by: Brendan Jackman Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes --- tools/objtool/builtin-check.c | 1 + tools/objtool/check.c | 15 ++++++++++++--- tools/objtool/include/objtool/builtin.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 3de3afa0a19c..c201650efe49 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -101,6 +101,7 @@ static const struct option check_options[] =3D { OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section address= es in warnings"), OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), OPT_BOOLEAN('v', "verbose", &opts.verbose, "verbose warnings"), + OPT_BOOLEAN(0, "Werror", &opts.werror, "return error on warnings"), =20 OPT_END(), }; diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3ddaefe97f55..b574f2e8b07f 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4737,9 +4737,18 @@ int check(struct objtool_file *file) =20 out: /* - * For now, don't fail the kernel build on fatal warnings. These - * errors are still fairly common due to the growing matrix of - * supported toolchains and their recent pace of change. + * CONFIG_OBJTOOL_WERROR upgrades all warnings (and errors) to actual + * errors. + * + * Note that even "fatal" type errors don't actually return an error + * without CONFIG_OBJTOOL_WERROR. That probably needs improved at some + * point. */ + if (opts.werror && (ret || warnings)) { + if (warnings) + WARN("%d warning(s) upgraded to errors", warnings); + return 1; + } + return 0; } diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/includ= e/objtool/builtin.h index 25cfa01758b9..b18f114cdaa4 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -39,6 +39,7 @@ struct opts { bool sec_address; bool stats; bool verbose; + bool werror; }; =20 extern struct opts opts; --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2573420B217 for ; Fri, 14 Mar 2025 19:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980573; cv=none; b=SwOJsf1R5pmhVM2rn9ZM1ccqQvPaueWs8OvuLSh7Qiyp47NPdFBgIfd7r5QzGnvKg24s1QNS7yBoggJmeX5TV+ALgeH+yjIiMktpi2DpxXeA5h/CaQHUTXwhXUiP0psYD3b5ydokQCxKb6EGgrRpb0zoAyMz/rdhhCfUNHHM1nA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980573; c=relaxed/simple; bh=omUmkLw0f0UbB3xgJ3lIhVidBc43HYclIvLEBahfasw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GHQrfQDa81Rx/MXEfZ6V0Ib5FbDek0P/mh2u2OSu0psGOci8WDoXu5Sfl9ow1AoCdmUlONqkeFUlVuN0J6Sw9DlZHLI2a3eMrbOr7dpUB1T+0ZufWzBVLPkuUA7xV0kCf4n2S12vUb7LfBznT0d0SVRg9/04jJUJsOUUgvO0DlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H5Z85cPl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H5Z85cPl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4375C4CEF6; Fri, 14 Mar 2025 19:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980573; bh=omUmkLw0f0UbB3xgJ3lIhVidBc43HYclIvLEBahfasw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5Z85cPlgN87BEBpHwuOFpdb9stmTcetB2tbkHrIRzsrfHG1SPoMf2+tKb/+NLvgb y+Qq8C7W4Ob8ze3pSOA73Ra+PjvwiKJJgFsUECETBgzdS/AsjCjKp9qIKXd2MWQxNc zfaAJParRwzw0F1XTTEMpeYfU9mtvBhmD4OhtIa7ZT0NYt8fpiGFSvf0gqVzmT1cq0 GunYXHqWyHtekJjFa5+3oorRvHFDAolXJJ3IE5cavRAzLke8u1eFpzDZbYwIschck8 c2rB0PxtulVErNef9bvJ8CbKQlFIFfzta7VUHEcoNQQMtPdVE50l0wUQ9NzXeHGaGY DDvoAoNrCe9NQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 11/13] objtool: Change "warning:" to "error:" for --Werror Date: Fri, 14 Mar 2025 12:29:09 -0700 Message-ID: <56f0565b15b4b4caa9a08953fa9c679dfa973514.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is similar to GCC's behavior and makes it more obvious why the build failed. Suggested-by: Nathan Chancellor Signed-off-by: Josh Poimboeuf Reviewed-by: Brendan Jackman Reviewed-by: Miroslav Benes --- tools/objtool/include/objtool/warn.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index 6180288927fd..e72b9d630551 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -43,8 +43,10 @@ static inline char *offstr(struct section *sec, unsigned= long offset) =20 #define WARN(format, ...) \ fprintf(stderr, \ - "%s: warning: objtool: " format "\n", \ - objname, ##__VA_ARGS__) + "%s: %s: objtool: " format "\n", \ + objname, \ + opts.werror ? "error" : "warning", \ + ##__VA_ARGS__) =20 #define WARN_FUNC(format, sec, offset, ...) \ ({ \ --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8740920C48F for ; Fri, 14 Mar 2025 19:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980573; cv=none; b=gbFuMsCj2G3NCbfMycmG/EvXzsItjYrWpBH5gw3tuWwTL2z/zPm+w9nwZ4E/JoGcGRoYStB8Z5Vf+FxDcjmLWeJhrGQHKoLdkYFIUk2Lm15qDDRBAkMQJEhRwDVyHysNrwielwE3SzsZGa5UWwYFvy/TdGAuMpxUbQfa/dI8N6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980573; c=relaxed/simple; bh=9nv1OxK1s2FTQoqzonluNC3zr/QvLG9y28cu2p9xJRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tx44vStHNg9oyy3R+OD8XFbabr1MLXcgZ8WZcdyQ69nUiTgitjQXwTDb8HUMP2BUQUmQutk0qoQRFdoCT6X2urx0FO66RN5He9PL9eq/tvww/m+ny7aIduiLyssL8mIaw0KeSfzOrRXswgleYq0QEgW9/Eu+6vJAViFsoxTRFZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XUJXPXLt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XUJXPXLt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B9ABC4CEF4; Fri, 14 Mar 2025 19:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980573; bh=9nv1OxK1s2FTQoqzonluNC3zr/QvLG9y28cu2p9xJRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUJXPXLtG6G7QOf5GvZsXLbN2IjW5phKl0hB0JRX2sJoRIEH8Sd/dvMsEDGAXBT6p TqqsP/8CdtL3wa7J0tjJZd8NYzBuYU8eQ8afRjv2CnV7yF5dutEuvTfORgHhC9G376 ItLqEWuF6hpoSSRxfUoQOWWjn/QqVmyvKYxnBEklO8mUfAtMtnXzcE9CYuO6ZvM3J+ tvojP9z+yeZV/BuGgdTdxEeazl62iQIzfXxsITNuvn18T7+lz0/wMnEzXHvp6m94ov fzkHycg59T7Q1aqvpBY3ULbxaqYfVvJuHinGNv3RNsFbwlksu3+T9W0oQ034C5zyKT CdqUwPN2E5liQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 12/13] objtool: Create backup on error and print args Date: Fri, 14 Mar 2025 12:29:10 -0700 Message-ID: <7571e30636359b3e173ce6e122419452bb31882f.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Recreating objtool errors can be a manual process. Kbuild removes the object, so it has to be compiled or linked again before running objtool. Then the objtool args need to be reversed engineered. Make that all easier by automatically making a backup of the object file on error, and print a modified version of the args which can be used to recreate. Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes --- tools/objtool/builtin-check.c | 68 +++++++++++++++++++++++-- tools/objtool/include/objtool/builtin.h | 1 - tools/objtool/objtool.c | 63 ----------------------- 3 files changed, 65 insertions(+), 67 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index c201650efe49..39ddca64cb58 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -91,7 +91,6 @@ static const struct option check_options[] =3D { =20 OPT_GROUP("Options:"), OPT_BOOLEAN(0, "backtrace", &opts.backtrace, "unwind on error"), - OPT_BOOLEAN(0, "backup", &opts.backup, "create .orig files before modif= ication"), OPT_BOOLEAN(0, "dry-run", &opts.dryrun, "don't write modifications"), OPT_BOOLEAN(0, "link", &opts.link, "object is a linked object"), OPT_BOOLEAN(0, "module", &opts.module, "object is part of a kernel modu= le"), @@ -228,10 +227,39 @@ static int copy_file(const char *src, const char *dst) return 0; } =20 +static char **save_argv(int argc, const char **argv) +{ + char **orig_argv; + + orig_argv =3D calloc(argc, sizeof(char *)); + if (!orig_argv) { + perror("calloc"); + return NULL; + } + + for (int i =3D 0; i < argc; i++) { + orig_argv[i] =3D strdup(argv[i]); + if (!orig_argv[i]) { + perror("strdup"); + return NULL; + } + }; + + return orig_argv; +} + +#define ORIG_SUFFIX ".orig" + int objtool_run(int argc, const char **argv) { struct objtool_file *file; - int ret; + char *backup =3D NULL; + char **orig_argv; + int ret =3D 0; + + orig_argv =3D save_argv(argc, argv); + if (!orig_argv) + return 1; =20 cmd_parse_options(argc, argv, check_usage); =20 @@ -271,8 +299,42 @@ int objtool_run(int argc, const char **argv) return 0; =20 err: - if (opts.output) + if (opts.dryrun) + goto err_msg; + + if (opts.output) { unlink(opts.output); + goto err_msg; + } + + /* + * Make a backup before kbuild deletes the file so the error + * can be recreated without recompiling or relinking. + */ + backup =3D malloc(strlen(objname) + strlen(ORIG_SUFFIX) + 1); + if (!backup) { + perror("malloc"); + return 1; + } + + strcpy(backup, objname); + strcat(backup, ORIG_SUFFIX); + if (copy_file(objname, backup)) + return 1; + +err_msg: + fprintf(stderr, "%s", orig_argv[0]); + + for (int i =3D 1; i < argc; i++) { + char *arg =3D orig_argv[i]; + + if (backup && !strcmp(arg, objname)) + fprintf(stderr, " %s -o %s", backup, objname); + else + fprintf(stderr, " %s", arg); + } + + fprintf(stderr, "\n"); =20 return 1; } diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/includ= e/objtool/builtin.h index b18f114cdaa4..0fafd0f7a209 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -29,7 +29,6 @@ struct opts { =20 /* options: */ bool backtrace; - bool backup; bool dryrun; bool link; bool mnop; diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index 53cd881c6b95..1c73fb62fd57 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -20,64 +20,6 @@ bool help; =20 static struct objtool_file file; =20 -static bool objtool_create_backup(const char *_objname) -{ - int len =3D strlen(_objname); - char *buf, *base, *name =3D malloc(len+6); - int s, d, l, t; - - if (!name) { - perror("failed backup name malloc"); - return false; - } - - strcpy(name, _objname); - strcpy(name + len, ".orig"); - - d =3D open(name, O_CREAT|O_WRONLY|O_TRUNC, 0644); - if (d < 0) { - perror("failed to create backup file"); - return false; - } - - s =3D open(_objname, O_RDONLY); - if (s < 0) { - perror("failed to open orig file"); - return false; - } - - buf =3D malloc(4096); - if (!buf) { - perror("failed backup data malloc"); - return false; - } - - while ((l =3D read(s, buf, 4096)) > 0) { - base =3D buf; - do { - t =3D write(d, base, l); - if (t < 0) { - perror("failed backup write"); - return false; - } - base +=3D t; - l -=3D t; - } while (l); - } - - if (l < 0) { - perror("failed backup read"); - return false; - } - - free(name); - free(buf); - close(d); - close(s); - - return true; -} - struct objtool_file *objtool_open_read(const char *filename) { if (file.elf) { @@ -89,11 +31,6 @@ struct objtool_file *objtool_open_read(const char *filen= ame) if (!file.elf) return NULL; =20 - if (opts.backup && !objtool_create_backup(objname)) { - WARN("can't create backup file"); - return NULL; - } - hash_init(file.insn_hash); INIT_LIST_HEAD(&file.retpoline_call_list); INIT_LIST_HEAD(&file.return_thunk_list); --=20 2.48.1 From nobody Wed Dec 17 18:59:16 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E194D20DD45 for ; Fri, 14 Mar 2025 19:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980574; cv=none; b=OBmq+uy5JaoqrSlzLxVCaAHRJd370KPIaw/JL6PQC3Sr7YxRA1eXQ4/R2t87F8vWYlNFiRwwy52v077keDr58kj9CEYTkrT+osO9vU1t4u8kB+5t0FNx4DCus0rV0CaTHomSMcnj2xph3XqM7GuPkZLWrzrBJP6nxiEDiy6bItE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741980574; c=relaxed/simple; bh=MuEUQXRk4MGKZ+To5bORRPLRoNHakjJEWiddaL41TJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bm9SS2FpwSo8enYHdVvu/qgmTGs37jeNTsYLc4IRD59KO33LAqeLxMRQyQJV3aKm7CPl2ESg3LvmpKkLF/arqNWmTvyyjHjIMm6qjVQAas8baGsuAe5Wvbl0jRBsVTPIEQ0AccuNm2CIJoyDWKGt+zNzRVE/o8zrVw5dBp8yajI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cuZYKOeF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cuZYKOeF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8529FC4CEEC; Fri, 14 Mar 2025 19:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741980573; bh=MuEUQXRk4MGKZ+To5bORRPLRoNHakjJEWiddaL41TJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuZYKOeFT39LOsL9h+w7Ag+3V8hADSWC1DjT8PERQwD+q2+ykQJ+qVV2WZd23XQiM 1EipFpDf2edZzLvtEsSiplQlo5Lnge7qNAKMfDdHXCbKerueX84yynK8aG3MtMGzX7 qhepZGzLKwKjxve0tXT9+DiR+JOaIkKk3WhA652CfSjOb4NYV8Sw2gkjDLywbMXxoS Hp8MQF10SbSBaDNIjSVVLs3coiQ+vIHzKnKnnFnUKseVg46DzIXCB242tH30dNIoTF vqmYouOrNNFl2mLLbLuyK/3jXwg4lbpttdFGn+qGukYiYokHMS1DZQ3ZAi3vOya3df wXQ30p37vM7IQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Brendan Jackman , Nathan Chancellor Subject: [PATCH 13/13] objtool: Add CONFIG_OBJTOOL_WERROR Date: Fri, 14 Mar 2025 12:29:11 -0700 Message-ID: <3e7c109313ff15da6c80788965cc7450115b0196.1741975349.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Objtool warnings can be indicative of crashes, broken live patching, or even boot failures. Ignoring them is not recommended. Add CONFIG_OBJTOOL_WERROR to upgrade objtool warnings to errors by enabling the objtool --Werror option. Also set --backtrace to print the branches leading up to the warning, which can help considerably when debugging certain warnings. To avoid breaking bots too badly for now, make it the default for real world builds only (!COMPILE_TEST). Co-developed-by: Brendan Jackman Signed-off-by: Josh Poimboeuf Reviewed-by: Miroslav Benes --- lib/Kconfig.debug | 12 ++++++++++++ scripts/Makefile.lib | 1 + 2 files changed, 13 insertions(+) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 35796c290ca3..bbfb9d575f97 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -545,6 +545,18 @@ config FRAME_POINTER config OBJTOOL bool =20 +config OBJTOOL_WERROR + bool "Upgrade objtool warnings to errors" + default y + depends on OBJTOOL && !COMPILE_TEST + help + Fail the build on objtool warnings. + + Objtool warnings can indicate kernel instability, including boot + failures. This option is highly recommended. + + If unsure, say Y. + config STACK_VALIDATION bool "Compile-time stack metadata validation" depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index cad20f0e66ee..99e281966ba3 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -277,6 +277,7 @@ objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) +=3D --= static-call objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) +=3D --uaccess objtool-args-$(CONFIG_GCOV_KERNEL) +=3D --no-unreachable objtool-args-$(CONFIG_PREFIX_SYMBOLS) +=3D --prefix=3D$(CONFIG_FUNCTION_= PADDING_BYTES) +objtool-args-$(CONFIG_OBJTOOL_WERROR) +=3D --Werror --backtrace =20 objtool-args =3D $(objtool-args-y) \ $(if $(delay-objtool), --link) \ --=20 2.48.1