Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5830155imw; Wed, 20 Jul 2022 13:28:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uddw3EQ4SJSgbnnPjRjnpx3bfBHA7TbT3RSlgUrs7QIFTWt1xhwTXXV5w1/IBpimtbZLMw X-Received: by 2002:a63:da01:0:b0:419:cde3:36af with SMTP id c1-20020a63da01000000b00419cde336afmr1549861pgh.59.1658348906896; Wed, 20 Jul 2022 13:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658348906; cv=none; d=google.com; s=arc-20160816; b=CMFEbBGYRSrisAQ0Ac7oWiIMvzcj31s+aDos4TGINleLn0Y8jHHYxmcwo7YwWr3m0C Q+EqYb7Sh8wSArJqjavL0s1V2xMwTVw1VvCAMjaVxagk1ytVGTi/2/5WhQqaaP+B7MXG /LQLGpJOI9Uvvsdv8CqYGuICxT2i4AX05atVyM8yBS/RI4SpK8dkyrRORCdf1ujsxhSB Ym19H+TC2/7eQaOjF4VOtib/k48bGR87/uGWm1oV2h6sVeKyg0uywJQ98suw68JXtfn9 yhiNl7xKdAUy7wk71gAor8HahXtlevnO3IBNHVQOfchMCpEUm6eLNhMvSH+gRpQD4irf lq7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=Efh29cp+Ea+dWjP7Gcs7vD1YB7lrBOh/qm/PSRZhBmU=; b=FPJa38q0OMPS9Zojn23JgacRv3OYGkQX22HtKQr1LOrHiqNfZ1hvh9xFnX64gTJ5PC UslENsoGI3eauBR1bzXe3zSxw4rWW7GPiz7m/jUKZRSp8BhRouy2j6LafcFuHaJ/7isz cd00xwmOWGPHl7oaEhoCR2WfTYkkD+RI/LPCIMwI+hr8Rj3zFTy93q2lJukuA1wIwzTA pRPiOhAHviEPjjhA0EJDirjfiBQrLQQgRTDQVPY+xfu5kBU+eHM/LNGNv2p1EwiWHtFD pFLdk9mRr942VrxnfoNOrCvRUxXaQieg5+pxeDaamXqGmTZJ5HUbhpNySA1QQ4JcDftU ibgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rj6-20020a17090b3e8600b001f07221b2ddsi3915083pjb.99.2022.07.20.13.28.12; Wed, 20 Jul 2022 13:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229595AbiGTTzQ (ORCPT + 99 others); Wed, 20 Jul 2022 15:55:16 -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-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.home/ 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 := -mfunction-return=thunk-extern RETPOLINE_CFLAGS += $(RETHUNK_CFLAGS) +export RETHUNK_CFLAGS endif 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) += powerpc.o KASAN_SANITIZE_rodata.o := n KASAN_SANITIZE_stackleak.o := n KCOV_INSTRUMENT_rodata.o := n -CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) +CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) $(RETHUNK_CFLAGS) OBJCOPYFLAGS := OBJCOPYFLAGS_rodata_objcopy.o := \ -- 2.35.1