Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp168487imi; Wed, 20 Jul 2022 20:17:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sEWkCTDj0UF39+yfXyRQmhDuBft3P4QcvHNoKXRAcIklKyPV+RnSkCgbllokAFhkb+3Ks0 X-Received: by 2002:a17:907:2cf6:b0:72b:9d9b:2404 with SMTP id hz22-20020a1709072cf600b0072b9d9b2404mr38091365ejc.171.1658373478404; Wed, 20 Jul 2022 20:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658373478; cv=none; d=google.com; s=arc-20160816; b=BqFUYi409RMUbStnRq6OUHMTLe9bWbUYhtciufw1RK0UvQwZYwGxVPR/1jVfsPHC52 jfhqQyjaZpYlDrfGLlAMA9gq4fVjDNBT8p3JJSiFEUBN8H0tR2LOCfZnJ376/8w2BdI8 W3W9fvlSw0bcviwn6dxmDl0TFZ3QqOC3uksEsTjfwMYW6+tomlzhcK6AaN/EI/pzuapq pf/DYYqHGVxG9SA4yAvuAqdpJ1m1WJ8NhieYth27r1JTV79vhR3J/E9/UK+qlIP+O7gc xBEcxDIXR0z8vFTU2yyBDlhBz0tuXsH1zNRl38M7s3LLdP19s6JeuGOcQkTUd9qzyo6r k5dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TiUiKyEX3P2FTO4aLOn8yapHjE3YzElb+5iwPs0aLt4=; b=FgkQe+2D+3fZtSUSk1w50z4fLTB8lAVNtY4UYAHhqHDGTVbfD2DjTi6sJXw4gjTz3l vOc+mECXiTOdxnKSDTX2UvzTv61I4pw5HdmN1gKPmSQbKJUMtaFHxTzSReSctjWSDSZd Dwi338Vg0TwFOU1jPZ+wBuXEV0ETkGefpsaIEDJ/CoCFBs+hA1C+ijtzjErvY3yb9aXa gVeUYIQsThM2VQyq/wbfkJQ0G++KumBsVTprGMLu1QG/UxYIVluqYvLbbA/pVCseQNOA c4lgPb2kVdxCR/WQZ7CyxAjpaceGfYVS+yoIV9tkIn2peyk/Be+ropsWesi7rHTpSW09 o6pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AwPFAp9v; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f25-20020a1709062c5900b0072f3533c922si1051855ejh.261.2022.07.20.20.17.33; Wed, 20 Jul 2022 20:17:58 -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; dkim=pass header.i=@chromium.org header.s=google header.b=AwPFAp9v; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbiGUDGb (ORCPT + 99 others); Wed, 20 Jul 2022 23:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbiGUDG3 (ORCPT ); Wed, 20 Jul 2022 23:06:29 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B892A1116F for ; Wed, 20 Jul 2022 20:06:28 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id q43-20020a17090a17ae00b001f1f67e053cso236351pja.4 for ; Wed, 20 Jul 2022 20:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TiUiKyEX3P2FTO4aLOn8yapHjE3YzElb+5iwPs0aLt4=; b=AwPFAp9vg7loCycRBv7ruFJlX9iu0Nzv8V53msAgJVUqPD/2NKRfmTpN1ifPtsafY6 53xqoR8A6APf4VP2aEDdkqgt52fTjmbzv81N/kVp6Ww8v+TiHxDTi36prHC/NjdP9Rr8 eCDqv69Rz1fRrWb1CU/l7YXC5k4fferDKyjOk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TiUiKyEX3P2FTO4aLOn8yapHjE3YzElb+5iwPs0aLt4=; b=NTl0lzZPmNbSd+A98u954I/JWDUN2djA+xC19g9FY7GhVg7sN7JPtqxbcpKVsP7U/b 3qi7i16JYMk1o+zhtOnfST39IvIn8jmBAqq8PcuRlWM1oQzKKfLXysbygajyoAUod95d WB2xhdAH6knw/YEwJGudADMeSpbG4xWbur1pJdHA9wRVhkQipTfIcQV2rdMCD5SniUXU W+lu2Hr2Pfd4YrA8wHO5qcL+U4UjojN8PSJPEIt39rRXyNy6zIybR82OFWOzmd/Zm6fG AbIJMls6K5gGX29HgsSWEb0MuE1NikjQXFAQIiHmCWZ2uKF7iG2JTfsZiXYJvXbqFyUh 7qMw== X-Gm-Message-State: AJIora84pmIXUezaV2MQ+A2gA8gfrfEQP6jZYPzF7R7bHxIKsg3zReM6 3h/cYE47gspstw/o0dXkoWL0Tg== X-Received: by 2002:a17:90b:1d02:b0:1f0:1c2c:cc64 with SMTP id on2-20020a17090b1d0200b001f01c2ccc64mr9043289pjb.52.1658372788156; Wed, 20 Jul 2022 20:06:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 36-20020a630e64000000b0040df0c9a1aasm232862pgo.14.2022.07.20.20.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 20:06:27 -0700 (PDT) Date: Wed, 20 Jul 2022 20:06:27 -0700 From: Kees Cook To: Josh Poimboeuf Cc: Steven Rostedt , LKML , Thomas Gleixner , x86@kernel.org, Linus Torvalds , Tim Chen , 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 Subject: Re: [PATCH] lkdtm: Keep the rodata test from causing retbleed WARNINGS Message-ID: <202207202006.46F304D45@keescook> References: <20220720155507.4f904a58@gandalf.local.home> <202207201311.775CB068@keescook> <20220720225615.lrt7xnxv3trmiyc7@treble> <20220720225809.wtnlgvof6wi4owkq@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220720225809.wtnlgvof6wi4owkq@treble> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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, Jul 20, 2022 at 03:58:09PM -0700, Josh Poimboeuf wrote: > On Wed, Jul 20, 2022 at 03:56:18PM -0700, Josh Poimboeuf wrote: > > On Wed, Jul 20, 2022 at 01:13:05PM -0700, Kees Cook wrote: > > > On Wed, Jul 20, 2022 at 03:55:07PM -0400, Steven Rostedt wrote: > > > > 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) > > > > > > Yeah, this matches a portion of what was suggested: > > > https://lore.kernel.org/lkml/20220713213133.455599-1-keescook@chromium.org/ > > > > > > But it still needed objtool fixes: > > > https://lore.kernel.org/lkml/20220715032333.neywlazczbb35w3b@treble/ > > > > > > Perhaps objtool has already had patches landed for this? (Otherwise the > > > patch you suggested would fail to build on x86 with rethunk support.) > > > > I send this patch out a few days ago, nobody picked it up yet: > > > > https://lkml.kernel.org/lkml/8ec0039712f252693049c70ed3891d39a2357112.1658155446.git.jpoimboe@kernel.org > > Actually Peter said he grabbed it and is planning to push it to -tip > tomorrow. Ah perfect; thank you! -- Kees Cook