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: <20171011164649.GA21978@ZenIV.linux.org.uk>
Date:   Wed, 11 Oct 2017 17:46:49 +0100
From:   Al Viro <viro@...IV.linux.org.uk>
To:     "Levin, Alexander (Sasha Levin)" <alexander.levin@...izon.com>
Cc:     "ericvh@...il.com" <ericvh@...il.com>,
        "rminnich@...dia.gov" <rminnich@...dia.gov>,
        "lucho@...kov.net" <lucho@...kov.net>,
        "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
        "v9fs-developer@...ts.sourceforge.net" 
        <v9fs-developer@...ts.sourceforge.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "jack@...e.com" <jack@...e.com>
Subject: Re: [PATCH] 9p: set page uptodate when required in write_end()

On Wed, Oct 11, 2017 at 12:27:43PM +0000, Levin, Alexander (Sasha Levin) wrote:
> >> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> >> index adaf6f6..e1cbdfd 100644
> >> --- a/fs/9p/vfs_addr.c
> >> +++ b/fs/9p/vfs_addr.c
> >> @@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
> >>
> >>  	p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
> >>
> >> -	if (unlikely(copied < len && !PageUptodate(page))) {
> >> -		copied = 0;
> >> -		goto out;
> >> +	if (!PageUptodate(page)) {
> >> +		if (unlikely(copied < len)) {
> >> +			copied = 0;
> >> +			goto out;
> >> +		} else if (len == PAGE_SIZE) {
> >> +			SetPageUptodate(page);
> >> +		}

Umm...  I'm not sure I like it in that form.  Look: to get here
we need to successfully pass through ->write_begin().  Which
means that we either have returned with PageUptodate(page) or
had hit len == PAGE_SIZE && !PageUptodate(page).  Case of
non-uptodate with len < PAGE_SIZE is handled by forcing readpage
and repeating the entire thing.

So the only way to get !PageUptodate(page) in ->write_end() is
to have had len == PAGE_SIZE.  It needs a comment, at the very
least.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ