linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	Kees Cook <keescook@chromium.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Ross Zwisler <zwisler@google.com>,
	"wklin@google.com" <wklin@google.com>,
	Vineeth Remanan Pillai <vineeth@bitbyteword.org>,
	Suleiman Souhlal <suleiman@google.com>,
	Linus Torvalds <torvalds@linuxfoundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Subject: Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently
Date: Wed, 1 May 2024 19:11:58 +0300	[thread overview]
Message-ID: <ZjJpzqviUeFnV1A4@kernel.org> (raw)
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 <rppt@kernel.org> 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.

  reply	other threads:[~2024-05-01 16:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 21:02 [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently Steven Rostedt
2024-04-09 21:02 ` [POC][RFC][PATCH 1/2] mm/x86: Add wildcard * option as memmap=nn*align:name Steven Rostedt
2024-04-09 22:23   ` Kees Cook
2024-04-09 23:11     ` Steven Rostedt
2024-04-09 23:41       ` Kees Cook
2024-04-12 20:59         ` Mike Rapoport
2024-04-12 22:19           ` Steven Rostedt
2024-04-15 17:22             ` Kees Cook
2024-05-01 14:57               ` Mike Rapoport
2024-05-06 10:38                 ` Ard Biesheuvel
2024-05-08 23:23                   ` Steven Rostedt
2024-04-09 21:02 ` [POC][RFC][PATCH 2/2] pstore/ramoops: Add ramoops.mem_name= command line option Steven Rostedt
2024-04-09 22:18   ` Kees Cook
2024-04-09 23:14     ` Steven Rostedt
2024-04-09 21:23 ` [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently Steven Rostedt
2024-04-09 22:19   ` Kees Cook
2024-04-09 22:25     ` Luck, Tony
2024-04-09 22:41       ` Joel Fernandes
2024-04-09 23:16       ` Steven Rostedt
2024-04-09 23:37       ` Kees Cook
2024-04-09 23:52         ` Luck, Tony
2024-04-11 19:11       ` Guilherme G. Piccoli
2024-04-11 19:40         ` Steven Rostedt
2024-04-12 12:17           ` Guilherme G. Piccoli
2024-04-12 17:22             ` Steven Rostedt
2024-05-01 14:45               ` Mike Rapoport
2024-05-01 14:54                 ` Steven Rostedt
2024-05-01 15:30                   ` Mike Rapoport
2024-05-01 16:09                     ` Steven Rostedt
2024-05-01 16:11                       ` Mike Rapoport [this message]
2024-05-09  4:00                     ` Steven Rostedt
2024-05-09 17:31                       ` Steven Rostedt
2024-05-09 20:24                         ` Mike Rapoport
2024-05-09 20:33                           ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjJpzqviUeFnV1A4@kernel.org \
    --to=rppt@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gpiccoli@igalia.com \
    --cc=hpa@zytor.com \
    --cc=joel@joelfernandes.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lstoakes@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=suleiman@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linuxfoundation.org \
    --cc=vbabka@suse.cz \
    --cc=vineeth@bitbyteword.org \
    --cc=will@kernel.org \
    --cc=wklin@google.com \
    --cc=x86@kernel.org \
    --cc=zwisler@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).