Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp169523lqp; Fri, 12 Apr 2024 14:00:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQgEnFkRWxXK/43ErgaFzpaSIMcgzzjsh5tGpdQpppegbwmXNbmGKG60eAqwYs7FUfi3dfqj2Yvk0b1k+LIMeSRDJ8IxLLNmt33GUbVQ== X-Google-Smtp-Source: AGHT+IGRBy9r/P1J0yJH6JYbPphwUpDkKFoEm3tob6KKAjUwEClRVUoT+mxfS9S1xcPIFTXfyWS9 X-Received: by 2002:a17:906:af88:b0:a52:3eb9:9da5 with SMTP id mj8-20020a170906af8800b00a523eb99da5mr1298520ejb.0.1712955625976; Fri, 12 Apr 2024 14:00:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712955625; cv=pass; d=google.com; s=arc-20160816; b=DWg7Skhnzyqrh7fHyXvMWJv8KHhb1l+XpU2MQ+UspUdpYIvFLoco0DD/auOs7curcL L3+IHiGbrXyTb20RtcpYygg0ngnY4wZs3KdVTo/tvhJ2u9hNNP67Ueoc80Rnuuuvu+xP kjg74FagCIr+iwZCqLD45oJRFyRPrtS7+0fqltiGmVntIjs2zaMnfvjVrzN/MasXnjuW 6Yx1sknBAf339aYJgLfdzaTiGdbv7lEjmsMsc1amfthO5hfMTpP+5ANupt3yvwMIZoyF jrwnaVc2JSeoRH0WjBD7DkKN9WH5YF0cQTktOPwiAU/H6VsOMpJWwGDNu9H2CQxbkVSZ LBVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ng192+jd6+vzKFPpGDmI8088reQyIhGw/Bb/+1ieXu4=; fh=i4AtILediB2deLpOr3oM+2bbRJ4kXXyAP34+/+qZpF8=; b=oZOwo6BwQ06QRrYe5rrMOVnl9dabxvJVuN/zQC4lmxGReCWvOdUzkFVPmudS4T4Pdi 0j8PiHY7gtZgDM3dyZseuu21rFydRs5OMhQrar5eeaGX6TrGUHLGCfpYyWGkt1BjqqSc 5FqeIAq3u3gsJ193vDbskVEhmKlAw0O4FZxT/YGXQ60eIqLF3WEe58TN/Jpchyv3QK8z n2/UK6GX7YB7b+Zm/7h++gmLFS6bD9kNyHDJbHb+ZwXyRHHzLQxRRZbDL2Dyf0Qqvdat P99BOemy1MafCIltmGoGunnUPWN07/FN+u2z4zoMIMYIXAI8gVsYEw9zyWvzeQlwyFAD q9QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lFsV9t9s; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y18-20020a17090668d200b00a5199ccf789si2016932ejr.182.2024.04.12.14.00.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 14:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lFsV9t9s; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8C25C1F23AA3 for ; Fri, 12 Apr 2024 21:00:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0892814A600; Fri, 12 Apr 2024 21:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lFsV9t9s" 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 299EB3D0B8; Fri, 12 Apr 2024 21:00:17 +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=1712955618; cv=none; b=GRTKeQjVFdOHfekDtVLW5wX0/tYQ+rfzhW+SnUkanIaJJZRE1f7a39OLa4BPy2fQ0pg1sYuRhmk3Pfx06cRuwSNVG11tD14/QAwDmMYMDiTEw/sU4F8wBdx5fv8vkKuAgXH317c/jAPZGAxyAzw9mNAunHPvCBHnfbb1RCzrP7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955618; c=relaxed/simple; bh=ufExrA51nJyDuRZXOc6Zqlx89622UOkI5PEpjDpkuFg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cp8emQNQyaC95k2tdM88XmneZPbgxjmGNcYoEHWcWPFT3qHMLZLkVAAaB0tfjAt0C9y3UdJml4hRGHPqFj4KvVIR1b02cj8ynpDAbGR8HA+UQT3f17D574QvPKn41HRSLILR0nIC+tpBfkDwDIj920mzUl1XRQf+66nhOcjuJi4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lFsV9t9s; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6111BC2BD11; Fri, 12 Apr 2024 21:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712955617; bh=ufExrA51nJyDuRZXOc6Zqlx89622UOkI5PEpjDpkuFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lFsV9t9s6+jpzEwEmP+dIWWBhZTPFt/rJGzOY6NZzVIQABiZruk5OcirG5RfZyaI9 27ZctoEN1U22XtTW9xZ5n2pIr06PaWb7bBC0Ni0SuZ0eaMoA79uJvs+gZCbYIrBCxU TNq6G2mAbVIwDgOLIvHsBPwMzdFHb9/8gYHG+Oo2gPoaqHB1W2zpKXBMA/95RDgTtM eNEGMhpqyDatnIsgX649O4JJVbadReziMgJhiahKHqaIvlVFPd5G0Qg9iQLKZTcdiE 4a4Z0QCDgYqvDj1lB6ZUvihWCdBiervg3/7lJMb7zUF2FgPIlc6qipDc4Qe9sQMnTy xlxJ/gPTg75BQ== Date: Fri, 12 Apr 2024 23:59:07 +0300 From: Mike Rapoport To: Kees Cook Cc: Steven Rostedt , 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: References: <20240409210254.660888920@goodmis.org> <20240409211351.075320273@goodmis.org> <202404091521.B63E85D@keescook> <20240409191156.5f92a15c@gandalf.local.home> <202404091638.2F98764A41@keescook> 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-Disposition: inline In-Reply-To: <202404091638.2F98764A41@keescook> 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. 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? This still will require update to arch/x86/boot/compressed/kaslr.c of course. > So, yeah, your proposal makes sense. I'm not super excited > about this be x86-only though. What does arm64 for for memmap? > > -- > Kees Cook > -- Sincerely yours, Mike.