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: <60117fd7-46ff-326b-34f1-0c7087111ca7@c-s.fr>
Date:   Tue, 17 Mar 2020 09:43:20 +0100
From:   Christophe Leroy <christophe.leroy@....fr>
To:     Baoquan He <bhe@...hat.com>
Cc:     Mike Kravetz <mike.kravetz@...cle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Nishanth Aravamudan <nacc@...ibm.com>,
        Nick Piggin <npiggin@...e.de>, Adam Litke <agl@...ibm.com>,
        Andi Kleen <ak@...e.de>, linux-kernel@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm/hugetlb: Fix build failure with HUGETLB_PAGE but not
 HUGEBTLBFS



Le 17/03/2020 à 09:25, Baoquan He a écrit :
> On 03/17/20 at 08:04am, Christophe Leroy wrote:
>> When CONFIG_HUGETLB_PAGE is set but not CONFIG_HUGETLBFS, the
>> following build failure is encoutered:
> 
>  From the definition of HUGETLB_PAGE, isn't it relying on HUGETLBFS?
> I could misunderstand the def_bool, please correct me if I am wrong.

AFAIU, it means that HUGETLBFS rely on HUGETLB_PAGE, by default 
HUGETLB_PAGE is not selected when HUGETLBFS is not. But it is still 
possible for an arch to select HUGETLB_PAGE without selecting HUGETLBFS 
when it uses huge pages for other purpose than hugetlb file system.

Christophe

> 
> config HUGETLB_PAGE
>          def_bool HUGETLBFS
> 
>>
>> In file included from arch/powerpc/mm/fault.c:33:0:
>> ./include/linux/hugetlb.h: In function 'hstate_inode':
>> ./include/linux/hugetlb.h:477:9: error: implicit declaration of function 'HUGETLBFS_SB' [-Werror=implicit-function-declaration]
>>    return HUGETLBFS_SB(i->i_sb)->hstate;
>>           ^
>> ./include/linux/hugetlb.h:477:30: error: invalid type argument of '->' (have 'int')
>>    return HUGETLBFS_SB(i->i_sb)->hstate;
>>                                ^
>>
>> Gate hstate_inode() with CONFIG_HUGETLBFS instead of CONFIG_HUGETLB_PAGE.
>>
>> Reported-by: kbuild test robot <lkp@...el.com>
>> Link: https://patchwork.ozlabs.org/patch/1255548/#2386036
>> Fixes: a137e1cc6d6e ("hugetlbfs: per mount huge page sizes")
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
>> ---
>>   include/linux/hugetlb.h | 19 ++++++++-----------
>>   1 file changed, 8 insertions(+), 11 deletions(-)
>>
>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index 1e897e4168ac..dafb3d70ff81 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -390,7 +390,10 @@ static inline bool is_file_hugepages(struct file *file)
>>   	return is_file_shm_hugepages(file);
>>   }
>>   
>> -
>> +static inline struct hstate *hstate_inode(struct inode *i)
>> +{
>> +	return HUGETLBFS_SB(i->i_sb)->hstate;
>> +}
>>   #else /* !CONFIG_HUGETLBFS */
>>   
>>   #define is_file_hugepages(file)			false
>> @@ -402,6 +405,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
>>   	return ERR_PTR(-ENOSYS);
>>   }
>>   
>> +static inline struct hstate *hstate_inode(struct inode *i)
>> +{
>> +	return NULL;
>> +}
>>   #endif /* !CONFIG_HUGETLBFS */
>>   
>>   #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
>> @@ -472,11 +479,6 @@ extern unsigned int default_hstate_idx;
>>   
>>   #define default_hstate (hstates[default_hstate_idx])
>>   
>> -static inline struct hstate *hstate_inode(struct inode *i)
>> -{
>> -	return HUGETLBFS_SB(i->i_sb)->hstate;
>> -}
>> -
>>   static inline struct hstate *hstate_file(struct file *f)
>>   {
>>   	return hstate_inode(file_inode(f));
>> @@ -729,11 +731,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
>>   	return NULL;
>>   }
>>   
>> -static inline struct hstate *hstate_inode(struct inode *i)
>> -{
>> -	return NULL;
>> -}
>> -
>>   static inline struct hstate *page_hstate(struct page *page)
>>   {
>>   	return NULL;
>> -- 
>> 2.25.0
>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ