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: <fd3ac3cd-7349-6bbd-890a-71a9454ca0b3@suse.com>
Date:   Thu, 24 Nov 2022 15:30:03 +0100
From:   Juergen Gross <jgross@...e.com>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org, linux-mm@...ck.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Sander Eikelenboom <linux@...elenboom.it>,
        Yu Zhao <yuzhao@...gle.com>
Subject: Re: [PATCH v2] mm: introduce arch_has_hw_nonleaf_pmd_young()

Hi,

On 24.11.22 15:08, Geert Uytterhoeven wrote:
> Hi Jürgen,
> 
> On Wed, Nov 23, 2022 at 7:53 AM Juergen Gross <jgross@...e.com> wrote:
>> When running as a Xen PV guests commit eed9a328aa1a ("mm: x86: add
>> CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG") can cause a protection violation
>> in pmdp_test_and_clear_young():
>>
>>   BUG: unable to handle page fault for address: ffff8880083374d0
>>   #PF: supervisor write access in kernel mode
>>   #PF: error_code(0x0003) - permissions violation
>>   PGD 3026067 P4D 3026067 PUD 3027067 PMD 7fee5067 PTE 8010000008337065
>>   Oops: 0003 [#1] PREEMPT SMP NOPTI
>>   CPU: 7 PID: 158 Comm: kswapd0 Not tainted 6.1.0-rc5-20221118-doflr+ #1
>>   RIP: e030:pmdp_test_and_clear_young+0x25/0x40
>>
>> This happens because the Xen hypervisor can't emulate direct writes to
>> page table entries other than PTEs.
>>
>> This can easily be fixed by introducing arch_has_hw_nonleaf_pmd_young()
>> similar to arch_has_hw_pte_young() and test that instead of
>> CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG.
>>
>> Fixes: eed9a328aa1a ("mm: x86: add CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG")
>> Reported-by: Sander Eikelenboom <linux@...elenboom.it>
>> Signed-off-by: Juergen Gross <jgross@...e.com>
>> Acked-by: Yu Zhao <yuzhao@...gle.com>
>> Tested-by: Sander Eikelenboom <linux@...elenboom.it>
>> ---
>> V2:
>> - correct function name in commit message to match patch
> 
> Thanks for your patch, which is now commit 3f85e711d5af4fb4 ("mm:
> introduce arch_has_hw_nonleaf_pmd_young()") in next-20221124.
> 
> noreply@...erman.id.au reported a build failure for m68k/allmodconfig,
> which I have bisected to this commit.
> 
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
> 
>> @@ -4073,14 +4073,14 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
>>   #endif
>>                  walk->mm_stats[MM_NONLEAF_TOTAL]++;
>>
>> -#ifdef CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG
>> -               if (get_cap(LRU_GEN_NONLEAF_YOUNG)) {
>> +               if (arch_has_hw_nonleaf_pmd_young() &&
>> +                   get_cap(LRU_GEN_NONLEAF_YOUNG)) {
>>                          if (!pmd_young(val))
> 
> mm/vmscan.c:4102:30: error: implicit declaration of function
> 'pmd_young'; did you mean 'pte_young'?
> [-Werror=implicit-function-declaration]
> 
> pmd_young() seems to be defined only on a handful of architectures.

What would be the preferred fix for that?

I could offer:

- use V1 of the patch
- add the #ifdefs again to this patch (which would be kind of weird)
- use the attached patch


Juergen


View attachment "0001-mm-add-dummy-pmd_young-for-architectures-not-having-.patch" of type "text/x-patch" (3743 bytes)

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ