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:   Fri, 18 Dec 2020 10:06:31 +0100
From:   Oscar Salvador <osalvador@...e.de>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     corbet@....net, mike.kravetz@...cle.com, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
        dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
        viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
        paulmck@...nel.org, mchehab+huawei@...nel.org,
        pawan.kumar.gupta@...ux.intel.com, rdunlap@...radead.org,
        oneukum@...e.com, anshuman.khandual@....com, jroedel@...e.de,
        almasrymina@...gle.com, rientjes@...gle.com, willy@...radead.org,
        mhocko@...e.com, song.bao.hua@...ilicon.com, david@...hat.com,
        naoya.horiguchi@....com, duanxiongchun@...edance.com,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v10 10/11] mm/hugetlb: Gather discrete indexes of tail
 page

On Thu, Dec 17, 2020 at 08:13:02PM +0800, Muchun Song wrote:
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 6c02f49959fd..78dd88dda857 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1360,7 +1360,7 @@ static inline void hwpoison_subpage_deliver(struct hstate *h, struct page *head)
>  	if (!PageHWPoison(head) || !free_vmemmap_pages_per_hpage(h))
>  		return;
>  
> -	page = head + page_private(head + 4);
> +	page = head + page_private(head + SUBPAGE_INDEX_HWPOISON);
>  
>  	/*
>  	 * Move PageHWPoison flag from head page to the raw error page,
> @@ -1379,7 +1379,7 @@ static inline void hwpoison_subpage_set(struct hstate *h, struct page *head,
>  		return;
>  
>  	if (free_vmemmap_pages_per_hpage(h)) {
> -		set_page_private(head + 4, page - head);
> +		set_page_private(head + SUBPAGE_INDEX_HWPOISON, page - head);

Ok, I was too eager here.

If CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is not set for whatever reason
(e.g: CONFIG_MEMORY_HOTREMOVE is disabled), when you convert "+4"
to its index (SUBPAGE_INDEX_HWPOISON), this will no longer build
since we only define SUBPAGE_INDEX_HWPOISON when the config
option CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is set.

Different things can be done to fix this:

e.g:

 - Define a two different hwpoison_subpage_{deliver,set}
   and have them under
   #ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
   ...
   #else
   ...
   #endif

 - Work it around as is with IS_ENABLED(CONFIG_HUGETLB_...
 - Have a common entry and decide depending on whether
   the config is enabled.

I guess option #1 might be cleaner.

-- 
Oscar Salvador
SUSE L3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ