From patchwork Wed Feb 23 12:02:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12756837 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1479C433FE for ; Wed, 23 Feb 2022 12:02:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3962A8D0003; Wed, 23 Feb 2022 07:02:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 345078D0001; Wed, 23 Feb 2022 07:02:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E5C58D0003; Wed, 23 Feb 2022 07:02:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0B1E98D0001 for ; Wed, 23 Feb 2022 07:02:37 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BA060181CEEA0 for ; Wed, 23 Feb 2022 12:02:36 +0000 (UTC) X-FDA: 79173907512.15.4DE0478 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf01.hostedemail.com (Postfix) with ESMTP id 0C4BD4000A for ; Wed, 23 Feb 2022 12:02:35 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4K3ZRD4f4jz9sSs; Wed, 23 Feb 2022 13:02:32 +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 C7xzbR6pV4X9; Wed, 23 Feb 2022 13:02:32 +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 4K3ZRC0Qfsz9sSg; Wed, 23 Feb 2022 13:02:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F272C8B763; Wed, 23 Feb 2022 13:02:30 +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 AMKOnWc9Kg8a; Wed, 23 Feb 2022 13:02:30 +0100 (CET) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.7.201]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 686C38B779; Wed, 23 Feb 2022 13:02:30 +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 21NC2NXC1148205 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 23 Feb 2022 13:02:23 +0100 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 21NC2MVk1148202; Wed, 23 Feb 2022 13:02:22 +0100 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Luis Chamberlain , Aaron Tomlin Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kgdb-bugreport@lists.sourceforge.net, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Subject: [PATCH v6 6/6] powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx Date: Wed, 23 Feb 2022 13:02:16 +0100 Message-Id: <100cc6b63ba31d527d94674453ceae201af0072e.1645607143.git.christophe.leroy@csgroup.eu> 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=1645617734; l=1645; s=20211009; h=from:subject:message-id; bh=K04OWtjguCoft4Etc2/16pdJhJKZWZgWbhOpnNSgE7U=; b=lS6FQSg3tE3yCPJb+g8j9OCMrPJZvVdMsuJ8tcj5aft81NhPKgwAmf/bVK2FEsMsiwQfML/oGvzt tov5L7ZdB3TPP3OUovRNJLUJrLCD9XnmUvNS+Aa8E9lK3jAt9Su+ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0C4BD4000A X-Stat-Signature: g44s9n8yudzxpzgwybo7jof5psm88xcq X-HE-Tag: 1645617755-27938 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: book3s/32 and 8xx have a separate area for allocating modules, defined by MODULES_VADDR / MODULES_END. On book3s/32, it is not possible to protect against execution on a page basis. A full 256M segment is either Exec or NoExec. The module area is in an Exec segment while vmalloc area is in a NoExec segment. In order to protect module data against execution, select ARCH_WANTS_MODULES_DATA_IN_VMALLOC. For the 8xx (and possibly other 32 bits platform in the future), there is no such constraint on Exec/NoExec protection, however there is a critical distance between kernel functions and callers that needs to remain below 32Mbytes in order to avoid costly trampolines. By allocating data outside of module area, we increase the chance for module text to remain within acceptable distance from kernel core text. So select ARCH_WANTS_MODULES_DATA_IN_VMALLOC for 8xx as well. Signed-off-by: Christophe Leroy Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras --- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 28e4047e99e8..478ee49a4fb4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -156,6 +156,7 @@ config PPC select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_IRQS_OFF_ACTIVATE_MM select ARCH_WANT_LD_ORPHAN_WARN + select ARCH_WANTS_MODULES_DATA_IN_VMALLOC if PPC_BOOK3S_32 || PPC_8xx select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_TABLE_SORT