Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp576862lqm; Wed, 1 May 2024 09:13:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPQ1KVUorc90wSpvSWh578u6XbRHgGVllxLK6W4XzOyc0qfTx0H7ZELdGXrJa7oSa3DdHWzPdAt9oJyP5XzUzSdZCxJO/DqDPniA71YQ== X-Google-Smtp-Source: AGHT+IHzy+VoaSYPdPjwZFuS68ZQAZHx7IKzTS51iIw1WSsgKWOtFdJQO5CQJ2S4BbSuO4rbUu1y X-Received: by 2002:a17:906:eb17:b0:a58:7236:7f15 with SMTP id mb23-20020a170906eb1700b00a5872367f15mr93934ejb.4.1714580034478; Wed, 01 May 2024 09:13:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714580034; cv=pass; d=google.com; s=arc-20160816; b=MYb+sB9VA++EmS5N+ZDfTnP76qJ2m3tBfdDfp+JuXvZuivYDtfU1NzzdXbnhL7+tyY UKshfwwgLeEHXj8drOZsVXTzJt8v8N3BMQ1an/211/Pl2u7rv79WYRRJCMomPXO5x95n Yhw8/n+SzCY8LtgCNUDcEiGD93o8wrXZcs0Yt6pd4dYd3VR5+6ncKT/AA1MBy3hKsi9l jaoAA+F44CXsEBct3GZyrrqttHPWLYESxjKwCTfIAgSJYmhAanNeqqPpuCYWzLaNlXsb 2OGFlCd/KnwwkmfWzd2OzHmiglPJLOAEd0TjfoeI4GAhMufDp4qlCG/bfLUa95p/UFAz 2k7Q== 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=Aw9lf5sPa5PWSp7uV1A86FDCi3Jf3ZFSX8U93wKWbeE=; fh=sSWMxOZz+jOfCdICJfDM8nvIt5v/NuLijeny2jgjbUE=; b=on5OnG6y3PA29fHess7BxEMkXH+f+VG9l7h5PcVPWPouemjZPO6yziBWbVswM+0WxU S78eFwm1jHZxcLjHdNq7UEF9u0MuN6blb47e8u7hiixeAHTPQUrw3hN4x6kawYf5NJZV w+lrUAvnwLegffwAf8586BLuWsIzN+HX4ea54XUO7R+M6guC3GD/Fj602OmfamTkcmia KLHdffs/bEuCCciYPaEdljIedTJolmWzk7bNIGNNbECYM98valGfDhyaDRPE9z2Y3JKh NMMjkqeaiCZ68g1BpUqaY16+/KFCnMZp7xllxkx7XkhsAdTK+gcfm4jjBCTslpSUx4p2 Eyrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SK76njsD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165548-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165548-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 j2-20020a170906474200b00a4e207ee793si16595936ejs.646.2024.05.01.09.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165548-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=SK76njsD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165548-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165548-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 14CA01F22234 for ; Wed, 1 May 2024 16:13:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3D9612FF93; Wed, 1 May 2024 16:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SK76njsD" 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 E4C1A12FB36; Wed, 1 May 2024 16:13:31 +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=1714580012; cv=none; b=vFyEYVw5tVUAwtjGbkO62+HOVLa9u6eWTfzZX1AhLDJpxfMARTVXjBImTLGty+wuccwdRCDIymEp8RMg8BIf9EWlEqzcae9S5CvrYQnmb1dLT1epQCngabyiDr0qN+yozt5iiqceu5phJGaSFSDTI8/oJGN9xiaSsIWtv820vvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714580012; c=relaxed/simple; bh=dFzfiSp+K+7eC8iqd8lGaatDkcEc0b44t6mRfekFWs0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S9twhZVkeCqNsk+Zo6dpz9YJSf0uuEPMPZ8BXqvlwg2G1v236yVmXHmy4vNSwoF/1RemRlHqCUgVhYOVIudzIGo3NXM6MrrhsTMT7BI686Epiu4m9UsVEMfwgtYIOD42M16oX4BQH5/aKrSgTPFFEkX7R3yzNWoVmrhy7wy8uWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SK76njsD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FA2DC072AA; Wed, 1 May 2024 16:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714580011; bh=dFzfiSp+K+7eC8iqd8lGaatDkcEc0b44t6mRfekFWs0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SK76njsD/UbgyWhKEa5gdiXSDYZ7FmYrHbjk4phy4JQ/5y++dgaAoK7dFrTnpbgJm wWqEsJ5UHazwnyXBq6qImP5pWtHrNCce6zW2vPHGcBPotG1/tWoiJPC2bQ6ETPpuLD 4EzW/uEvNHTm/x3mPEh/1agcO0v6woJRSKhugvfmwXAyGCT3/BtkrU9EYh/7s8n7Yc WJ4yH29ddvKTUhqJTvKmHJYADF6hgHLpuh5KVdp95Du1ZUbMx2Ry/MJLU/peSJ02Gx rJdVEZoG89TjPu1YbCz0ASGT8cme30P+XUQHFhwv9omUtihZ90EV6FDEgjt4eNqLjE 7Jutct3+m0Z2Q== Date: Wed, 1 May 2024 19:11:58 +0300 From: Mike Rapoport To: Steven Rostedt Cc: "Guilherme G. Piccoli" , "Luck, Tony" , Kees Cook , Joel Fernandes , "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 , "linux-hardening@vger.kernel.org" , Guenter Roeck , Ross Zwisler , "wklin@google.com" , Vineeth Remanan Pillai , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon Subject: Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently Message-ID: References: <202404091519.B7B2221@keescook> <3391c693-cf54-526b-79a8-d565e7140947@igalia.com> <20240411154007.5bdf8d95@gandalf.local.home> <20240412132243.053ad096@gandalf.local.home> <20240501105455.42b78a0b@gandalf.local.home> <20240501120904.61c7617c@gandalf.local.home> 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: <20240501120904.61c7617c@gandalf.local.home> On Wed, May 01, 2024 at 12:09:04PM -0400, Steven Rostedt wrote: > On Wed, 1 May 2024 18:30:40 +0300 > Mike Rapoport wrote: > > > > > /* > > > > * Parse early_reserve_mem=nn:align:name > > > > */ > > > > static int __init early_reserve_mem(char *p) > > > > { > > > > phys_addr_t start, size, align; > > > > char *oldp; > > > > int err; > > > > > > > > if (!p) > > > > return -EINVAL; > > > > > > > > oldp = p; > > > > size = memparse(p, &p); > > > > if (p == oldp) > > > > return -EINVAL; > > > > > > > > if (*p != ':') > > > > return -EINVAL; > > > > > > > > align = memparse(p+1, &p); > > > > if (*p != ':') > > > > return -EINVAL; > > > > > > > > start = memblock_phys_alloc(size, align); > > > > > > So this will allocate the same physical location for every boot, if booting > > > the same kernel and having the same physical memory layout? > > > > Up to kaslr that might use that location for the kernel image. > > But it's the same as allocating from e820 after kaslr. > > > > And, TBH, I don't have good ideas how to ensure the same physical location > > with randomization of the physical address of the kernel image. > > I'll try it out. Looking at arch/x86/boot/compressed/kaslr.c, if I read the > code correctly, it creates up to a 100 slots to store the kernel. > > The method I used was to make sure that the allocation was always done at > the top address of memory, which I think would in most cases never be > assigned by KASLR. > > This looks to just grab the next available physical address, which KASLR > can most definitely mess with. On x86 memblock allocates from top of the memory. As this will run later than e820, the allocation will be lower than from e820, but still close to the top of the memory. > I would still like to get the highest address possible. > > -- Steve -- Sincerely yours, Mike.