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] [day] [month] [year] [list]
Message-Id: <20111129165720.6034bf5c.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Tue, 29 Nov 2011 16:57:20 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Cong Wang <amwang@...hat.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	Pekka Enberg <penberg@...nel.org>,
	Christoph Hellwig <hch@....de>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Hansen <dave@...ux.vnet.ibm.com>,
	Lennart Poettering <lennart@...ttering.net>,
	Kay Sievers <kay.sievers@...y.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	linux-mm@...ck.org
Subject: Re: [V4 PATCH 1/2] tmpfs: add fallocate support

On Tue, 29 Nov 2011 15:23:58 +0800
Cong Wang <amwang@...hat.com> wrote:

> 于 2011年11月29日 14:02, KAMEZAWA Hiroyuki 写道:
> >
> > You can't know whether the 'page' is allocated by alloc_page() in fallocate()
> > or just found as exiting one.
> > Then, yourwill corrupt existing pages in error path.
> > Is it allowed ?
> >
> 
> According to the comment,
> 
> /*
>   * shmem_getpage_gfp - find page in cache, or get from swap, or allocate
>   *
>   * If we allocate a new one we do not mark it dirty. That's up to the
>   * vm. If we swap it in we mark it dirty since we also free the swap
>   * entry since a page cannot live in both the swap and page cache
>   */
> 
> so we can know if the page is newly allocated by checking page dirty bit.
> Or am I missing something?
> 

If swap-in doesn't happen and  a page is found...

==
       page = find_lock_page(mapping, index); <=============== you find a page
       if (radix_tree_exceptional_entry(page)) {
                swap = radix_to_swp_entry(page);
                page = NULL;
        }

        if (sgp != SGP_WRITE &&
            ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) {
                error = -EINVAL;
                goto failed;
        }

        if (page || (sgp == SGP_READ && !swap.val)) {
                /*
                 * Once we can get the page lock, it must be uptodate:
                 * if there were an error in reading back from swap,
                 * the page would not be inserted into the filecache.
                 */
                BUG_ON(page && !PageUptodate(page));
                *pagep = page; <========================= return here.
                return 0;
        }
==
Page will not be marked as dirty.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ