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: <4EEF960F.1070909@gmail.com>
Date:	Mon, 19 Dec 2011 11:52:47 -0800
From:	David Daney <ddaney.cavm@...il.com>
To:	David Rientjes <rientjes@...gle.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Paul Mundt <lethal@...ux-sh.org>, linux-kernel@...r.kernel.org,
	David Daney <david.daney@...ium.com>
Subject: Re: [PATCH] mm: Fix BUILD_BUG assertion in pmdp_clear_flush_young()

On 12/19/2011 11:29 AM, David Rientjes wrote:
> On Mon, 19 Dec 2011, David Daney wrote:
>
>> From: David Daney<david.daney@...ium.com>
>>
>> It has been reported that when building for sh:
>>
>>      mm/pgtable-generic.c: In function 'pmdp_clear_flush_young':
>>      mm/pgtable-generic.c:76: error: call to '__build_bug_failed' declared with attribute error: BUILD_BUG failed
>>
>> Adding some ugle #ifdeffery will probably fix this issue.
>>
>
> It won't, CONFIG_HUGETLB_PAGE has nothing at all to do with this.
>

Sorry for the noise.  You are correct.


>> Signed-off-by: David Daney<david.daney@...ium.com>
>> ---
>>
>> This is completely untested, but may be the best fix for this.  Linus
>> and others have expressed a dislike for using BUG() to detect what
>> should be dead code paths at runtime, but it seems to be the state of
>> the art here.
>>
>
> The problem here is that HPAGE_PMD_MASK is being referenced without
> CONFIG_TRANSPARENT_HUGEPAGE.  pmdp_clear_flush_young() is only applicable
> with that config option enabled.  So rather than trying to minimize lines
> captured under an #ifdef by placing the BUG() directly in the function for
> asm-generic, you'll need to wrap pmd_clear_flush_young() with
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE and define its equivalent for
> CONFIG_TRANSPARENT_HUGEPAGE=n that breaks the build if not enabled.
>

That does sound like a better option.

I still think having the BUILD_BUG defined as we do in Andrew Morton's 
tree is the correct approach, and I don't want to see that reverted 
because of this ugliness.

Really this is hackery that should be cleaned up as you suggest, instead 
of being papered over with this BUG() thing.  I can't test SH things, 
otherwise I might look at it.  The SH maintainers should probably take a 
look instead.

David Daney

>>   mm/pgtable-generic.c |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
>> index eb663fb..73784c8 100644
>> --- a/mm/pgtable-generic.c
>> +++ b/mm/pgtable-generic.c
>> @@ -70,7 +70,7 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma,
>>   			   unsigned long address, pmd_t *pmdp)
>>   {
>>   	int young;
>> -#ifndef CONFIG_TRANSPARENT_HUGEPAGE
>> +#if !defined(CONFIG_HUGETLB_PAGE) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
>>   	BUG();
>>   #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>>   	VM_BUG_ON(address&  ~HPAGE_PMD_MASK);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ