Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5746614imw; Wed, 20 Jul 2022 11:39:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tIlEhBDRuEfeZuCygTwt+vjTdMfBiWqzxe4nL7ldB0uoA4F4nP1z9DrSbdjBbyU5VaRFTV X-Received: by 2002:a05:6a00:27a6:b0:52a:e089:e777 with SMTP id bd38-20020a056a0027a600b0052ae089e777mr41397950pfb.53.1658342354889; Wed, 20 Jul 2022 11:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658342354; cv=none; d=google.com; s=arc-20160816; b=J8iknv8MumtVnPSVjDEKSrM/DF4VmZVBCLk7SKrclRATTGOx73pQDkO0oDd7E7R1sM jMiDzvk5qkjx/eiVappSPBMi7YIqvx7zJ/AnZfZFDP78bU8u2QP8MusUMGWNUDjzGJbc ms0cSBCUtIuesKZkF7Gb3yQk85YyLIi9QIRdtFvMO5PeA7vLfV857xf+G1uzEBFh8zHk 25U4z+/eRBL7nIdIsJRR+NQkTq1CLqXCCry2MFpEn6tU1nxtbspJOOfm9zLhuNrpNFMF sS0mrB/tevDVf+OvyK2udfDkIZbH+0l3+aIVPVcc4TPc6WuLI1jhtt/57HaCqcjQtkeD ag5w== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=/oKKQha01Z4VUkQdjMdKQTNKIJcv+CIJgU31POXzFjk=; b=q/hVvMPWEiBjz4ayQfyRhdmOndvHcJ76P/GrD/LOCuLNwkMXDFcNmybWaAQJyKuDuq Pb8bG6TnOS9W53Wbk98EWznJf54I5kHxcysqwSmLUurlwXC/QuT2sBaCrqkA+cGLqc+j ZjEGiiX3YD1ZR+lBfOeATCwHbtJ4O6+QSfbjUWLyU3IebgA0/e1Pzy+83LqhZpNA4vlW HZs8RUmSgG357QgsZFnGEfijkKVIvyurE1MEn82AYV0fD91TkPC/Tz1qfTx7KOQLPNxH FL1AVKB/xGLpDP5KhnrcW9tD4z9nPBaOGWnheOID/mQuq55Xkvp7KXzCQ5mx9eN58p1b py2Q== 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 l7-20020a170903120700b0016a75602af4si24484334plh.597.2022.07.20.11.38.59; Wed, 20 Jul 2022 11:39:14 -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 S230297AbiGTSbx (ORCPT + 99 others); Wed, 20 Jul 2022 14:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbiGTSbw (ORCPT ); Wed, 20 Jul 2022 14:31:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52A16FA02 for ; Wed, 20 Jul 2022 11:31:51 -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 4292D6193C for ; Wed, 20 Jul 2022 18:31:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B46EC341CA; Wed, 20 Jul 2022 18:31:48 +0000 (UTC) Date: Wed, 20 Jul 2022 14:31:47 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Peter Zijlstra , Thomas Gleixner , LKML , "the arch/x86 maintainers" , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Juergen Gross , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation Message-ID: <20220720143147.4d8a2f8d@gandalf.local.home> In-Reply-To: References: <20220716230344.239749011@linutronix.de> <20220720125736.48164a14@gandalf.local.home> <20220720135016.3178ffc6@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 On Wed, 20 Jul 2022 11:07:26 -0700 Linus Torvalds wrote: > On Wed, Jul 20, 2022 at 10:50 AM Steven Rostedt wrote: > > > > [ 2.464117] missing return thunk: lkdtm_rodata_do_nothing+0x0/0x8-lkdtm_rodata_do_nothing+0x5/0x8: e9 00 00 00 00 > > Well, that looks like a "jmp" instruction that has never been relocated. > > The 'e9' is 'jmp', the four zeros after it are either "I'm jumping to > the next instruction" or "I haven't been filled in". > > I'm assuming it's the second case. > > That lkdtm_rodata_do_nothing thing is odd, and does > > OBJCOPYFLAGS_rodata_objcopy.o := \ > --rename-section > .noinstr.text=.rodata,alloc,readonly,load,contents > > to put the code in an odd section. I'm assuming this hackery is > related to it then not getting relocated. > Right, because this looks to be some magic being done for testing purposes: static void lkdtm_EXEC_RODATA(void) { execute_location(dereference_function_descriptor(lkdtm_rodata_do_nothing), CODE_AS_IS); } static void *setup_function_descriptor(func_desc_t *fdesc, void *dst) { if (!have_function_descriptors()) return dst; memcpy(fdesc, do_nothing, sizeof(*fdesc)); fdesc->addr = (unsigned long)dst; barrier(); return fdesc; } static noinline void execute_location(void *dst, bool write) { void (*func)(void); func_desc_t fdesc; void *do_nothing_text = dereference_function_descriptor(do_nothing); pr_info("attempting ok execution at %px\n", do_nothing_text); do_nothing(); if (write == CODE_WRITE) { memcpy(dst, do_nothing_text, EXEC_SIZE); flush_icache_range((unsigned long)dst, (unsigned long)dst + EXEC_SIZE); } pr_info("attempting bad execution at %px\n", dst); func = setup_function_descriptor(&fdesc, dst); func(); pr_err("FAIL: func returned\n"); } And that appears that it wants to crash, as the code is located in readonly data. OBJCOPYFLAGS_rodata_objcopy.o := \ --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents And because the alternatives fixup tries to write to it, and fails due to it being readonly, I'm guessing we get this warning. Thus, is there a way to keep this file from being entered into the return_sites section? -- Steve