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: <73b5d7c2-783d-3d75-2c1b-4b91a039df94@huawei.com>
Date:   Mon, 17 Jul 2023 10:28:50 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     <akpm@...ux-foundation.org>, <hannes@...xchg.org>,
        <mhocko@...nel.org>, <roman.gushchin@...ux.dev>,
        <shakeelb@...gle.com>, <muchun.song@...ux.dev>,
        <linux-mm@...ck.org>, <cgroups@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/memcg: use get_page() for device private pages in
 mc_handle_swap_pte()

On 2023/7/15 11:56, Matthew Wilcox wrote:
> On Sat, Jul 15, 2023 at 11:28:02AM +0800, Miaohe Lin wrote:
>> When page table locked is held, the page can't be freed from under us.
> 
> But the page isn't mapped into the page table ... there's a swap entry
> in the page table, so I don't think your logic holds.
> 

IIUC, device_private_entry will hold one page refcnt when it's set to page table.
And there's similar code in do_swap_page():

  vm_fault_t do_swap_page(struct vm_fault *vmf)
    if (unlikely(non_swap_entry(entry))) {
      if (is_device_private_entry(entry))
        /*
         * Get a page reference while we know the page can't be
         * freed.
         */
        get_page(vmf->page);
        pte_unmap_unlock(vmf->pte, vmf->ptl);
        ret = vmf->page->pgmap->ops->migrate_to_ram(vmf);
        put_page(vmf->page);
    ...

If my logic doesn't hold, do_swap_page() will need to fix the code. Or am I miss something?

Thanks Matthew.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ