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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C7ADC4345F for ; Fri, 12 Apr 2024 22:19:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05DA96B0087; Fri, 12 Apr 2024 18:19:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00DC26B0088; Fri, 12 Apr 2024 18:19:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF02C6B0089; Fri, 12 Apr 2024 18:19:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BFB5E6B0087 for ; Fri, 12 Apr 2024 18:19:48 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 81F841A1004 for ; Fri, 12 Apr 2024 22:19:48 +0000 (UTC) X-FDA: 82002298056.04.BBC542C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id C31D81C000F for ; Fri, 12 Apr 2024 22:19:46 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of "SRS0=gdh+=LR=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=gdh+=LR=goodmis.org=rostedt@kernel.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712960386; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n2ExgPZ2LZdaq8SP4tbYJdIRJq7PYRaoGuaN+ZQaeXI=; b=tB7enV3DPhO4sPzQzh+E+z18VOlBq8NFJZdNoP4q2KKIP0gfcEB2XluLTiO+LUv3qmeKi2 voq0qHpKdSdJkZ3bz5xWK/3f+E1lh1J/sDQWkoGe9xH550jYiESfAe4gwcO8bvddqTV4YT FQ+HHx4e5T8BStIecL2suf3UK8uTF0Y= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of "SRS0=gdh+=LR=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=gdh+=LR=goodmis.org=rostedt@kernel.org" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712960386; a=rsa-sha256; cv=none; b=FGrPkiyvznNcA07I/nlHHN95wbX2EyQ5gwXM7P1wj5FqbwwRO5nLrA6DIHT6ygImPQTyU3 U5n8vdASXO5ZqmaOMKIDZoux4+QO4G5wuCAe6K7Jqp/FyCHViSdyMNR401vHNte7Lcynw7 AYlNDyUvGmbdWeLRc2CdRjPuCFVHfIQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 55FFE614D0; Fri, 12 Apr 2024 22:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C37F5C113CC; Fri, 12 Apr 2024 22:19:41 +0000 (UTC) Date: Fri, 12 Apr 2024 18:19:40 -0400 From: Steven Rostedt To: Mike Rapoport Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Tony Luck , "Guilherme G. Piccoli" , linux-hardening@vger.kernel.org, Guenter Roeck , Ross Zwisler , wklin@google.com, Vineeth Remanan Pillai , Joel Fernandes , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon Subject: Re: [POC][RFC][PATCH 1/2] mm/x86: Add wildcard * option as memmap=nn*align:name Message-ID: <20240412181940.3e1d99f7@gandalf.local.home> In-Reply-To: References: <20240409210254.660888920@goodmis.org> <20240409211351.075320273@goodmis.org> <202404091521.B63E85D@keescook> <20240409191156.5f92a15c@gandalf.local.home> <202404091638.2F98764A41@keescook> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C31D81C000F X-Stat-Signature: wiwunz948dwkddgdkjcmidg6dxdxbshr X-HE-Tag: 1712960386-68398 X-HE-Meta: U2FsdGVkX19pgolUSkU440A8Q6IIwDYjnx1liIEIbuWSDurEjVq4GaP7iMUrV1fkcqnOStXbuLE/OHETJzyGOzvTOinzAMU/tNCbKH5SlMbdtfoi4oLdU65n48hMnHYrRCdrC57A+AEStDBs70XgqkcMQHcwdaz0F0i7chDwGiDmddKSZEmPKscSQpLsg0ge1Eyb+pPwL5e7JDw1koAzc2v4xyfmKf+pSeLZ60Tdh1w0eKXPdVpb924zqAPlEAB6Lh+mLSdQrDDGvb9VMd0kUg4eLU1pp/m9MT0uuuQZBnnao0LWpQ29mRTYvfckySbPtRShBE1iyypXh1YREWGGEEfM7OVyUndFX5SHb9rwgnc+19jEUvbVnaPqG5+vJMFTzGW3rtLfWM3dXIdVBBMp/n7NEuZCzXaPtBfEQHbCe+lCkM6RsSi6z9H+Gyooh74GGaP27047pvuRFzQ1gwvctjqvTQFqZwjVdQvZx3nMcgm+KgSda3vLABcU4CB6aRF2hzjhcmhULwaqm5ICwaiWuMOqh24jGRGRjj69RHcB9v/rcUwJ4cKvrCWT6q1RYzgWOA6yEZMn390tPot0l5jCzw7vb9oyYfp86zfoZyS90XEjcVLsqsPwKDjbFsxCzaEFa3OUqMGfCbwL/+YPGyxmLhttUUzVd7BG9vTD/IAi9E3SZI2QrU8zuj2nsBNcOGn0cNrrHfTlX26paKKgYkFVfZZ0iaRkhKfLwdhLjqypvE17SHXQ31elz4zSPlAE4syoZgXUcqBycwm90jV8+gm8Lq5imLzzQdV1h0qpbAeFEA4CqBGTfYiCV2A98YfJsGP2K8xP0mJdr5GlIqvVXaTOuwGMnaANDfi8lTR1vV7uHfXXyDWB3Y72SscLKib5Hi0a1qKpLOIsbuJUN6WPabuxSELT4edUGnZEyighWz4bvjdy3UrofTzfewSynIX47zTrX2hkS/hHptHSKQiLDwi 0eP3fgar 7psi1kKtKXB8KdjsTiZkMlsPrlzkdF0ys/xAYGNyOiWm1FLfKc+P4IlXUHwWA5kGKR6VFySc/wShUAbdqn5VzlET//D+aFYTdFq8MdSCnVMLedKpfmrSxWUI7N65cqUZ9yLgjGsibqSN0sy8cAGvkDjogLDVlVraBNXZJRuKvOsJrpaTX3+HLRW9MP2MNpHjmavu9lWTGQNIBUMtxYgVs0QV8CUF3fZjs+SBCwIMK6ucaM2QdQH4CuEpeMvqzPCVQXM2HrL5WkLwRO7TfdZXBHcqg9HMrFFbjTTfxJlqjTkk8Oan18776uT+RPcz2NXaoCL8+/S9dR8zEmRT9f21IMILvpEp9Vt+W8+ljU/lc7X0njpDA7woLwu4i2Q== 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: List-Subscribe: List-Unsubscribe: On Fri, 12 Apr 2024 23:59:07 +0300 Mike Rapoport wrote: > On Tue, Apr 09, 2024 at 04:41:24PM -0700, Kees Cook wrote: > > On Tue, Apr 09, 2024 at 07:11:56PM -0400, Steven Rostedt wrote: > > > On Tue, 9 Apr 2024 15:23:07 -0700 > > > Kees Cook wrote: > > > > > > > Do we need to involve e820 at all? I think it might be possible to just > > > > have pstore call request_mem_region() very early? Or does KASLR make > > > > that unstable? > > > > > > Yeah, would that give the same physical memory each boot, and can we > > > guarantee that KASLR will not map the kernel over the previous location? > > > > Hm, no, for physical memory it needs to get excluded very early, which > > means e820. > > Whatever memory is reserved in arch/x86/kernel/e820.c, that happens after > kaslr, so to begin with, a new memmap parameter should be also added to > parse_memmap in arch/x86/boot/compressed/kaslr.c to ensure the same > physical address will be available after KASLR. But doesn't KASLR only affect virtual memory not physical memory? This just makes sure the physical memory it finds will not be used by the system. Then ramoops does the mapping via vmap() I believe, to get a virtual address to access the physical address. > > More generally, memmap= is x86 specific and a bit of a hack. > Why won't you add a new kernel parameter that will be parsed in, say, > mm/mm_init.c and will create the mmap_map (or whatever it will be named) > and reserve that memory in memblock rather than in e820? Hmm, I only did this approach because I'm familiar with the memmap hack and extended upon it. But yeah, if I can do the same thing in mm_init.c it could possibly work for all archs. Thanks for the suggestion, I'll play with that. > > This still will require update to arch/x86/boot/compressed/kaslr.c of > course. Oh, is the issue if KASLR maps the kernel over this location, then we lose it? We need to tell KASLR not to touch this location? -- Steve