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]
Date:   Mon, 23 Oct 2023 17:17:41 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     wang wei <a929244872@....com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/page_alloc: fix the potential memory waste in
 page_frag_alloc_align

On Mon, Oct 23, 2023 at 11:42:16PM +0800, wang wei wrote:
> First step, allocating a memory fragment with size 1KB bytes uses
> page_frag_alloc_align.  It will allocate PAGE_FRAG_CACHE_MAX_SIZE
> bytes by __page_frag_cache_refill, store the pointer at nc->va and
> then return the last 1KB memory fragment which address is nc->va
> + PAGE_FRAG_CACHE_MAX_SIZE - 1KB. The remaining PAGE_FRAG_CACHE_MAX_SIZE
> - 1KB bytes of memory can Meet future memory requests.
> 
> Second step, if the caller requests a memory fragment with size
> more then PAGE_FRAG_CACHE_MAX_SIZE bytes,  page_frag_alloc_align,
> it will also allocate PAGE_FRAG_CACHE_MAX_SIZE bytes by
> __page_frag_cache_refill,  store the pointer at nc->va, and
> return NULL.  this behavior makes the rest of
> PAGE_FRAG_CACHE_MAX_SIZE - 1KB bytes memory at First step are
> wasted(allocate from buddy system but not used).

We could do this, but have you ever seen this happen, or are you
just reading code and looking for problems?  If the latter, I think
you've misunderstood how this allocator is normally used.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ