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: <57fccd67-39c7-f5c8-ce9c-a6e390ca5d5e@csgroup.eu>
Date:   Tue, 5 Sep 2023 04:46:47 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Nicholas Piggin <npiggin@...il.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH] powerpc/64e: Fix wrong test in
 __ptep_test_and_clear_young()



Le 05/09/2023 à 04:36, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@...roup.eu> writes:
>> Commit 45201c879469 ("powerpc/nohash: Remove hash related code from
>> nohash headers.") replaced:
>>
>>    if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
>> 	return 0;
>>
>> By:
>>
>>    if (pte_young(*ptep))
>> 	return 0;
>>
>> But it should be:
>>
>>    if (!pte_young(*ptep))
>> 	return 0;
> 
> 
> That seems bad :)
> 
> But I don't know off the top of my head where
> __ptep_test_and_clear_young() is used, and so what the symptoms could
> be. Presumably nothing too bad or someone would have noticed?
> 

The two uses in mm/vmscan.c are as follows:

	if (!ptep_test_and_clear_young(args->vma, addr, pte + i))
		VM_WARN_ON_ONCE(true);

So it seems to be expected to never happen.

The only useful place it is used seems to be folio_check_references() 
which is part of the reclaim process. So probably it messes up swap, but 
to what extent ? ppc64e is for embedded systems. Do embedded systems 
have swap at all ?

Also surprising that it is also called from mm/debug_vm_pgtable.c so 
shouldn't we have noticed earlier ? I'll check if it works.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ