[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240611153913.1568be52@gandalf.local.home>
Date: Tue, 11 Jun 2024 15:39:13 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Wei Yang <richard.weiyang@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Masami
Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Lorenzo Stoakes <lstoakes@...il.com>,
linux-mm@...ck.org, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
<mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
<dave.hansen@...ux.intel.com>, x86@...nel.org, "H. Peter Anvin"
<hpa@...or.com>, Peter Zijlstra <peterz@...radead.org>, Kees Cook
<keescook@...omium.org>, Tony Luck <tony.luck@...el.com>, "Guilherme G.
Piccoli" <gpiccoli@...lia.com>, linux-hardening@...r.kernel.org, Guenter
Roeck <linux@...ck-us.net>, Ross Zwisler <zwisler@...gle.com>,
wklin@...gle.com, Vineeth Remanan Pillai <vineeth@...byteword.org>, Joel
Fernandes <joel@...lfernandes.org>, Suleiman Souhlal <suleiman@...gle.com>,
Linus Torvalds <torvalds@...uxfoundation.org>, Catalin Marinas
<catalin.marinas@....com>, Will Deacon <will@...nel.org>, Ard Biesheuvel
<ardb@...nel.org>, Mike Rapoport <rppt@...nel.org>
Subject: Re: [PATCH v2 1/2] mm/memblock: Add "reserve_mem" to reserved named
memory at boot up
On Tue, 11 Jun 2024 11:12:18 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> > >+ p++;
> > >+ err = reserved_mem_add(start, size, p);
> > >+ if (err) {
> > >+ memblock_phys_free(start, size);
> > >+ return err;
> > >+ }
> > >+
> > >+ p += strlen(p);
> > >+
> > >+ return *p == '\0' ? 0: -EINVAL;
> >
> > We won't free the memory if return -EINVAL?
I actually copied this from parse_memmap_one() in arch/x86/kernel/e820.c
and now looking at it, it's a pretty stupid check.
It does: p += strlen(p); which requires p ending with '\0'. So this will
likely bug if there is no '\0'.
I'm going to remove this, but still check to make sure that the name has
some length before the allocation.
-- Steve
Powered by blists - more mailing lists