Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp232810pxb; Tue, 15 Feb 2022 12:04:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1nO60SjZRVJsutsAFBolb0yz38mP6KRGAjutZKrglsANkHAAxxyayK7EHvlAWje7gBKH2 X-Received: by 2002:a05:6402:1d49:: with SMTP id dz9mr598846edb.238.1644955448626; Tue, 15 Feb 2022 12:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644955448; cv=none; d=google.com; s=arc-20160816; b=HQe0y9aNAiN9R42bZ4RbWUjUohaGVfcFa5xOC6PD30lyjfCIzO0CJ6w9PYeuAx885K z1O79Mrw291XZLJ8HYyIiS7rl++4gexTK0jOQaY5bkG8KpUaNWP7b/LkvfCgjtJoFF7D 9TWdJJqAklRZsV1SFglguJHvtJvEJ6fi9M8K8nCiZ0y4ZNGj4LPG+vLDhCvI7jzVxR+Y f9BAJtxbUt6DwPyh5dzNe0S4nHMdcY95zCMyxSbHEXhCdLhRgOO8HJk2TS65mkh9DjTu gqWopNVoxv+QB8nJ1X4ETFUw8ebKQtzv7BpFXQxiZgmZa0Gt5k9krDy0PJw2VQREySzg CQwQ== 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:date:subject:cc:to:from; bh=A+kHgW+8iM0XkRtk4/RBA3z/V272dsojO7UxBhoTPOU=; b=XQzxTQCJuAYQini1IBb/m69Phb53g0biIduJoK6YIAOK298tssXL1hAYBVUOTT03zV XFF3jdUJ/5LHC6sssoup8mAiljDvAteYI/AoBbgkf4x5BPwt7pxgl0I6OXaOMIK8+H0n pUK0ZKs1A9RLKY3iURa8LDwrNWqSB7wBiC/Z7Zyvs5gPGGyOBoAzteBBdJqU7QeZPvqU PGS6XpD8PwOfHzUeQZi4HsZArPefGO+/kWLf7On4z7jVp9S4is6evGjIMz1tnM8AwL62 EBbhdMcyuqX7Aw6wNPgjkqBiueg9Qd2XCSlJqRe68uf0r2DgJz+Pl5PhroOHyNbfn79S 1GUw== 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 hs4si4564260ejc.382.2022.02.15.12.03.44; Tue, 15 Feb 2022 12:04:08 -0800 (PST) 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 S237841AbiBOMmj (ORCPT + 99 others); Tue, 15 Feb 2022 07:42:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237715AbiBOMm3 (ORCPT ); Tue, 15 Feb 2022 07:42:29 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3B919C28; Tue, 15 Feb 2022 04:41:47 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Jyggt1WdHz9sRw; Tue, 15 Feb 2022 13:41:30 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vinG_He-9gjD; Tue, 15 Feb 2022 13:41:30 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Jyggn4KfQz9sST; Tue, 15 Feb 2022 13:41:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 81D548B763; Tue, 15 Feb 2022 13:41:25 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id QTIey80vSQHy; Tue, 15 Feb 2022 13:41:25 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.6.174]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7BB778B77B; Tue, 15 Feb 2022 13:41:24 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 21FCfHOn080645 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 13:41:17 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21FCfHeR080644; Tue, 15 Feb 2022 13:41:17 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Kees Cook , Greg Kroah-Hartman Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 10/13] lkdtm: Force do_nothing() out of line Date: Tue, 15 Feb 2022 13:41:05 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1644928860; l=1269; s=20211009; h=from:subject:message-id; bh=Qfe2la9R+/icLlKyEXlhAjPyrlVNcwt2uKVNooAPO2A=; b=PUqQRJ5Z3OSO7f5BoncMZOdMS2siQUwkpBmdIn0841YNUh5b5dGI0DIvkCrh6y2Oef6Xlz1Pd1ix xp0ZhccnCwmIOMabi3CewXL6jEcMjZBNMx+WVwbOuXj2aeGJeopa X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 LKDTM tests display that the run do_nothing() at a given address, but in reality do_nothing() is inlined into the caller. Force it out of line so that it really runs text at the displayed address. Acked-by: Kees Cook Signed-off-by: Christophe Leroy --- drivers/misc/lkdtm/perms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/lkdtm/perms.c b/drivers/misc/lkdtm/perms.c index 2dede2ef658f..60b3b2fe929d 100644 --- a/drivers/misc/lkdtm/perms.c +++ b/drivers/misc/lkdtm/perms.c @@ -21,7 +21,7 @@ /* This is non-const, so it will end up in the .data section. */ static u8 data_area[EXEC_SIZE]; -/* This is cost, so it will end up in the .rodata section. */ +/* This is const, so it will end up in the .rodata section. */ static const unsigned long rodata = 0xAA55AA55; /* This is marked __ro_after_init, so it should ultimately be .rodata. */ @@ -31,7 +31,7 @@ static unsigned long ro_after_init __ro_after_init = 0x55AA5500; * This just returns to the caller. It is designed to be copied into * non-executable memory regions. */ -static void do_nothing(void) +static noinline void do_nothing(void) { return; } -- 2.34.1