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: <ZUzoAhpkrCNz9l1k@casper.infradead.org>
Date:   Thu, 9 Nov 2023 14:09:06 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Jeff Xie <jeff.xie@...ux.dev>
Cc:     akpm@...ux-foundation.org, iamjoonsoo.kim@....com, vbabka@...e.cz,
        cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
        roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        chensong_2000@....cn, xiehuan09@...il.com
Subject: Re: [RFC][PATCH 3/4] filemap: implement filemap allocate post
 callback for page_owner

On Thu, Nov 09, 2023 at 11:25:20AM +0800, Jeff Xie wrote:
> +static int filemap_alloc_post_page_owner(struct folio *folio, struct task_struct *tsk,
> +			void *data, char *kbuf, size_t count)
> +{
> +	int ret;
> +	int mapcount;
> +	dev_t s_dev;
> +	struct inode *inode;
> +	struct vm_area_struct *vma;
> +	struct mm_struct *mm;
> +	unsigned long virtual_start = 0x0;
> +	unsigned long virtual_end = 0x0;
> +	struct address_space *mapping = data;

This is just folio->mapping.

> +	mapcount = folio_mapcount(folio);
> +	if (mapcount && tsk && tsk->mm) {
> +		mm = tsk->mm;
> +		VMA_ITERATOR(vmi, mm, 0);
> +		mmap_read_lock(mm);
> +		for_each_vma(vmi, vma) {
> +			if (page_mapped_in_vma(&folio->page, vma)) {
> +				virtual_start = vma_address(&folio->page, vma);
> +				virtual_end = virtual_start + folio_nr_pages(folio) * PAGE_SIZE;
> +				break;
> +			}
> +		}
> +		mmap_read_unlock(mm);
> +	}

Why not just walk the rmap directly to find out where it's mapped in
any process instead of the one which allocated it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ