Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp578483lqm; Wed, 1 May 2024 09:16:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUg7Kz1FikJGq7XrAdvDQFKZQjPwccowXFxXw3CD/jb6CKSgPi6afak7uo6OZFEcu1SXaD0TC+bQHUUz4bnt1LH+RuEjlWtU1my9cqRg== X-Google-Smtp-Source: AGHT+IE/Cd5XFvug5XUXGG+vNdF8tIjBgHiLYB2mIGm73pf0Wv/xkT138zJPGMhXVhWoYMX1cUCs X-Received: by 2002:a05:6a21:6da2:b0:1ad:9394:2d30 with SMTP id wl34-20020a056a216da200b001ad93942d30mr3170578pzb.37.1714580173181; Wed, 01 May 2024 09:16:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714580173; cv=pass; d=google.com; s=arc-20160816; b=05qQsIlrq1QI64k7ItxCvd+u0R48ZhB0b8gBuJ4AfKczu9ZYzgbSzAheBKKllGkeFg 86tkOlWBKqBs+3FNNkrqqQ3pazxGvJFhVK3n1wIzAATwR/VQvTxVToeyr5uD8bJ6x3Qg 5fFiVBJyJagy3CUYNMrNuzaTS1PWjvGZ4mmCOunE+KSqwnEKOOshCvqGG0gm2J1p8bFV A+EQl6ODTa8iav9jmKA00utQOFl2NLAGnKHmfX9ESvwXYaUsD/zmokwvXQc8XmVnIyFf NQpvSF/djZdi8pPpCaWOaz36s6jCa5PNjErxizCNHg6sDN5dCnynJ7BVFfi/HG2K6/yj kbYQ== 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=U3pWhR5zTem2akPqvQOTbgCojv7W1yCLYBhQCyeJ3yo=; fh=0Hoz004CVqkSauOcyGo6w+Nffyo2aMpqRBWyE8Xt3B8=; b=fDRxX8rCQzulRAantecAovngS6VDKBNeCYPQlILWBsa5KDatSTeu+vyBgB5LfVVjSZ PsJ7m8E6HFSKh9+jQqBdCM4SuIJRgdSMs12Nv4AnruqZlbDCKaXsHGav3eiliOdlfw2/ C5pn8gj9v7ynMCdiepoCObUKbGLvH3bzT4Ci3XjCA2IMEZDJOmW2zkGvUv5S+oyJUOKu GbHtGooj71s0wNONdgfvyTr6sPbPaUTrrUQtijbGWgBKvghm7O62KVT0YDFY9DmFQU/8 12tmEWQtBjGfMoQlrEs1EouuXAzVRIAkKWFU5quhuWgEByt1xZlw5iBmPRBtNhfL0GCX cYvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-165543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165543-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n185-20020a6327c2000000b005f7fd8c4772si23320371pgn.415.2024.05.01.09.16.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-165543-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165543-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2486AB24598 for ; Wed, 1 May 2024 16:08:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AE0112FF80; Wed, 1 May 2024 16:08:26 +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 CDBC78827; Wed, 1 May 2024 16:08:25 +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=1714579705; cv=none; b=HcvFABegW9UXJJerf7k4jqkt45sovKg1IPyWXGaUHBcITKYpj+DheF7LGVq1mEwIIzRtzw/nwwVgQI//EhqiyhzuBKfu2Qu+5Gjlc2g3Q7KLIY83XVntZAzbVokaF7dRkFjkTNpmRIzQN0v804MLv/i5YgSwF2/a9WHYpDuFzIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714579705; c=relaxed/simple; bh=2SspBcZpqjL2uiy7RfwIeISM+1+EsXvx/gfjXujlavw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F33cU1zh+mC52L9Cuvxt97rS32LWtADV+noxty/8VBfoN2sPuufiFCceljo7cJdaXQijEXNbt1LMPCLTuGxJVsfXc8ZZL4TY28uXEpQrR014B4mdBYDZZGdXNCD5mB/P+GbHvI6DLoGM8TKdriM9EepAoEIlEP/DjV1SiKOWgh4= 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 43EE9C072AA; Wed, 1 May 2024 16:08:21 +0000 (UTC) Date: Wed, 1 May 2024 12:09:04 -0400 From: Steven Rostedt To: Mike Rapoport 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: <20240501120904.61c7617c@gandalf.local.home> In-Reply-To: References: <20240409210254.660888920@goodmis.org> <20240409172358.34ea19f0@gandalf.local.home> <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> 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 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. I would still like to get the highest address possible. -- Steve