From patchwork Fri Mar 22 07:42:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10865171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D76FA922 for ; Fri, 22 Mar 2019 07:43:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B88D82A5CE for ; Fri, 22 Mar 2019 07:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC2532A5D1; Fri, 22 Mar 2019 07:43:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D11A2A5CE for ; Fri, 22 Mar 2019 07:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pAVtXZBU4e7fj/u7p3MWsl9Dh5NtzwXafdL2iQXQ4yc=; b=SnxRx8sMoZbfid bl0hugBQ8cpdquAnMAaVIRJLwPYqXeZ1wtqpfHgeibq+C1lP8QIgwrUQ8BctzGrjzPq8zmvMiHbqY LwvWrIYpLmE0ZhaLtCBm0Ig74iqbskMqO1MFvAXb/vb8/UybdmOQy/wbYtXeqTqmORNifQgpgI8lc 2HsJFhHB9PWNLszdcDd5eDtjLr5D4edYfOahlghV3zKctipTXbYJE6GtIlHqK151Qhkb01xQUNoZe AdWtQsWkao4ajgLf0K59jPGlrEG7UXc2qb+FHEGXXBcgxf/WAonBslB72oMT4WGPgiCfsoV895ftx IZ0BoPwHtFmMTMdoH23A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7Epe-0004TS-R7; Fri, 22 Mar 2019 07:43:14 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7EpX-0004LO-5C; Fri, 22 Mar 2019 07:43:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uuVoQSuf+9094U8dvrcpi1WtCkgz+3tOu7qt/A6L9wg=; b=HJX0GBQEgA/iCwexYoTBQOVUjp pvRvX5eU1Lnp65EBUh7qY2aQCXv19+so6v/EqGS1V98LpJT8kEeAfgjj86ynOixyBKCob9F1LPfJ7 SoBqEo+ZIn5ku63GAKRxJJ/GlMBaiox0q/kLX+ZQIqL9nzbGB2cZPcrJlPOvQdbizS7Qprw31zycx OSM7cxt4bpmrf2EunzyQy4IcV53j6t4f23DBp3dZvbee1zof1uSse8IHExnQxNHu+MWE62LXlbIYt QKngmzXtfQSNp3Hix34w9Cfa+fHC8pR7UtJtlsN0afgvJKvTMGxSy/WK7scb5IDq0FH+ii6mze3Rw 3sKC4kfA==; Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7EpT-0005Sb-K7; Fri, 22 Mar 2019 07:43:05 +0000 X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C432F1C0006; Fri, 22 Mar 2019 07:42:26 +0000 (UTC) From: Alexandre Ghiti To: Christoph Hellwig , Russell King , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , Palmer Dabbelt , Albert Ou , Alexander Viro , Luis Chamberlain , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 0/4] Provide generic top-down mmap layout functions Date: Fri, 22 Mar 2019 03:42:21 -0400 Message-Id: <20190322074225.22282-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190322_074303_723045_F175DC01 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Ghiti Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This series introduces generic functions to make top-down mmap layout easily accessible to architectures, in particular riscv which was the initial goal of this series. The generic implementation was taken from arm64 and used successively by arm, mips and finally riscv. Note that in addition the series fixes 2 issues: - stack randomization was taken into account even if not necessary. - [1] fixed an issue with mmap base which did not take into account randomization but did not report it to arm and mips, so by moving arm64 into a generic library, this problem is now fixed for both architectures. This work is an effort to factorize architecture functions to avoid code duplication and oversights as in [1]. [1]: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1429066.html Alexandre Ghiti (4): arm64, mm: Move generic mmap layout functions to mm arm: Use generic mmap top-down layout mips: Use generic mmap top-down layout riscv: Make mmap allocation top-down by default arch/arm/include/asm/processor.h | 2 +- arch/arm/mm/mmap.c | 52 ---------------- arch/arm64/include/asm/processor.h | 2 +- arch/arm64/mm/mmap.c | 72 ---------------------- arch/mips/include/asm/processor.h | 4 +- arch/mips/mm/mmap.c | 57 ----------------- arch/riscv/Kconfig | 12 ++++ arch/riscv/include/asm/processor.h | 1 + fs/binfmt_elf.c | 20 ------ include/linux/mm.h | 2 + kernel/sysctl.c | 6 +- mm/util.c | 99 +++++++++++++++++++++++++++++- 12 files changed, 121 insertions(+), 208 deletions(-)