From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AD68C433EF for ; Wed, 2 Feb 2022 23:36:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbiBBXgm (ORCPT ); Wed, 2 Feb 2022 18:36:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234851AbiBBXgl (ORCPT ); Wed, 2 Feb 2022 18:36:41 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E477C061714; Wed, 2 Feb 2022 15:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sKMSro+nqi3+TRaInDh/r5jt9h3R6I+1JvbqLUuQ9zw=; b=EQFB7AmHjcEOog2AgXpabrhNbq eb+nIuW++r278MsQm+yo6BJLgWEi7DgA0z/LlXygv3QszEhUFbTZTYEd7tnQF95I9q+HDvddpS0dr ZT4oOJqpMyq2CEFRDI9sNR/0008KH9VEFO6SEXb/UlghtmM1nhzbpJM/5gNt8d05BRv4D8tQ5GrZW fpzQ8SgxsTS6vdNOuRec1F/wQ5pWQ0g4+NAL2ajplTSo5BZ+1fnALWGrFPMSPAfHFWRnsxJ/WmIg1 N3Sh1ZVZn6t5DVK/fZ6Xax5LywKa/tBa8o8JoZbW2WIGkbbwfyxz0e9MK78JgVYWCcygyNJY3ImiP uQFa5xkw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFPAz-00H4rN-PB; Wed, 02 Feb 2022 23:36:37 +0000 Date: Wed, 2 Feb 2022 15:36:37 -0800 From: Luis Chamberlain To: Christophe Leroy Cc: Jessica Yu , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kgdb-bugreport@lists.sourceforge.net" , "linux-mm@kvack.org" , "linux-arch@vger.kernel.org" , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Subject: Re: [PATCH v2 5/5] powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 11:28:12AM +0000, Christophe Leroy wrote: > 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 Cc list first and then the SOB. Luis From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7268C433F5 for ; Wed, 2 Feb 2022 23:37:19 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JpyrY5y7Qz3cRy for ; Thu, 3 Feb 2022 10:37:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EQFB7AmH; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=mcgrof@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EQFB7AmH; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Jpyqt5DC8z30N0 for ; Thu, 3 Feb 2022 10:36:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sKMSro+nqi3+TRaInDh/r5jt9h3R6I+1JvbqLUuQ9zw=; b=EQFB7AmHjcEOog2AgXpabrhNbq eb+nIuW++r278MsQm+yo6BJLgWEi7DgA0z/LlXygv3QszEhUFbTZTYEd7tnQF95I9q+HDvddpS0dr ZT4oOJqpMyq2CEFRDI9sNR/0008KH9VEFO6SEXb/UlghtmM1nhzbpJM/5gNt8d05BRv4D8tQ5GrZW fpzQ8SgxsTS6vdNOuRec1F/wQ5pWQ0g4+NAL2ajplTSo5BZ+1fnALWGrFPMSPAfHFWRnsxJ/WmIg1 N3Sh1ZVZn6t5DVK/fZ6Xax5LywKa/tBa8o8JoZbW2WIGkbbwfyxz0e9MK78JgVYWCcygyNJY3ImiP uQFa5xkw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFPAz-00H4rN-PB; Wed, 02 Feb 2022 23:36:37 +0000 Date: Wed, 2 Feb 2022 15:36:37 -0800 From: Luis Chamberlain To: Christophe Leroy Subject: Re: [PATCH v2 5/5] powerpc: Select ARCH_WANTS_MODULES_DATA_IN_VMALLOC on book3s/32 and 8xx Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-arch@vger.kernel.org" , "kgdb-bugreport@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Paul Mackerras , Jessica Yu , "linuxppc-dev@lists.ozlabs.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Jan 27, 2022 at 11:28:12AM +0000, Christophe Leroy wrote: > 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 Cc list first and then the SOB. Luis