From nobody Fri Apr 17 23:54:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06D5C43334 for ; Wed, 20 Jul 2022 19:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbiGTTzR (ORCPT ); Wed, 20 Jul 2022 15:55:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbiGTTzO (ORCPT ); Wed, 20 Jul 2022 15:55:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C95D9BCB2 for ; Wed, 20 Jul 2022 12:55:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7098061B68 for ; Wed, 20 Jul 2022 19:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1767C3411E; Wed, 20 Jul 2022 19:55:08 +0000 (UTC) Date: Wed, 20 Jul 2022 15:55:07 -0400 From: Steven Rostedt To: LKML Cc: Thomas Gleixner , x86@kernel.org, Linus Torvalds , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Juergen Gross , "Peter Zijlstra (Intel)" , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann , Kees Cook Subject: [PATCH] lkdtm: Keep the rodata test from causing retbleed WARNINGS Message-ID: <20220720155507.4f904a58@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" The rodata test checks if executable code in the .rodata section will not execute. But this also means that fix ups that the return hook code does will not be able to change this code at boot up, and this causes a warning. By removing the RETHOOK_CFLAGS from the compilation of the rodata function makes it hidden from objtool and it will not add its return hook into the .returns section. This keeps the fix up code from trying and failing on modifying the rodata return call. Link: https://lore.kernel.org/all/20220720125736.48164a14@gandalf.local.hom= e/ Fixes: ee88d363d1561 ("x86,static_call: Use alternative RET encoding") Signed-off-by: Steven Rostedt (Google) --- [ Note, my tests are still running with this, but it passed the test that caused the failure, so I decided to post this now. ] arch/x86/Makefile | 1 + drivers/misc/lkdtm/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 1f40dad30d50..2dd61d8594f4 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -25,6 +25,7 @@ endif ifdef CONFIG_RETHUNK RETHUNK_CFLAGS :=3D -mfunction-return=3Dthunk-extern RETPOLINE_CFLAGS +=3D $(RETHUNK_CFLAGS) +export RETHUNK_CFLAGS endif =20 export RETPOLINE_CFLAGS diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile index 2e0aa74ac185..fd96ac1617f7 100644 --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -16,7 +16,7 @@ lkdtm-$(CONFIG_PPC_64S_HASH_MMU) +=3D powerpc.o KASAN_SANITIZE_rodata.o :=3D n KASAN_SANITIZE_stackleak.o :=3D n KCOV_INSTRUMENT_rodata.o :=3D n -CFLAGS_REMOVE_rodata.o +=3D $(CC_FLAGS_LTO) +CFLAGS_REMOVE_rodata.o +=3D $(CC_FLAGS_LTO) $(RETHUNK_CFLAGS) =20 OBJCOPYFLAGS :=3D OBJCOPYFLAGS_rodata_objcopy.o :=3D \ --=20 2.35.1