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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 17 Jul 2020 08:50:35 +0530
From:   Anshuman Khandual <anshuman.khandual@....com>
To:     Steven Price <steven.price@....com>, linux-mm@...ck.org
Cc:     Catalin Marinas <catalin.marinas@....com>,
        Heiko Carstens <heiko.carstens@...ibm.com>,
        Paul Mackerras <paulus@...ba.org>,
        "H. Peter Anvin" <hpa@...or.com>, agordeev@...ux.ibm.com,
        Will Deacon <will@...nel.org>, linux-riscv@...ts.infradead.org,
        linux-arch@...r.kernel.org, linux-s390@...r.kernel.org,
        Michael Ellerman <mpe@...erman.id.au>, x86@...nel.org,
        christophe.leroy@...roup.eu, Mike Rapoport <rppt@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Ingo Molnar <mingo@...hat.com>,
        linux-arm-kernel@...ts.infradead.org, ziy@...dia.com,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        linux-snps-arc@...ts.infradead.org,
        Vasily Gorbik <gor@...ux.ibm.com>, cai@....pw,
        Paul Walmsley <paul.walmsley@...ive.com>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        Thomas Gleixner <tglx@...utronix.de>,
        gerald.schaefer@...ibm.com, christophe.leroy@....fr,
        Vineet Gupta <vgupta@...opsys.com>,
        linux-kernel@...r.kernel.org, Palmer Dabbelt <palmer@...belt.com>,
        aneesh.kumar@...ux.ibm.com, Borislav Petkov <bp@...en8.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linuxppc-dev@...ts.ozlabs.org, rppt@...nel.org
Subject: Re: [PATCH V5 1/4] mm/debug_vm_pgtable: Add tests validating arch
 helpers for core MM features



On 07/16/2020 07:44 PM, Steven Price wrote:
> On 13/07/2020 04:23, Anshuman Khandual wrote:
>> This adds new tests validating arch page table helpers for these following
>> core memory features. These tests create and test specific mapping types at
>> various page table levels.
>>
>> 1. SPECIAL mapping
>> 2. PROTNONE mapping
>> 3. DEVMAP mapping
>> 4. SOFTDIRTY mapping
>> 5. SWAP mapping
>> 6. MIGRATION mapping
>> 7. HUGETLB mapping
>> 8. THP mapping
>>
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
>> Cc: Gerald Schaefer <gerald.schaefer@...ibm.com>
>> Cc: Christophe Leroy <christophe.leroy@....fr>
>> Cc: Mike Rapoport <rppt@...ux.ibm.com>
>> Cc: Vineet Gupta <vgupta@...opsys.com>
>> Cc: Catalin Marinas <catalin.marinas@....com>
>> Cc: Will Deacon <will@...nel.org>
>> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
>> Cc: Paul Mackerras <paulus@...ba.org>
>> Cc: Michael Ellerman <mpe@...erman.id.au>
>> Cc: Heiko Carstens <heiko.carstens@...ibm.com>
>> Cc: Vasily Gorbik <gor@...ux.ibm.com>
>> Cc: Christian Borntraeger <borntraeger@...ibm.com>
>> Cc: Thomas Gleixner <tglx@...utronix.de>
>> Cc: Ingo Molnar <mingo@...hat.com>
>> Cc: Borislav Petkov <bp@...en8.de>
>> Cc: "H. Peter Anvin" <hpa@...or.com>
>> Cc: Kirill A. Shutemov <kirill@...temov.name>
>> Cc: Paul Walmsley <paul.walmsley@...ive.com>
>> Cc: Palmer Dabbelt <palmer@...belt.com>
>> Cc: linux-snps-arc@...ts.infradead.org
>> Cc: linux-arm-kernel@...ts.infradead.org
>> Cc: linuxppc-dev@...ts.ozlabs.org
>> Cc: linux-s390@...r.kernel.org
>> Cc: linux-riscv@...ts.infradead.org
>> Cc: x86@...nel.org
>> Cc: linux-mm@...ck.org
>> Cc: linux-arch@...r.kernel.org
>> Cc: linux-kernel@...r.kernel.org
>> Tested-by: Vineet Gupta <vgupta@...opsys.com>    #arc
>> Reviewed-by: Zi Yan <ziy@...dia.com>
>> Suggested-by: Catalin Marinas <catalin.marinas@....com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
>> ---
>>   mm/debug_vm_pgtable.c | 302 +++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 301 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
>> index 61ab16fb2e36..2fac47db3eb7 100644
>> --- a/mm/debug_vm_pgtable.c
>> +++ b/mm/debug_vm_pgtable.c
> [...]
>> +
>> +static void __init pte_swap_tests(unsigned long pfn, pgprot_t prot)
>> +{
>> +    swp_entry_t swp;
>> +    pte_t pte;
>> +
>> +    pte = pfn_pte(pfn, prot);
>> +    swp = __pte_to_swp_entry(pte);
> 
> Minor issue: this doesn't look necessarily valid - there's no reason a normal PTE can be turned into a swp_entry. In practise this is likely to work on all architectures because there's no reason not to use (at least) all the PFN bits for the swap entry, but it doesn't exactly seem correct.

Agreed, that it is a simple test but nonetheless a valid one which
makes sure that PFN value remained unchanged during pte <---> swp
conversion.

> 
> Can we start with a swp_entry_t (from __swp_entry()) and check the round trip of that?
> 
> It would also seem sensible to have a check that is_swap_pte(__swp_entry_to_pte(__swp_entry(x,y))) is true.

>From past experiences, getting any these new tests involving platform
helpers, working on all existing enabled archs is neither trivial nor
going to be quick. Existing tests here are known to succeed in enabled
platforms. Nonetheless, proposed tests as in the above suggestions do
make sense but will try to accommodate them in a later patch.

Powered by blists - more mailing lists