From nobody Thu Apr 9 23:22:36 2026 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 6966C1ACEDE; Thu, 5 Mar 2026 03:31:45 +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=1772681505; cv=none; b=M22H8Iu8LFJZyRLNfG9bOitMQsWbpagbgvjPvl4hCaKTzeCGfa4ZG5hED+Cb7gWM/iPWIl+4Y2rncajbxxbBKypTni91MzxbRaYw5AHrMqUXFo2Awqk1YtwwaXXEBhU7RMve+oRTdfLcBykRAwlWGyGmxOxNE3uwQHNowuhcLyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681505; c=relaxed/simple; bh=F51eVpZxhFC3Gpzdnw33QNuA5g1SCpkt9olp+lxSzPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dJcNKd/TaV516uAofl2N2KrB8FZUjwU5t0PlSe/wsz3lhzzaFLN1IOONkpvVlgjf1og1uyVGdQGMWVhoWbxa51dF/DaVy4cqPYmO2VLj9RJOLfo4X9cidm/plROx5QGejJT4ZfKPvDReJ/xOQ28jiGLxLsw+20NfjlbPixUZDaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V9fJWr+8; 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="V9fJWr+8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6078BC19422; Thu, 5 Mar 2026 03:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681505; bh=F51eVpZxhFC3Gpzdnw33QNuA5g1SCpkt9olp+lxSzPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9fJWr+8/EYPgIy+nETT92JCLwy6misPFQtAuPPQjaN/shMLhthGzvGUlIz26UhZB vyvuAlAa3HyYSIzfTwQWX1WXdVVHZbCz9p+BviQ9rZprx84nf9qV/3FLv+igNKDtmT jda1IQQ0zXeVxffPxZNNypJHra8zALLENpoVhNwgQuC1GWp5umsoNHHDQUzLaSIO99 eFgCOk2H39DWNa/WqdVdkvemh0mS1pSyOobj4mg4KFLV0njFJ6Lg9vEsJ0zpxey1uJ 5THwDsZo1sG6R2kBcy72RnHiuv/HwUCTCxctG71bsm8gbp7NWog37iHB9z9fWU5HHV NsM5El/vPn9sw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 01/14] objtool: Fix data alignment in elf_add_data() Date: Wed, 4 Mar 2026 19:31:20 -0800 Message-ID: X-Mailer: git-send-email 2.53.0 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 data added to a section needs to be aligned in accordance with the section's sh_addralign value. Particularly strings added to a .str1.8 section. Otherwise you may get some funky strings. Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffin= g object files") Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 2c02c7b49265..3da90686350d 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1375,7 +1375,7 @@ void *elf_add_data(struct elf *elf, struct section *s= ec, const void *data, size_ memcpy(sec->data->d_buf, data, size); =20 sec->data->d_size =3D size; - sec->data->d_align =3D 1; + sec->data->d_align =3D sec->sh.sh_addralign; =20 offset =3D ALIGN(sec->sh.sh_size, sec->sh.sh_addralign); sec->sh.sh_size =3D offset + size; --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 6E38726E71F; Thu, 5 Mar 2026 03:31:46 +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=1772681506; cv=none; b=k8wUxH5vpHep64HvKIx6vegfdjdES8wJEmg7Rxkijq0zxkYnwsanqqLM5/Tl2qQI0jSGXoAq0DZNdMflW/K2ErqtIyFdcbL2HiCQy2MJJ4OJoYGdgF1f/m2wTFMcFmlGyGPkVqvhN0J3mrvreJqeqJvILAwBHMOL6VT9JxYx8+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681506; c=relaxed/simple; bh=uw8loNTdetJKJb0ecjjs3Ff+STe7ASk8f759M6OLnzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xk/8aeHA7De0TiGYfIfX4LrNOgKyE7lJBf6OveNNbTgoaDeHCWL+WKP5d2HCPR/lFVbIXGcxAo/IEIZufMtlWAmLCtVV1Kbd3LKjARFCYbVX7cEa6UR+12s5PE8Kx8uCbuqDGBCeklen94a2wmlj1Kr+Z57Grj5ae0stx2+cLmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bG6B1eBa; 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="bG6B1eBa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65A26C2BC9E; Thu, 5 Mar 2026 03:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681506; bh=uw8loNTdetJKJb0ecjjs3Ff+STe7ASk8f759M6OLnzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bG6B1eBayupZYr06CVbq6jITb5ZWNrMTkugVPMLEV56qbUM/nzPPBUKnVBwneACmN sJsv9K8425eeguY7bLhGYQq7MNpbnfFYMGVs86/pvokhgK3v2xo16VRGq2rBg2YvfQ 7W5/8MFGo9qXmyxBQfqVdSzEvJ/VFSvDLU5MMZKJsV7+sLgQ19hql7ZYX0Bc95mxgj iIv7trv1roF1PTRKIOkb7jpcICna2KJd55vzsNjOuHQlqxrPZnzdNE6IbBYrqgOWHG 3LppCxN2krnh+IixH2pX66qufhL1YhpYDXImJw5UX6INk1XJYxbtUlEbNhW89iZtQQ NeoOOrNFBP/Iw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 02/14] objtool: Fix ERROR_INSN() error message Date: Wed, 4 Mar 2026 19:31:21 -0800 Message-ID: X-Mailer: git-send-email 2.53.0 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" Confusingly, ERROR_INSN() shows "warning:" instead of "error:". Fix that. Signed-off-by: Josh Poimboeuf --- tools/objtool/include/objtool/warn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/o= bjtool/warn.h index 2b27b54096b8..fa8b7d292e83 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -107,7 +107,7 @@ static inline char *offstr(struct section *sec, unsigne= d long offset) #define ERROR_ELF(format, ...) __WARN_ELF(ERROR_STR, format, ##__VA_ARGS__) #define ERROR_GLIBC(format, ...) __WARN_GLIBC(ERROR_STR, format, ##__VA_AR= GS__) #define ERROR_FUNC(sec, offset, format, ...) __WARN_FUNC(ERROR_STR, sec, o= ffset, format, ##__VA_ARGS__) -#define ERROR_INSN(insn, format, ...) WARN_FUNC(insn->sec, insn->offset, f= ormat, ##__VA_ARGS__) +#define ERROR_INSN(insn, format, ...) ERROR_FUNC(insn->sec, insn->offset, = format, ##__VA_ARGS__) =20 extern bool debug; extern int indent; --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 87DCB20CCE4; Thu, 5 Mar 2026 03:31:47 +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=1772681507; cv=none; b=CdTZLV1vvhpx2oYcK8ZcIs2Sx5QhPObOutcHzPYc21o+IEDSoZqYK4ZXQF1FlBA75lyInoaFkKkhpfhs2Cs3naHsBnAXOYrPOTCM+4MyNWYNkkjz6NA2CrZ59ELGwfA5T69DzuTOQH138nyid4+Gi0m3/HuLciA+rdGgk+SZG/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681507; c=relaxed/simple; bh=Lly+R/jrWXObFqx210gTdFxMEi6szRFOEEE+yXvt8TQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ecSZWEsciGOXbJnqLA8mIHl2S1QDAPAvIPck46ad4ghtd7t6lD6tho8Ybl3joWnwm/Mh4NDvZirKCZ7v6dagSSRq9CS4sMhKPpKLA2300MFx1VCvWrpYlL87m750LAtCCQhKdhAXdzDw+c1nQy9z32E1pZjoXaaAIVDf40kdd94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K+RWL5DJ; 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="K+RWL5DJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 659D7C116C6; Thu, 5 Mar 2026 03:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681507; bh=Lly+R/jrWXObFqx210gTdFxMEi6szRFOEEE+yXvt8TQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+RWL5DJduqwWgMhcwPWpJFat7vD1Yin2T38SibOq2/ELzMaX65bTLsh7nczpmiMY FUYTJTQZFMr/3Y20XdxBpgQh6ga4gMAN9TD6YTIlKmPMfluDucwBIg/im90XyHwUGN dCWwDgYMbwvdKiEJQUeZ+vcVtGmakGXccXE/dIMtpgW0a9LwZgh5yHeRlC4poe2HGw SLlnb7Do0IBIDwQQY7U9TDKRAvA3X9RpuQlxMDN4FIdEI/NECs42ptLbcGjQ+6mmAo ayh23UoCs0PnyZWSMTWd6+lT6z7GLaSADU8BFhEAzwb8MTg7nm0O6apSLFCjCB2tq/ uaTTXOoCPBFAA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 03/14] arm64: Annotate intra-function calls Date: Wed, 4 Mar 2026 19:31:22 -0800 Message-ID: <2fa6fbde8c6bbd91df0e2bf48b9c9370047dc61e.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" In preparation for enabling objtool on arm64, annotate intra-function calls. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- arch/arm64/kernel/entry.S | 2 ++ arch/arm64/kernel/proton-pack.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index f8018b5c1f9a..cf808bb2abc0 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -10,6 +10,7 @@ #include #include #include +#include =20 #include #include @@ -707,6 +708,7 @@ alternative_else_nop_endif * entry onto the return stack and using a RET instruction to * enter the full-fat kernel vectors. */ + ANNOTATE_INTRA_FUNCTION_CALL bl 2f b . 2: diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pac= k.c index b3801f532b10..b63887a1b823 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 #include #include @@ -245,11 +246,12 @@ static noinstr void qcom_link_stack_sanitisation(void) { u64 tmp; =20 - asm volatile("mov %0, x30 \n" - ".rept 16 \n" - "bl . + 4 \n" - ".endr \n" - "mov x30, %0 \n" + asm volatile("mov %0, x30 \n" + ".rept 16 \n" + ANNOTATE_INTRA_FUNCTION_CALL " \n" + "bl . + 4 \n" + ".endr \n" + "mov x30, %0 \n" : "=3D&r" (tmp)); } =20 --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 CDEC327E1C5; Thu, 5 Mar 2026 03:31:48 +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=1772681508; cv=none; b=P1htqUlXqZG483OI0VnMDCpyiLPPNxZS1pLuMZdijEjRq4/7k1AsEYOj7g+OfPzO7C60k7rZhy3R9E5ojm11afm/0hm8qMsN+XCwk0FMY4jp/X9qY/cQf9P5Nxp2eJmxEQ09L2aHczrq8YpnBPsK9yGp9K1bNuaTwjyOKo6pQ9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681508; c=relaxed/simple; bh=ZlgKzEodeo2h7xrj6+yOcZaTPgylpV+16ZQbZgUDqcg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RgCfLF6NSzHXLTQlMJ5Ir4ul7snVf+5szdXfk2mylATx/j2euOrok8JhFbYVtCYqQPXVV8nj417+tXKK8/mwabTggy3LLg0GStGnOq+/zrK7qm5xp5bdomqz7a7Cytptj7lyX8kd7sqXpkkC0hu+GwZAkW7F+u55my7OOiTqdqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mf1Z2e4t; 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="Mf1Z2e4t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AF69C2BCB0; Thu, 5 Mar 2026 03:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681508; bh=ZlgKzEodeo2h7xrj6+yOcZaTPgylpV+16ZQbZgUDqcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mf1Z2e4tuic6+UzuCaVI+uWZg38Ul6M59lDO7FSFfzX7kdZdGwNm7SDFVjxF+roSe qXH+rL5lueLltX36zmxf2bbqFxYrjDDPg2fyx7xXtjtq99NSMhP+1BizHKTpe3aFvf EgkW+EDCmDNY/Sz94H639/MruYVzjqWVGUb2dKRYgK7ZcypU9vMXGuAUHWxQzwEUJJ lyLXjkNlM2O9AR2ppkUwb+KNSmBxDpAVPcoqvJyYo/RD6gieLRWNS54aV17A6eb5oq OpnGvKyDzMJMkhvYX+J8G/Dg9GMAUJXu0PcV+AtUw8h98nYswEY8r97EKMRW+KDpDQ IVcFZYAfVaYQQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 04/14] arm64: head: Move boot header to .head.data Date: Wed, 4 Mar 2026 19:31:23 -0800 Message-ID: X-Mailer: git-send-email 2.53.0 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 arm64 boot header is mostly data. Move it to a data section to prevent objtool and other tools from trying to disassemble it. The final linked result is the same. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- arch/arm64/kernel/head.S | 2 +- include/asm-generic/vmlinux.lds.h | 2 +- include/linux/init.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 87a822e5c4ca..0681c6e50859 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -54,7 +54,7 @@ * that are useful before the MMU is enabled. The allocations are described * in the entry routines. */ - __HEAD + __HEADDATA /* * DO NOT MODIFY. Image header expected by Linux boot-loaders. */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index eeb070f330bd..51a0e5974f41 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -663,7 +663,7 @@ __static_call_text_end =3D .; =20 /* Section used for early init (in .S files) */ -#define HEAD_TEXT KEEP(*(.head.text)) +#define HEAD_TEXT KEEP(*(.head.data .head.text)) =20 #define HEAD_TEXT_SECTION \ .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ diff --git a/include/linux/init.h b/include/linux/init.h index 40331923b9f4..91e16f3205e2 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -90,6 +90,7 @@ =20 /* For assembly routines */ #define __HEAD .section ".head.text","ax" +#define __HEADDATA .section ".head.data","aw" #define __INIT .section ".init.text","ax" #define __FINIT .previous =20 --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 3A241280309; Thu, 5 Mar 2026 03:31:49 +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=1772681510; cv=none; b=PxKwq3z2Zf+RWZ1aoszHpyLsMAZN2GNEgcGfHwnIAhGj3yQzQFT6yUn7fBIY4FnxkTKkKn+OwbRWTiq8SpI6M4gZ1ORkPoh84BSS2PuB1fjDUeIZ6DdgI5w3SAo8SXhENbu6YXtPwlnrIbJ6i67HOgpUfHbtpEigP8rkMIcOYHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681510; c=relaxed/simple; bh=5NJSqLWQvTCeEjYLw+cyVI09fAwxwdSEOs9zrhOHrJo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yat9/x7Ntb9QVyWztlQ6n969TUZuDAL7je7ZkejiBAz6x/2gTkuEskGfD/zS4X+HZFOx1SjUiHESv4XyQQ6XjNGWiHm/Z4x8LVD+O1iFhHpLxVr6G/RUnCWc6feRWW/uyy1jWmmdJtvfgvs+ngbSrRSfAk+w1FoWijgRFtUYIH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QtaioH7Z; 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="QtaioH7Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE1D8C19422; Thu, 5 Mar 2026 03:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681509; bh=5NJSqLWQvTCeEjYLw+cyVI09fAwxwdSEOs9zrhOHrJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtaioH7ZbYcBhZZK3Jp83z+yQIQU1Phpz2iH8jV+jk6PMMMOhry84JoME+vpEjQ3A AzxbTlbjEeJrRK+fkuaGKCoU/5ahlSShNuGHdFUC5mBSDjFb+qgfrQtBSPNr0ttWi/ y9kKrz+fYMCZ6i5nn/1EBEVhGd1Tpqo9RtxlMcTu/Kr8Btr25oPRvQbQfFw/vs2LAi +MA3o6OyUeadSngMuz+CA3wlwdg52krarBeNF0WNDchwSxmYeW+QFutPtVMi4EfD0X Alm0bIK9chbCzEUHwpn+q0DKpTeZJAaBNdjOkzITqAVZsdws5hNxAcQsTuOQpU8C6+ WTieenc6WUPQQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 05/14] arm64: Fix EFI linking with -fdata-sections Date: Wed, 4 Mar 2026 19:31:24 -0800 Message-ID: X-Mailer: git-send-email 2.53.0 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" When building with func-fdata-sections, the .init.bss section gets split up into a bunch of .init.bss. sections. Make sure they get linked into .init.data. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- arch/arm64/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.ld= s.S index ad6133b89e7a..1f5e4f996a21 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -269,7 +269,7 @@ SECTIONS INIT_CALLS CON_INITCALL INIT_RAM_FS - *(.init.altinstructions .init.bss) /* from the EFI stub */ + *(.init.altinstructions .init.bss .init.bss.*) /* from the EFI stub */ } .exit.data : { EXIT_DATA --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 3F7E117B425; Thu, 5 Mar 2026 03:31:51 +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=1772681511; cv=none; b=ONX0NWIB7CblCelEK2duXqV/4+UQTktHoPlPlNTSW7XLTNTzzrSmGRZ0899S9X8lwK5pK9HXRUlgjL1CZTfi+XUY32wLjbpY20I9AzrTLT/PCxMWVdcRQhfL+sQU31Tq/GkvAaY1PekySD6Qk61LjsG23t/42JBn8IKPksA+dnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681511; c=relaxed/simple; bh=VHYVcG46HDcvFMvnPYNK+XTdXj0sPBym+XtZyAEFC2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bReLBVOob81IsDmidl7c1iU85SyI93HAzLkA+nUovDfT7Q42tfcHH0jux0nbG8ZBBL7vhqEq5qk33PNoy3Go2ZcWXfialvi6zUhjATHryX8g25NruO9KK4lD22MI+UmFO8UNpjnXiqc9vIlSe25X3+4jk/mSIieMvoy6Yu44nTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YOBegSj4; 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="YOBegSj4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EBA4C2BCB1; Thu, 5 Mar 2026 03:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681511; bh=VHYVcG46HDcvFMvnPYNK+XTdXj0sPBym+XtZyAEFC2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOBegSj4bFua+UjhhPwRDV7XNVhh/g3cKxQYIjT6ew5n5CetHZ3r1VPz9EuZCV0Tg swMjoMoh53oWoDa09zYVhImN91Zp1NCMiEJQrZRqI0Q++rkV9WtrcQtcbwdPTz/jjY IvPvdLjkNcO6TtKX2LZOOME4Uc9ICEsJcbHX2H8bKve9InN/Qys/3LYRr4Z8keeDb+ YvaE6JwhSE1P/o5t5Ar1CxAnGRUZewumnyrLjtlW/MFNNzk0TuZJb9/XPVbpCYk5bN +16QWy0tFMJT63+G0nCMqXwQOhKz0uRWj/AGumH4ZQfGoRhnjwY39auhvx7quWclaO htiUQKywMIsBw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 06/14] crypto: arm64: Move data to .rodata Date: Wed, 4 Mar 2026 19:31:25 -0800 Message-ID: <8060fb1dec9eff0927f999389b62957ca9dac675.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" Data embedded in .text pollutes i-cache and confuses objtool and other tools that try to disassemble it. Move it to .rodata. Signed-off-by: Josh Poimboeuf --- lib/crypto/arm64/sha2-armv8.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/crypto/arm64/sha2-armv8.pl b/lib/crypto/arm64/sha2-armv8.pl index 35ec9ae99fe1..8cd86768bf5c 100644 --- a/lib/crypto/arm64/sha2-armv8.pl +++ b/lib/crypto/arm64/sha2-armv8.pl @@ -237,7 +237,8 @@ $code.=3D<<___; ldp $E,$F,[$ctx,#4*$SZ] add $num,$inp,$num,lsl#`log(16*$SZ)/log(2)` // end of input ldp $G,$H,[$ctx,#6*$SZ] - adr $Ktbl,.LK$BITS + adrp $Ktbl,.LK$BITS + add $Ktbl,$Ktbl,:lo12:.LK$BITS stp $ctx,$num,[x29,#96] =20 .Loop: @@ -286,6 +287,7 @@ $code.=3D<<___; ret .size $func,.-$func =20 +.pushsection .rodata .align 6 .type .LK$BITS,%object .LK$BITS: @@ -365,6 +367,7 @@ $code.=3D<<___; #endif .asciz "SHA$BITS block transform for ARMv8, CRYPTOGAMS by " .align 2 +.popsection ___ =20 if ($SZ=3D=3D4) { @@ -385,7 +388,8 @@ sha256_block_armv8: add x29,sp,#0 =20 ld1.32 {$ABCD,$EFGH},[$ctx] - adr $Ktbl,.LK256 + adrp $Ktbl,.LK256 + add $Ktbl,$Ktbl,:lo12:.LK256 =20 .Loop_hw: ld1 {@MSG[0]-@MSG[3]},[$inp],#64 @@ -648,7 +652,8 @@ sha256_block_neon: mov x29, sp sub sp,sp,#16*4 =20 - adr $Ktbl,.LK256 + adrp $Ktbl,.LK256 + add $Ktbl,$Ktbl,:lo12:.LK256 add $num,$inp,$num,lsl#6 // len to point at the end of inp =20 ld1.8 {@X[0]},[$inp], #16 --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 BFE93283FD8; Thu, 5 Mar 2026 03:31:52 +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=1772681512; cv=none; b=ILky6Lr324/Rw2CczhTQNGive9Rd/7P59aIqda9BP0dSqdwUS5D4k8nUdWBqukd+N8Y8+LwYOeBHufN5MAlhJWiNySjUPX4n87ak8h/SXDpM8q23gWgR7bdF446dEqkavj2ieyxGTy78T/K0HP7v0+KGoF/RoPqmt7HmySUy17k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681512; c=relaxed/simple; bh=ADXWqrae8tD6YOBhZxjrPHy9oL8O7xj7H69iC9u6dCs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g0uT3Q/FUcPh0Y3maxpBK4kRE2w9Wd45IrzZlaQLADcQfJz93/nBtruZHFkIPdXp0v28FsOgu2T1ffrkT1FUy6IhHmmLqgYuNDAbuKkJXarhSm2LmH8RCLaMW8/BH/YZkCEFNUBYytEnLCzddSHys2Rq9Li2xQH41DtI43x3pOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VXogCV+g; 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="VXogCV+g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54063C2BCB9; Thu, 5 Mar 2026 03:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681512; bh=ADXWqrae8tD6YOBhZxjrPHy9oL8O7xj7H69iC9u6dCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXogCV+gsXplNUnHAX0EhrXtvFtCY0kZ9SFnCx7fP6A5vxmNEx9jGVJsc3mEj8HV7 Q8/0fyZvGbxrtjd3qOaNy2DI3LXh467G829vL9GxFozG61ehPOlrjVWtXtO8UCCkfN aeMqMEJ0tpyPeNdG6ZttiWDu7IHqFprKNNSbBogCoEW/1IHiVyHnmTYcmZztZF/wFc ZPzPHLg1/SR0VcqEG4/bHVM9dEetv+M5MqQndEGNL/YcR7qhj79N8OF08B3rxBp2AP Z58qDayQf/42nEfQq3ub66FX1uR6DQd+23buH7qWyoM4xXENIhhsH9X45cxAbKjmOc TFecJykpOLcbw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 07/14] objtool: Extricate checksum calculation from validate_branch() Date: Wed, 4 Mar 2026 19:31:26 -0800 Message-ID: <7a1e22454a3fd1d968775c24aa0529a4ec7c5886.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" In preparation for porting the checksum code to other arches, make its functionality independent from validate_branch(). Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 71 +++++++++++++++++------- tools/objtool/include/objtool/checksum.h | 6 +- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index a30379e4ff97..f73cf1382e5c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2633,8 +2633,7 @@ static bool validate_branch_enabled(void) { return opts.stackval || opts.orc || - opts.uaccess || - opts.checksum; + opts.uaccess; } =20 static int decode_sections(struct objtool_file *file) @@ -3649,6 +3648,7 @@ static bool skip_alt_group(struct instruction *insn) return alt_insn->type =3D=3D INSN_CLAC || alt_insn->type =3D=3D INSN_STAC; } =20 +#ifdef BUILD_KLP static int checksum_debug_init(struct objtool_file *file) { char *dup, *s; @@ -3691,9 +3691,30 @@ static void checksum_update_insn(struct objtool_file= *file, struct symbol *func, struct instruction *insn) { struct reloc *reloc =3D insn_reloc(file, insn); + struct alternative *alt; unsigned long offset; struct symbol *sym; =20 + for (alt =3D insn->alts; alt; alt =3D alt->next) { + struct alt_group *alt_group =3D alt->insn->alt_group; + + checksum_update(func, insn, &alt->type, sizeof(alt->type)); + + if (alt_group && alt_group->orig_group) { + struct instruction *alt_insn; + + checksum_update(func, insn, &alt_group->feature, sizeof(alt_group->feat= ure)); + + for (alt_insn =3D alt->insn; alt_insn; alt_insn =3D next_insn_same_sec(= file, alt_insn)) { + checksum_update_insn(file, func, alt_insn); + if (alt_insn =3D=3D alt_group->last_insn) + break; + } + } else { + checksum_update(func, insn, &alt->insn->offset, sizeof(alt->insn->offse= t)); + } + } + if (insn->fake) return; =20 @@ -3702,9 +3723,11 @@ static void checksum_update_insn(struct objtool_file= *file, struct symbol *func, if (!reloc) { struct symbol *call_dest =3D insn_call_dest(insn); =20 - if (call_dest) + if (call_dest) { + /* intra-TU call without reloc */ checksum_update(func, insn, call_dest->demangled_name, strlen(call_dest->demangled_name)); + } return; } =20 @@ -3731,6 +3754,29 @@ static void checksum_update_insn(struct objtool_file= *file, struct symbol *func, checksum_update(func, insn, &offset, sizeof(offset)); } =20 +static int calculate_checksums(struct objtool_file *file) +{ + struct instruction *insn; + struct symbol *func; + + if (checksum_debug_init(file)) + return -1; + + for_each_sym(file->elf, func) { + if (!is_func_sym(func)) + continue; + + checksum_init(func); + + func_for_each_insn(file, func, insn) + checksum_update_insn(file, func, insn); + + checksum_finish(func); + } + return 0; +} +#endif /* BUILD_KLP */ + static int validate_branch(struct objtool_file *file, struct symbol *func, struct instruction *insn, struct insn_state state); static int do_validate_branch(struct objtool_file *file, struct symbol *fu= nc, @@ -4012,9 +4058,6 @@ static int do_validate_branch(struct objtool_file *fi= le, struct symbol *func, insn->trace =3D 0; next_insn =3D next_insn_to_validate(file, insn); =20 - if (opts.checksum && func && insn->sec) - checksum_update_insn(file, func, insn); - if (func && insn_func(insn) && func !=3D insn_func(insn)->pfunc) { /* Ignore KCFI type preambles, which always fall through */ if (is_prefix_func(func)) @@ -4080,9 +4123,6 @@ static int validate_unwind_hint(struct objtool_file *= file, struct symbol *func =3D insn_func(insn); int ret; =20 - if (opts.checksum) - checksum_init(func); - ret =3D validate_branch(file, func, insn, *state); if (ret) BT_INSN(insn, "<=3D=3D=3D (hint)"); @@ -4525,9 +4565,6 @@ static int validate_symbol(struct objtool_file *file,= struct section *sec, =20 func =3D insn_func(insn); =20 - if (opts.checksum) - checksum_init(func); - if (opts.trace && !fnmatch(opts.trace, sym->name, 0)) { trace_enable(); TRACE("%s: validation begin\n", sym->name); @@ -4540,9 +4577,6 @@ static int validate_symbol(struct objtool_file *file,= struct section *sec, TRACE("%s: validation %s\n\n", sym->name, ret ? "failed" : "end"); trace_disable(); =20 - if (opts.checksum) - checksum_finish(func); - return ret; } =20 @@ -4997,10 +5031,6 @@ int check(struct objtool_file *file) cfi_hash_add(&init_cfi); cfi_hash_add(&func_cfi); =20 - ret =3D checksum_debug_init(file); - if (ret) - goto out; - ret =3D decode_sections(file); if (ret) goto out; @@ -5091,6 +5121,9 @@ int check(struct objtool_file *file) warnings +=3D check_abs_references(file); =20 if (opts.checksum) { + ret =3D calculate_checksums(file); + if (ret) + goto out; ret =3D create_sym_checksum_section(file); if (ret) goto out; diff --git a/tools/objtool/include/objtool/checksum.h b/tools/objtool/inclu= de/objtool/checksum.h index 7fe21608722a..36a17688c716 100644 --- a/tools/objtool/include/objtool/checksum.h +++ b/tools/objtool/include/objtool/checksum.h @@ -32,11 +32,7 @@ static inline void checksum_finish(struct symbol *func) =20 #else /* !BUILD_KLP */ =20 -static inline void checksum_init(struct symbol *func) {} -static inline void checksum_update(struct symbol *func, - struct instruction *insn, - const void *data, size_t size) {} -static inline void checksum_finish(struct symbol *func) {} +static inline int calculate_checksums(struct objtool_file *file) { return = -ENOSYS; } =20 #endif /* !BUILD_KLP */ =20 --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 E52E917B425; Thu, 5 Mar 2026 03:31:53 +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=1772681514; cv=none; b=RAl9bn/4m9Bh9/8oOMcu1vUxoZ+yZR3Lil4bzthzchU6QlT+vznEIWMU0bRc5NxIO2I2lNGPFKm2RL1utQ17dmk9Qki0GbbRyeuPBcxNuC7vJypRtIeZS6ZtmEc8Z5HpalSAtZ3mbdTUfK6iacY8OK/rfJlsYLh7Szvfb1QmxTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681514; c=relaxed/simple; bh=ppmEZTT0et6+FTja7lnUY1XDuKPDfDpEbcW91C3ymXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DnI6frl+o9HJwLVAdIAhsJJJF8/bdH/uZZnOkbZB+LoLlUejFBtOwkbIFEJNZG/qDQl5oHJAfF/WMkWGCUGUbX74nbWwkAUaJRUfEfUBMVUzRqyIz0wILrQVWZMBRyDlWjuHLzwMxDjzmI0N5TeoW1Tz5XRCvY7Vszgw3GDC084= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h0yu4NsH; 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="h0yu4NsH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90F35C2BC9E; Thu, 5 Mar 2026 03:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681513; bh=ppmEZTT0et6+FTja7lnUY1XDuKPDfDpEbcW91C3ymXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0yu4NsHtO8DNzcJksWB0ZAN+1FdSe4gSfSPR5ulL8YBtTvWbljhqmjMuLJzmTyh5 cZQrn03f0xfFudcFWEDGDC3ndrzA2LIckPKZMUjpPYW4kyt7iTLOMaiA19x7/1WaHk xygjvmxlgVfbq5DKVJcLvM1Z5byXzbrR/EAb5Jo2UZ/Gp0t0tA94rh1cwuU6ITjhiE FG19ExNYAmUgnGwaF/259f9nizSKnULJSElgKQt9IsPmjkdcuS7j6cDLNb+E9vCWwc vsruqPRbKQiIXZizSM17qC+Shc5vD8qmoQSN2I6wRtkKKt3z0VgIZpw/2LhlOXJHpv qvE4EInUL7oNQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 08/14] objtool: Allow setting --mnop without --mcount Date: Wed, 4 Mar 2026 19:31:27 -0800 Message-ID: <696aeb326a797e97b87c7657b5b3d0ada958cc5f.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" Instead of returning an error for --mnop without --mcount, just silently ignore it. This will help simplify kbuild's handling of objtool args. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- 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 b780df513715..f528a58aca74 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -145,11 +145,6 @@ 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; --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 3E9E4279346; Thu, 5 Mar 2026 03:31:55 +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=1772681515; cv=none; b=KGrSEkrCEwGyPD8uqxFT7wZptIh8VCsMj5GWC6M+prqNC5zN+3p8DCSyyRbMitU6q44bV6AYunvZhWnY3fa2dD667tOxtDwHQAk1ydtp4lA6qmfuXFCbOtpEFspCv6qty6EycWPO4lrwxbsWnfjVMS80BlCm8Bs3hqYA9Aj6QiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681515; c=relaxed/simple; bh=2RHHwjHDEfLBZts7gftP8ppQ8P51E1xBhiCigfZjKIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jrK20iDqusf2HXTywfPygsfxRLsPkXtYCh6X2+2baEXusdt6/ssMv/ymTt6sRONGSEBhx8QRhAyzzlDIILZ7NvQXX0rcvV0usSSvihr3LK9rHHbT1kq7mbj9C35SKYVhGZhe32mo90RHqn63HQh2N59vrvdzyV/GpKUaDRPCsUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cfo0/10/; 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="Cfo0/10/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D8EC19422; Thu, 5 Mar 2026 03:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681515; bh=2RHHwjHDEfLBZts7gftP8ppQ8P51E1xBhiCigfZjKIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cfo0/10/eTtxez/EjmHNrZDLUnJaecsM+kHAJbSI7XBEe4gYeKHIwJVgEVtidEPYX C4RnCsY3R806DCdPLtIT78vvseTLwCH+w3DNb2PaAu306Bui1EUN6npvXLE6YR1/d3 2j1m7fIPQwh9BF5RoKdG48iOKVWinRCLyqUQzxQ4VzEZxK164sBltkpw8JI1RWcdus DzD/kVsbK0U44FFs7VlZR6BXaUssGWcoLTqHLIUddl00+LzJfdqlK+cTrrMep+CYqn Oz/SA1xPuEABCq8bVmpaEE+8em8YkFnly6C9QV5QaD/KPC23P1FI555AnHmZrUHB4z gcQdc/PRbL3pA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 09/14] kbuild: Only run objtool if there is at least one command Date: Wed, 4 Mar 2026 19:31:28 -0800 Message-ID: X-Mailer: git-send-email 2.53.0 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" Split the objtool args into commands and options, such that if no commands have been enabled, objtool doesn't run. This is in preparation in enabling objtool and klp-build for arm64. Signed-off-by: Josh Poimboeuf Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor --- arch/x86/boot/startup/Makefile | 2 +- scripts/Makefile.build | 4 +-- scripts/Makefile.lib | 46 ++++++++++++++++++---------------- scripts/Makefile.vmlinux_o | 15 ++++------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile index 5e499cfb29b5..a08297829fc6 100644 --- a/arch/x86/boot/startup/Makefile +++ b/arch/x86/boot/startup/Makefile @@ -36,7 +36,7 @@ $(patsubst %.o,$(obj)/%.o,$(lib-y)): OBJECT_FILES_NON_STA= NDARD :=3D y # relocations, even if other objtool actions are being deferred. # $(pi-objs): objtool-enabled =3D 1 -$(pi-objs): objtool-args =3D $(if $(delay-objtool),--dry-run,$(objtool-arg= s-y)) --noabs +$(pi-objs): objtool-args =3D $(if $(delay-objtool),--dry-run,$(objtool-cmd= s-y) $(objtool-opts-y)) --noabs =20 # # Confine the startup code by prefixing all symbols with __pi_ (for positi= on diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 32e209bc7985..d2d0776df947 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -277,7 +277,7 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT is-standard-object =3D $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$= (target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),$(is-kernel-object)) =20 ifdef CONFIG_OBJTOOL -$(obj)/%.o: private objtool-enabled =3D $(if $(is-standard-object),$(if $(= delay-objtool),$(is-single-obj-m),y)) +$(obj)/%.o: private objtool-enabled =3D $(if $(is-standard-object),$(if $(= objtool-cmds-y),$(if $(delay-objtool),$(is-single-obj-m),y))) endif =20 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) @@ -499,7 +499,7 @@ define rule_ld_multi_m $(call cmd,gen_objtooldep) endef =20 -$(multi-obj-m): private objtool-enabled :=3D $(delay-objtool) +$(multi-obj-m): private objtool-enabled :=3D $(if $(objtool-cmds-y),$(dela= y-objtool)) $(multi-obj-m): private part-of-module :=3D y $(multi-obj-m): %.o: %.mod FORCE $(call if_changed_rule,ld_multi_m) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 0718e39cedda..40a462581666 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -183,27 +183,31 @@ ifdef CONFIG_OBJTOOL =20 objtool :=3D $(objtree)/tools/objtool/objtool =20 -objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) +=3D --hacks=3Djump_label -objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) +=3D --hacks=3Dnoinstr -objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) +=3D --hacks=3Dskyla= ke -objtool-args-$(CONFIG_X86_KERNEL_IBT) +=3D --ibt -objtool-args-$(CONFIG_FINEIBT) +=3D --cfi -objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) +=3D --mcount -ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL -objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) +=3D --mnop -endif -objtool-args-$(CONFIG_UNWINDER_ORC) +=3D --orc -objtool-args-$(CONFIG_MITIGATION_RETPOLINE) +=3D --retpoline -objtool-args-$(CONFIG_MITIGATION_RETHUNK) +=3D --rethunk -objtool-args-$(CONFIG_MITIGATION_SLS) +=3D --sls -objtool-args-$(CONFIG_STACK_VALIDATION) +=3D --stackval -objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) +=3D --static-call -objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) +=3D --uaccess -objtool-args-$(or $(CONFIG_GCOV_KERNEL),$(CONFIG_KCOV)) +=3D --no-unreacha= ble -objtool-args-$(CONFIG_PREFIX_SYMBOLS) +=3D --prefix=3D$(CONFIG_FUNCTION_= PADDING_BYTES) -objtool-args-$(CONFIG_OBJTOOL_WERROR) +=3D --werror +# objtool commands +objtool-cmds-$(CONFIG_HAVE_JUMP_LABEL_HACK) +=3D --hacks=3Djump_label +objtool-cmds-$(CONFIG_HAVE_NOINSTR_HACK) +=3D --hacks=3Dnoinstr +objtool-cmds-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) +=3D --hacks=3Dskyla= ke +objtool-cmds-$(CONFIG_X86_KERNEL_IBT) +=3D --ibt +objtool-cmds-$(CONFIG_FINEIBT) +=3D --cfi +objtool-cmds-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) +=3D --mcount +objtool-cmds-$(CONFIG_UNWINDER_ORC) +=3D --orc +objtool-cmds-$(CONFIG_MITIGATION_RETPOLINE) +=3D --retpoline +objtool-cmds-$(CONFIG_MITIGATION_RETHUNK) +=3D --rethunk +objtool-cmds-$(CONFIG_MITIGATION_SLS) +=3D --sls +objtool-cmds-$(CONFIG_STACK_VALIDATION) +=3D --stackval +objtool-cmds-$(CONFIG_HAVE_STATIC_CALL_INLINE) +=3D --static-call +objtool-cmds-$(CONFIG_HAVE_UACCESS_VALIDATION) +=3D --uaccess +objtool-cmds-$(CONFIG_PREFIX_SYMBOLS) +=3D --prefix=3D$(CONFIG_FUNCTION_= PADDING_BYTES) +objtool-cmds-y +=3D $(OBJTOOL_ARGS) =20 -objtool-args =3D $(objtool-args-y) \ +# objtool options +ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL +objtool-opts-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) +=3D --mnop +endif +objtool-opts-$(or $(CONFIG_GCOV_KERNEL),$(CONFIG_KCOV)) +=3D --no-unreacha= ble +objtool-opts-$(CONFIG_OBJTOOL_WERROR) +=3D --werror + +objtool-args =3D $(objtool-cmds-y) $(objtool-opts-y) \ $(if $(delay-objtool), --link) \ $(if $(part-of-module), --module) =20 @@ -212,7 +216,7 @@ delay-objtool :=3D $(or $(CONFIG_LTO_CLANG),$(CONFIG_X8= 6_KERNEL_IBT),$(CONFIG_KLP_ cmd_objtool =3D $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@) cmd_gen_objtooldep =3D $(if $(objtool-enabled), { echo ; echo '$@: $$(wild= card $(objtool))' ; } >> $(dot-target).cmd) =20 -objtool-enabled :=3D y +objtool-enabled =3D $(if $(objtool-cmds-y),y) =20 endif # CONFIG_OBJTOOL =20 diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 527352c222ff..09af33203bd8 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -36,18 +36,13 @@ endif # For !delay-objtool + CONFIG_NOINSTR_VALIDATION, it runs on both translat= ion # units and vmlinux.o, with the latter only used for noinstr/unret validat= ion. =20 -objtool-enabled :=3D $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION)) - -ifeq ($(delay-objtool),y) -vmlinux-objtool-args-y +=3D $(objtool-args-y) -else -vmlinux-objtool-args-$(CONFIG_OBJTOOL_WERROR) +=3D --werror +ifneq ($(delay-objtool),y) +objtool-cmds-y =3D +objtool-opts-y +=3D --link endif =20 -vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) +=3D --noinstr \ - $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_S= RSO)), --unret) - -objtool-args =3D $(vmlinux-objtool-args-y) --link +objtool-cmds-$(CONFIG_NOINSTR_VALIDATION) +=3D --noinstr \ + $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SR= SO)), --unret) =20 # Link of vmlinux.o used for section mismatch analysis # ------------------------------------------------------------------------= --- --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 E1D2E27A92E; Thu, 5 Mar 2026 03:31:56 +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=1772681517; cv=none; b=dvafqRvOSSCIULbq+96b/1xCGemNoM5XnYRQP71q88R4bYekS/WS+/fhEgp1JSVDY4G+NI2TcW4Oya7ai9mFvn+5jPMmJvQJMQBmi/sIVWc2k//iU/5fpFtdhSoKsZ06ktZmXK+65PgjM04cj2HINzsmR+VZdlVZ6c0+2UxAGQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681517; c=relaxed/simple; bh=NbzuW+7uujyEcZZ30AyHwoJE50Su+M8O/JLaUCgVuZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cUuZwD85tKqzJ7fKVrpNfvJhPGR7skcRgJkcIsBJdrdZequjQBDsKhM6gZ/7OMmyKFJBzZPxYxw3ZyLV2pJDnq/fJBEwtR50x0dzeoCWRygBBBEmqRhgoUI4RvR/+OwB69COD7B0qyYzUbqqYPR1AtsdT9f22IDROZ+2N5yUMcw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KbeqmIyq; 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="KbeqmIyq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47AF2C2BCB1; Thu, 5 Mar 2026 03:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681516; bh=NbzuW+7uujyEcZZ30AyHwoJE50Su+M8O/JLaUCgVuZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KbeqmIyqV/ay83Ax51Gnb91by92icM4HeckvCSg7fd5//tXpXxY1HC8pfFb+VxIgB mKpJtzzZEyUsZEntGsvM+LiTA2/dwgGVbrkRKx20sQLXEtlIKwl/VZb5HAtA8XXCaY LIL8NZcbFooJ+11aFaXszGpQQlJWbhVKOeHbhqT2woGkqFe3yl4RoQE15CLNDY84xa sbNZO7VDXSRfKMPQH3u/5bciI/yV1YbWoFs0Im2Dvkkd97yq3vbyl9gb4OkTMr52DY QuQ7cVZ4dKMjpjTmuvqMSGrH84GkVszXcQMT8RZ3ReR0BeuaSyyEFPNtWVyFQxtt1d Ja+0ZRFwtqerA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 10/14] objtool: Ignore jumps to the end of the function for non-CFG arches Date: Wed, 4 Mar 2026 19:31:29 -0800 Message-ID: <4aaa59736860f593e18e5978ebd56e04e4deea9d.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" Sometimes Clang arm64 code jumps to the end of the function for UB. No need to make that an error, arm64 doesn't reverse engineer the CFG anyway. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- tools/objtool/check.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index f73cf1382e5c..23cde2de66b9 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1630,10 +1630,12 @@ static int add_jump_destinations(struct objtool_fil= e *file) /* * GCOV/KCOV dead code can jump to the end of * the function/section. + * + * Clang on arm64 also does this sometimes for + * undefined behavior. */ - if (file->ignore_unreachables && func && - dest_sec =3D=3D insn->sec && - dest_off =3D=3D func->offset + func->len) + if ((file->ignore_unreachables || (!opts.stackval && !opts.orc)) && + func && dest_sec =3D=3D insn->sec && dest_off =3D=3D func->offset += func->len) continue; =20 ERROR_INSN(insn, "can't find jump dest instruction at %s", --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 D74452877E8; Thu, 5 Mar 2026 03:31:57 +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=1772681517; cv=none; b=Xh8kSDQnDIIvcYAlWu3VupzHbe11H7USeVngoyYsvwYNvpucWtIPuQZqrejXHsFq4GJ2tYWvOSJenDaae88xKzCw/SBIq4zGt7pNFWmwexEIIb+HdGbH7asY6NAZo7MVxM3S/tdfjpiDxUIPNyREYfyws5qA9PNa4yfcvu7Hm4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681517; c=relaxed/simple; bh=sna7ujIJJX2wXpTTTo8a2xChNhDmAoSGFIkZMWk8srk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tg5mf1dFqnrdL90s8syIa0D+GgIw8WNCW4taRPrioUcEi8daQZERKAUvXohBLt4+ZUs0mn5BFX5N3OEyXCYrhx108llaYpRAy2/lrO/ckCkKgIT/xl1wJeBDGv1FzK3durStKGMIMXIL1rTWqoTYauNc+9sVEsnlEY50tmLJr/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AnH7Qa8k; 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="AnH7Qa8k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF595C2BCB2; Thu, 5 Mar 2026 03:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681517; bh=sna7ujIJJX2wXpTTTo8a2xChNhDmAoSGFIkZMWk8srk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnH7Qa8ksu5mf2Gv83mjE9ZsD2k9/WUi6+NShvNbex9IjWIn3FsbOpjntGVs94l6B QzuBnY9D8YVCERpjOgzHblVCNp+ffRlo4EHKVHDd/y2EUiau9BCvyJNRhBX0jdWBSf snR5BLCyVcjqKjLO9YwXX5pRM0MklJCyN6Lnh8rGep5d6GIoe6YXLG3dC1ENAu7t7j l6EN+ZGfOWwAb/dKcgfhy5vtvk7LJqcFSY34MDMHHAyx2PCBnpQWbGR8uITU4L/qgw myvTfGj0zoFTtH7Rln9KExt3KT9/T1v5EgK3ljf2qZSKx85bksHnQf0+ab4yKNfSpu VlaIyS01/c0Kw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 11/14] objtool: Allow empty alternatives Date: Wed, 4 Mar 2026 19:31:30 -0800 Message-ID: <1af3deb308fd59086b63690c1e7b53586ba3c5e7.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" arm64 can have empty alternatives, which are effectively no-ops. Ignore them. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- tools/objtool/check.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 23cde2de66b9..036adbd67488 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1994,10 +1994,8 @@ static int add_special_section_alts(struct objtool_f= ile *file) } =20 if (special_alt->group) { - if (!special_alt->orig_len) { - ERROR_INSN(orig_insn, "empty alternative entry"); + if (!special_alt->orig_len) continue; - } =20 if (handle_group_alt(file, special_alt, orig_insn, &new_insn)) return -1; --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 035242882D7; Thu, 5 Mar 2026 03:31:58 +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=1772681519; cv=none; b=kLDtkD6iCXLn5IQvyjtAFOJA4xOnqCWE20NnDNudB7PWWpjVBYADKSOmWe7WEKHmpLe6/g/L32WLqWeMshTKqGoCvLn9qo+N2Ef5lLPPXOt+J2KR/grwTywp8HCUDIZdFCj35hmc69aQn+kWqtoKK+nu4THm+RQt1l5PNK1Rbf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681519; c=relaxed/simple; bh=CfP2DFBojtfnSTUyVXwvbIwOJH/gBb2u2wzP+UFC7hU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KZorjCopPlOCLCiI+Wgt0kHzhiwqNlVBlOa3NOwFicpVGl0w+PJFsc/WH84/DFq226xuXw+Hp/bHuJlyG3vEwlJzE6Y+fjMRAKZMBpPiF93EOTJXwpFcepEhMNWuh2/cuw3rFSPtKP+Ww0k8ZTs3cb5UJT+JzQwxUQqiDyiQmks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k8+xaC8Y; 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="k8+xaC8Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD774C2BCB0; Thu, 5 Mar 2026 03:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681518; bh=CfP2DFBojtfnSTUyVXwvbIwOJH/gBb2u2wzP+UFC7hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8+xaC8YqfE6gU2/m9z8R8CU4ZtMOnKh6oZcO4Ro2BZbPyVsMhee6JY06BnMAaCz9 u8zu+NzWjBt+hQjDDgnH/gDDjLGrgtRI+i2V51yXvnAYa+IY/aT1REYDZxXXj3G56y eNAWWR0/GM3UhgJSQNBmo3forCYVrdQKRNF+fPtSj9kOh1+ljSQOYnBpxet63Kw8Bf GBx3KWytFqBo+nBtwU77jZI0bW72uOmwifFCHKtVrkjECvh0QMWSoqFb9MaM6+izqG 6rin6gy13+vqHMniez8ytADE32fn03PliQJxT3bjmatIW5rWQwNaNVGhDSYMMvZqB2 cHQacOXnWEYJQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 12/14] objtool: Reuse consecutive string references Date: Wed, 4 Mar 2026 19:31:31 -0800 Message-ID: <1cdd2737d2db5a300eea971382c5e8edda7fb474.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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" For duplicate strings, elf_add_string() just blindly adds duplicates. That can be a problem for arm64 which often uses two consecutive instructions (and corresponding relocations) to put an address into a register, like: d8: 90000001 adrp x1, 0 d8: R_AARCH= 64_ADR_PREL_PG_HI21 .rodata.meminfo_proc_show.str1.8 dc: 91000021 add x1, x1, #0x0 dc: R_AARCH64_ADD_ABS_LO12_= NC .rodata.meminfo_proc_show.str1.8 Referencing two different string addresses in the adrp+add pair can result in a corrupt string addresses. Detect such consecutive reuses and force them to use the same string. Signed-off-by: Josh Poimboeuf Acked-by: Song Liu --- tools/objtool/elf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 3da90686350d..52ef991115fc 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1321,6 +1321,8 @@ struct elf *elf_create_file(GElf_Ehdr *ehdr, const ch= ar *name) =20 unsigned int elf_add_string(struct elf *elf, struct section *strtab, const= char *str) { + static unsigned int last_off; + static const char *last_str; unsigned int offset; =20 if (!strtab) @@ -1329,17 +1331,22 @@ unsigned int elf_add_string(struct elf *elf, struct= section *strtab, const char ERROR("can't find .strtab section"); return -1; } - if (!strtab->sh.sh_addralign) { ERROR("'%s': invalid sh_addralign", strtab->name); return -1; } =20 + if (last_str && !strcmp(last_str, str)) + return last_off; + offset =3D ALIGN(strtab->sh.sh_size, strtab->sh.sh_addralign); =20 if (!elf_add_data(elf, strtab, str, strlen(str) + 1)) return -1; =20 + last_str =3D str; + last_off =3D offset; + return offset; } =20 --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 50C332951B3; Thu, 5 Mar 2026 03:32:00 +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=1772681520; cv=none; b=TjiL52HQJ8p8vntVNNIPfhXoJgcp287iAKpIrRQexNIRsPStg3Asxcr2hsEyujmGkuQ5hYStlHC5Y6wP1wEZd4+5gWRXzLoCI1WcrBiPCz8WlTUVHAkuziYmWUhNZ1FHAiPeMpUfFLVsdBohipQu+kD980dNkgDJwuGIkaJA+VE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681520; c=relaxed/simple; bh=T7UwqfC/qq6LxWXm5c1q8OXLRhM17hhhTRRQ0ZOmsSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ucSYN9dEWNo8GvHJZx1x/Tw0Y2LtzR1rPnj06emmLe0UMODV27UV799xv7/xkxyq0iMHY0WSrYi6JenKAZg41QXYoRjC487k81Gl5IDD7JHKtvuEYvk+IcQpm+0IqRfosQIOABh46l+e5XKG1uL5aeSys+/phMMGC1lCIGwWIlw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JDavCUp7; 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="JDavCUp7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08B66C2BCB4; Thu, 5 Mar 2026 03:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681520; bh=T7UwqfC/qq6LxWXm5c1q8OXLRhM17hhhTRRQ0ZOmsSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JDavCUp7L5xrfmlTAmLhQvHfj0P6O49id66RDxtAqLK+o1pl9sLef1kMmtG6nnMhP jewLiUnwj/doqZ4ZP8FZsaxQYpywuDdCle9HQ5xUtogS7Dmsn20NO8R9WvFL/cpNCy CR86hlYuNnt5+FP65ILLYc2VP0Im+W02oWTsiincSgMJGE+rWSrdRE13zjrzIfJC6j hY2WfnACRcQk19jO2rUzsvMFOF+iOsuF8cclCA6z+Y4xeanpfwfaOWl4UIg7Or/q2o lGy605JCKe2uyz1cXNV08191FMWm8FBK4szpwnh3xiE16HMFu9h490fgUuep2tLA6A mlqaUnNFARZeA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 13/14] objtool: Introduce objtool for arm64 Date: Wed, 4 Mar 2026 19:31:32 -0800 Message-ID: <5ad66ec6131539de1704b1f1c0fa9abb7ca37922.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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 basic support for arm64 on objtool. Only --checksum is currently supported. Signed-off-by: Josh Poimboeuf --- arch/arm64/Kconfig | 2 + tools/objtool/Makefile | 4 + tools/objtool/arch/arm64/Build | 2 + tools/objtool/arch/arm64/decode.c | 116 ++++++++++++++++++ .../arch/arm64/include/arch/cfi_regs.h | 11 ++ tools/objtool/arch/arm64/include/arch/elf.h | 13 ++ .../objtool/arch/arm64/include/arch/special.h | 21 ++++ tools/objtool/arch/arm64/special.c | 21 ++++ 8 files changed, 190 insertions(+) create mode 100644 tools/objtool/arch/arm64/Build create mode 100644 tools/objtool/arch/arm64/decode.c create mode 100644 tools/objtool/arch/arm64/include/arch/cfi_regs.h create mode 100644 tools/objtool/arch/arm64/include/arch/elf.h create mode 100644 tools/objtool/arch/arm64/include/arch/special.h create mode 100644 tools/objtool/arch/arm64/special.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 38dba5f7e4d2..354aa80c5b4b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -236,9 +236,11 @@ config ARM64 select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_IOREMAP_PROT select HAVE_IRQ_TIME_ACCOUNTING + select HAVE_KLP_BUILD select HAVE_LIVEPATCH select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI + select HAVE_OBJTOOL select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI select HAVE_PERF_REGS diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 6964175abdfd..288db5bc3002 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -11,6 +11,10 @@ ifeq ($(SRCARCH),loongarch) BUILD_ORC :=3D y endif =20 +ifeq ($(SRCARCH),arm64) + ARCH_HAS_KLP :=3D y +endif + ifeq ($(ARCH_HAS_KLP),y) HAVE_XXHASH =3D $(shell printf "$(pound)include \nXXH3_state_t = *state;int main() {}" | \ $(HOSTCC) -xc - -o /dev/null -lxxhash 2> /dev/null && echo y || ec= ho n) diff --git a/tools/objtool/arch/arm64/Build b/tools/objtool/arch/arm64/Build new file mode 100644 index 000000000000..d24d5636a5b8 --- /dev/null +++ b/tools/objtool/arch/arm64/Build @@ -0,0 +1,2 @@ +objtool-y +=3D decode.o +objtool-y +=3D special.o diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/d= ecode.c new file mode 100644 index 000000000000..ee93c096243f --- /dev/null +++ b/tools/objtool/arch/arm64/decode.c @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include +#include +#include + +const char *arch_reg_name[CFI_NUM_REGS] =3D {}; + +int arch_ftrace_match(const char *name) +{ + return 0; +} + +s64 arch_insn_adjusted_addend(struct instruction *insn, struct reloc *relo= c) +{ + return reloc_addend(reloc); +} + +bool arch_callee_saved_reg(unsigned char reg) +{ + return false; +} + +int arch_decode_hint_reg(u8 sp_reg, int *base) +{ + exit(-1); +} + +const char *arch_nop_insn(int len) +{ + exit(-1); +} + +const char *arch_ret_insn(int len) +{ + exit(-1); +} + +int arch_decode_instruction(struct objtool_file *file, const struct sectio= n *sec, + unsigned long offset, unsigned int maxlen, + struct instruction *insn) +{ + u32 i =3D *((u32 *)(sec->data->d_buf + offset)); + + insn->len =3D 4; + + /* + * These are the bare minimum needed for static branch detection and + * checksum calculations. + */ + if (i =3D=3D 0xd503201f || i =3D=3D 0x2a1f03f7) { + /* For static branches */ + insn->type =3D INSN_NOP; + } else if ((i & 0xfc000000) =3D=3D 0x14000000) { + /* For static branches and intra-TU sibling calls */ + insn->type =3D INSN_JUMP_UNCONDITIONAL; + insn->immediate =3D sign_extend64(i & 0x03ffffff, 25); + } else if ((i & 0xfc000000) =3D=3D 0x94000000) { + /* For intra-TU calls */ + insn->type =3D INSN_CALL; + insn->immediate =3D sign_extend64(i & 0x03ffffff, 25); + } else if ((i & 0xff000000) =3D=3D 0x54000000) { + /* For intra-TU conditional sibling calls */ + insn->type =3D INSN_JUMP_CONDITIONAL; + insn->immediate =3D sign_extend64((i & 0xffffe0) >> 5, 18); + } else { + insn->type =3D INSN_OTHER; + } + + return 0; +} + +u64 arch_adjusted_addend(struct reloc *reloc) +{ + return reloc_addend(reloc); +} + +unsigned long arch_jump_destination(struct instruction *insn) +{ + return insn->offset + (insn->immediate << 2); +} + +bool arch_pc_relative_reloc(struct reloc *reloc) +{ + return false; +} + +void arch_initial_func_cfi_state(struct cfi_init_state *state) +{ + state->cfa.base =3D CFI_UNDEFINED; +} + +unsigned int arch_reloc_size(struct reloc *reloc) +{ + switch (reloc_type(reloc)) { + case R_AARCH64_ABS64: + case R_AARCH64_PREL64: + return 8; + default: + return 4; + } +} + +#ifdef DISAS +int arch_disas_info_init(struct disassemble_info *dinfo) +{ + return disas_info_init(dinfo, bfd_arch_aarch64, + bfd_mach_arm_unknown, bfd_mach_aarch64, + NULL); +} +#endif /* DISAS */ diff --git a/tools/objtool/arch/arm64/include/arch/cfi_regs.h b/tools/objto= ol/arch/arm64/include/arch/cfi_regs.h new file mode 100644 index 000000000000..49c81cbb6646 --- /dev/null +++ b/tools/objtool/arch/arm64/include/arch/cfi_regs.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _OBJTOOL_ARCH_CFI_REGS_H +#define _OBJTOOL_ARCH_CFI_REGS_H + +/* These aren't actually used for arm64 */ +#define CFI_BP 0 +#define CFI_SP 0 +#define CFI_RA 0 +#define CFI_NUM_REGS 2 + +#endif /* _OBJTOOL_ARCH_CFI_REGS_H */ diff --git a/tools/objtool/arch/arm64/include/arch/elf.h b/tools/objtool/ar= ch/arm64/include/arch/elf.h new file mode 100644 index 000000000000..80a1bc479930 --- /dev/null +++ b/tools/objtool/arch/arm64/include/arch/elf.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _OBJTOOL_ARCH_ELF_H +#define _OBJTOOL_ARCH_ELF_H + +#define R_NONE R_AARCH64_NONE +#define R_ABS64 R_AARCH64_ABS64 +#define R_ABS32 R_AARCH64_ABS32 +#define R_DATA32 R_AARCH64_PREL32 +#define R_DATA64 R_AARCH64_PREL64 +#define R_TEXT32 R_AARCH64_PREL32 +#define R_TEXT64 R_AARCH64_PREL64 + +#endif /* _OBJTOOL_ARCH_ELF_H */ diff --git a/tools/objtool/arch/arm64/include/arch/special.h b/tools/objtoo= l/arch/arm64/include/arch/special.h new file mode 100644 index 000000000000..8ae804a83ea4 --- /dev/null +++ b/tools/objtool/arch/arm64/include/arch/special.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _OBJTOOL_ARCH_SPECIAL_H +#define _OBJTOOL_ARCH_SPECIAL_H + +#define EX_ENTRY_SIZE 12 +#define EX_ORIG_OFFSET 0 +#define EX_NEW_OFFSET 4 + +#define JUMP_ENTRY_SIZE 16 +#define JUMP_ORIG_OFFSET 0 +#define JUMP_NEW_OFFSET 4 +#define JUMP_KEY_OFFSET 8 + +#define ALT_ENTRY_SIZE 12 +#define ALT_ORIG_OFFSET 0 +#define ALT_NEW_OFFSET 4 +#define ALT_FEATURE_OFFSET 8 +#define ALT_ORIG_LEN_OFFSET 10 +#define ALT_NEW_LEN_OFFSET 11 + +#endif /* _OBJTOOL_ARCH_SPECIAL_H */ diff --git a/tools/objtool/arch/arm64/special.c b/tools/objtool/arch/arm64/= special.c new file mode 100644 index 000000000000..3c2b83d94939 --- /dev/null +++ b/tools/objtool/arch/arm64/special.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include + +bool arch_support_alt_relocation(struct special_alt *special_alt, + struct instruction *insn, + struct reloc *reloc) +{ + return false; +} + +struct reloc *arch_find_switch_table(struct objtool_file *file, + struct instruction *insn, + unsigned long *table_size) +{ + return NULL; +} + +const char *arch_cpu_feature_name(int feature_number) +{ + return NULL; +} --=20 2.53.0 From nobody Thu Apr 9 23:22:36 2026 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 EE7E827B343; Thu, 5 Mar 2026 03:32:01 +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=1772681522; cv=none; b=Zm/T4MqCx++HkuYOdSOp5DEYbGPUAK+NWaRlt13QRFFQU+KkPiwkyDRoHs43SrXcoAjVH9c/mgMs/0yV0WSCgc16CTVjsJrxuCy7hQ9eqWwJnhCcLw6xeKZmeyJqdwKHKsBcZKOOT5I2zG34qxcoqxdv+0BHAiC27ex6AOJpPZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772681522; c=relaxed/simple; bh=y7mJtqRMIyYxCk1D8Nsk0D/Rqo0GqzF9Z7aw/XJAZkw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r7gHFNt6fYcV73ZDSFLKmok/ZmBoOmw4C/H8JixhqOLGxZ7pGi2s3NUSrkDQfXaxvm9sXr/J7rosNTKcVCgiVvX1QDihHhQRs3rOSDIfPwaUPMRoVLv7Pn/4+HO7OrvoywVvM5BlGOfT7rg/pVOQs/RI7tzbYGMag20MCkajlrk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jO4MLE0y; 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="jO4MLE0y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5478DC2BCB6; Thu, 5 Mar 2026 03:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772681521; bh=y7mJtqRMIyYxCk1D8Nsk0D/Rqo0GqzF9Z7aw/XJAZkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jO4MLE0y+XVePdzaVdE68vXz7JQqqVf+lnn4o0UVyNFosJKc2k1E4UVnCsvXs66zB wB93vgw9EBaAV/YKdnEy0WtFqGkZ9EBI6gK1E5y1rJFWjh+hYJnlPVG+BdrPBPZLO6 6wBwyP8bbFS5AwN2jW081RF1t3neD09RgxFj/RFw8WhQFBnUpNQEOR3B+h7jUULLFN jAERCQrP4fzL7B/Ll5Vkn0x8FZlJCYUpjmayqA3H1Oqh1swc/t5o523KgVUaeCAZFk 0hvvCMiCSGhNGQAJ6lJ39yJynMCREPTg4ce3MEX2/a6+asVgOsq0HaqBPpeJ9quA2P CjcsAQuwx7pLQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Nathan Chancellor , Nicolas Schier , Herbert Xu Subject: [PATCH 14/14] klp-build: Support cross-compilation Date: Wed, 4 Mar 2026 19:31:33 -0800 Message-ID: <697c09ca0a8ffd545aa875e507502f62ad983419.1772681234.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 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 support for cross-compilation. The user must export ARCH, and either CROSS_COMPILE or LLVM. Signed-off-by: Josh Poimboeuf --- scripts/livepatch/klp-build | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build index 809e198a561d..b6c057e2120f 100755 --- a/scripts/livepatch/klp-build +++ b/scripts/livepatch/klp-build @@ -404,6 +404,14 @@ validate_patches() { revert_patches } =20 +cross_compile_init() { + if [[ -v LLVM ]]; then + OBJCOPY=3Dllvm-objcopy + else + OBJCOPY=3D"${CROSS_COMPILE:-}objcopy" + fi +} + do_init() { # We're not yet smart enough to handle anything other than in-tree # builds in pwd. @@ -420,6 +428,7 @@ do_init() { validate_config set_module_name set_kernelversion + cross_compile_init } =20 # Refresh the patch hunk headers, specifically the line numbers and counts. @@ -783,7 +792,7 @@ build_patch_module() { cp -f "$kmod_file" "$kmod_file.orig" =20 # Work around issue where slight .config change makes corrupt BTF - objcopy --remove-section=3D.BTF "$kmod_file" + "$OBJCOPY" --remove-section=3D.BTF "$kmod_file" =20 # Fix (and work around) linker wreckage for klp syms / relocs "$SRC/tools/objtool/objtool" klp post-link "$kmod_file" || die "objtool k= lp post-link failed" --=20 2.53.0