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] [day] [month] [year] [list]
Message-ID: <90c8183e-d5bb-4460-8c93-ab9bbe977d66@redhat.com>
Date: Fri, 7 Mar 2025 09:13:25 +0100
From: David Hildenbrand <david@...hat.com>
To: Luiz Capitulino <luizcap@...hat.com>, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, yuzhao@...gle.com, pasha.tatashin@...een.com
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, muchun.song@...ux.dev
Subject: Re: [PATCH v3 3/3] mm: page_owner: use new iteration API

On 06.03.25 23:44, Luiz Capitulino wrote:
> The page_ext_next() function assumes that page extension objects for a
> page order allocation always reside in the same memory section, which
> may not be true and could lead to crashes. Use the new page_ext
> iteration API instead.
> 
> Fixes: cf54f310d0d3 ("mm/hugetlb: use __GFP_COMP for gigantic folios")
> Signed-off-by: Luiz Capitulino <luizcap@...hat.com>
> ---
>   mm/page_owner.c | 84 +++++++++++++++++++++++--------------------------
>   1 file changed, 39 insertions(+), 45 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 2d6360eaccbb6..65adc66582d82 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -229,17 +229,19 @@ static void dec_stack_record_count(depot_stack_handle_t handle,
>   			handle);
>   }
>   
> -static inline void __update_page_owner_handle(struct page_ext *page_ext,
> +static inline void __update_page_owner_handle(struct page *page,
>   					      depot_stack_handle_t handle,
>   					      unsigned short order,
>   					      gfp_t gfp_mask,
>   					      short last_migrate_reason, u64 ts_nsec,
>   					      pid_t pid, pid_t tgid, char *comm)
>   {
> -	int i;
> +	struct page_ext_iter iter;
> +	struct page_ext *page_ext;
>   	struct page_owner *page_owner;
>   
> -	for (i = 0; i < (1 << order); i++) {
> +	rcu_read_lock();
> +	for_each_page_ext(page, 1 << order, page_ext, iter) {

I realize that we could get rid of all the temporary
page_ext variables and simply operate on iter.page_ext.

If that makes sense, it could be done as a cleanup on top later. Thanks 
Luiz!

Acked-by: David Hildenbrand <david@...hat.com>

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ