Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp209435lqp; Fri, 12 Apr 2024 15:19:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKwWfa7Qnkw4wb4nHl7UhgGevLPsa86kvSThAG5mSuemahGJ22mgT5ko3X/V2JPLPDmobmdC81aT8glCdAkM/KXGkrvzuhZjG0oGE2Hw== X-Google-Smtp-Source: AGHT+IExpH791tXaICAjuQcy4wXDO3W/A5PCDvuU5bF2Y7NJfY5nx0S7AjhwmgMcTm5BtS5BNfqv X-Received: by 2002:a05:6359:14c1:b0:17e:b867:cb99 with SMTP id lz1-20020a05635914c100b0017eb867cb99mr4500033rwb.1.1712960393420; Fri, 12 Apr 2024 15:19:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712960393; cv=pass; d=google.com; s=arc-20160816; b=sMjIMlq0YeWDRBFJXFkEM7GpRKKIeFhesmS5hSc5jnowPWK4/r3xoSbE6Wj+nYLPKV Gr07UKGrTa9Hs6QbXL3ANTTFJnhsifKv2aUxFsfXVUPXJdVdcSJMdgnEDcseAsQWbMpg pMiqqEuJ4Ce4SmjPoEPhGseOkxd1s+hW2KUqtfv/tAO6yJ6pJydXKcF/wpVMv6RivFm+ m1t5t4PsGnvyQTDklgIreSEV703x37Y6EsXBArGIq8uCqKZ3WcuDlmv0iO1Pq4ECXy2h FoNBTXuX00pcnw1YnDSlavPwADUGCH+fXBdh1cR04RZ0VE8Q+ErU/Rk4oGkdb7tIhkHj vTwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=n2ExgPZ2LZdaq8SP4tbYJdIRJq7PYRaoGuaN+ZQaeXI=; fh=xEq1q0LFumWnhyUYwiRKPr/21WVaxF5Qo1yxdwLEOQ0=; b=FrpxRUs0ocI7kQKGPr+EN3ugbAGJ/w3u7TukiIqH8fu0iRDahrAkT8kcfnj34OQI1c 5DoaOk0nELoV34PL6a+OKuWtWvnphzmN2i+1qXMjlqAQfnjXDywFWNcV9hkq7vrTiw2b bvOqeBWVdObvqKzx63hebDSvuPDeqfVXMDZbJePg5j5jb8HJACMhT+NHTYHCREpHELLu Yrw80BcgDIHaG7lDb7c1NkeatOf6haNS/e22JaDpMp1Gdc1mobjs7e+3oeGYJ/A2tS+N UYg0rWNUJe93Qy/I5gE1vKFfpRzJyWh0pIW8RRCIaIo8IQ5rWtXrnqFaur3+FfX31zme UtCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-143403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143403-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 20-20020ac85754000000b004365142e0f7si5038437qtx.385.2024.04.12.15.19.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 15:19:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-143403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143403-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 26B8B1C21FF3 for ; Fri, 12 Apr 2024 22:19:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E87E0152500; Fri, 12 Apr 2024 22:19:45 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68CF01514F8; Fri, 12 Apr 2024 22:19:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712960385; cv=none; b=VaZd0LwFSVmbP0n6cwQYUTXMTW03bUY5A3tmKwcwL9w/m2ujZRm7wnkShJuvgZC7tJuV5qWT2XD9+paDDJLia1P32ejz5x/DA94vNFlqXkJGK02+b9XbWf1sCAMYU3UJGD+J0Q9HDQ0hwIYTx9p6WTF2ZHh4HgVbTjSeVnUY0ps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712960385; c=relaxed/simple; bh=/onQSb447PUp3dDVYzH/jjnW7A1pQYjgI2ywHWde/3w=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U3mXSPS7S5duBjgUEbkYKdBGHk9wM1ufpvknbrAtn25h/bV7muc4LK0Ug3e8TLyA08bM5fcb/oCnp/xFAvmEC8SbLxKtX0REYduMOvWA8GUiexUM9KsbfZTbfk6er1TxZyIftkz+fwUZRfDjiF09KM3p7ZrKJ8pdOOlQTwTZIug= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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