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: <267812a3-6576-33ce-4d41-054f6ecb812d@redhat.com>
Date:   Mon, 13 Mar 2023 17:04:27 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc:     yang.yang29@....com.cn, akpm@...ux-foundation.org,
        jiang.xuexin@....com.cn, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, ran.xiaokai@....com.cn, xu.xin.sc@...il.com,
        xu.xin16@....com.cn, Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH v6 0/6] ksm: support tracking KSM-placed zero-pages

>> If we'd really want to identify whether a zeropage was deduplciated by
>> KSM, we could try storing that information inside the PTE instead of
> 
> this is interesting, but needs caution, for the reason you mention below
> 
>> inside the RMAP. Then, we could directly adjust the counter when zapping
>> the shared zeropage or during MADV_DONTNEED/when unmerging.
>>
>> Eventually, we could simply say that
>> * !pte_dirty(): zeropage placed during fault
>> * pte_dirty(): zeropage placed by KSM
>>
>> Then it would also be easy to adjust counters and unmerge. We'd limit
>> this handling to known-working architectures initially (spec64 still has

^ I meant sparc64 here. We can (and should) have a testcase that 
deduplicates the shared zeropage using KSM and makes sure that writes 
properly lead to a write fault.

>> the issue that pte_mkdirty() will set a pte writable ... and my patch to
>> fix that was not merged yet). We'd have to double-check all
>> pte_mkdirty/pte_mkclean() callsites.
> 
> this will be... interesting

IIRC, most code that touches the dirty bit makes sure that it operates 
on a proper struct page (via vm_normal_folio()). 
madvise_free_pte_range() is one such user. But we have to double-check.

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ