lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ziy8AsAGZyKCyXX_@kernel.org>
Date: Sat, 27 Apr 2024 11:49:06 +0300
From: Mike Rapoport <rppt@...nel.org>
To: DaeRo Lee <skseofh@...il.com>
Cc: robh@...nel.org, saravanak@...gle.com, akpm@...ux-foundation.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, Daero Lee <daero_le.lee@...sung.com>
Subject: Re: [PATCH v2] memblock: add no-map alloc functions

On Fri, Apr 19, 2024 at 10:59:52AM +0900, DaeRo Lee wrote:
> 2024년 4월 19일 (금) 오전 10:46, DaeRo Lee <skseofh@...il.com>님이 작성:
> >
> > In memmap_init_reserved_pages, we mark memblock.reserved as
> > PageReserved first and mark the memblock.reserved with nomap flag
> > also.
> Sorry. This is my mistake. 'memblock.memory with nomap flag' is right.
> 
> > -> Isn't this duplicated work? (If we add no-map region to
> > memblock.reserved 'and' mark in memblock.memory..)
> > So, I think that for the no-map region, we don't need to add to the
> > memblock.reserved.
> > This is what we do now in early_init_dt_reserve_memory. the nomap
> > region is not added to the memblock.reserved.
> >
> > In early_init_dt_alloc_reserved_memory_arch, if 'nomap' is true, we
> > mark the memblock.memory region as _NOMAP. And if the return value
> > 'err' is not zero(which is '-ENOMEM' from memblock_isolate_range), we
> > free the region.
> > - 'nomap' is true -> memblock_mark_nomap : success -> not free the region
> >
> > : fail -> free the region
> > And it can be said that we add the region to the memblock.reserved
> > using memblock_phys_alloc_range and if the region is nomap, then we
> > can free the region from memblock.reserved. But is it necessary to add
> > it to memblock.reserved? We just need the region in memblock.memory to
> > mark nomap.
> >
> > So, here is what I think:
> > - reserved-memory w/ nomap region -> mark only to memblock.memory
> > - reserved-memory w/o nomap region -> add to the memblock.reserved

NOMAP and memblock.reserved are semantically different, and at makes sense
to have a "reserved nomap" node in fdt recorded in both memblock.memory and
memblock.reserved.

memblock.reserved represents the memory that is used by firmware or early
kernel allocation, so reserved memory in fdt should be reserved in memblock
as well. I believe it's an oversight that early_init_dt_reserve_memory()
does not call memblock_reserve() for nomap memory.

NOMAP is a property of a memory region that says that that region should
not be mapped in the linear map, it's not necessarily in use.

> > Regards,
> > DaeRo Lee

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ