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]
Date:	Mon, 15 Mar 2010 18:47:02 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	Trond Myklebust <trond.myklebust@....uio.no>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-nfs@...r.kernel.org
Subject: Re: [PATCH] vfs: pass struct file to do_truncate on O_TRUNC opens

On Mon, 15 Mar 2010 18:31:28 -0400
Trond Myklebust <trond.myklebust@....uio.no> wrote:

> On Mon, 2010-03-15 at 17:39 -0400, Jeff Layton wrote: 
> > When a file is opened with O_TRUNC, the truncate processing is handled
> > by handle_truncate(). This function however doesn't receive any info
> > about the newly instantiated filp, and therefore can't pass that info
> > along so that the setattr can use it.
> > 
> > This makes NFSv4 misbehave. The client does an open and gets a valid
> > stateid, and then doesn't use that stateid on the subsequent truncate.
> > It uses the zero-stateid instead. Most servers ignore this fact and
> > just do the truncate anyway, but some don't like it (notably, RHEL4).
> > 
> > It seems more correct that since we have a fully instantiated file at
> > the time that handle_truncate is called, that we pass that along so
> > that the truncate operation can properly use it.
> 
> At least in the O_CREAT|O_TRUNC case, we really should modify
> nfs4_opendata_alloc() to set the attrs.ia_size to zero, so that the
> server does an atomic open(O_CREAT|O_TRUNC) for us (see the DESCRIPTION
> paragraph in RFC3530 section 14.2.16). There shouldn't be any need for
> an extra truncate RPC call.
> 
> Plain open(O_TRUNC) probably does need something along the lines of what
> you propose, however.
> 

Yeah that would be cleaner on the wire for the create case. It's not
clear to me how to implement that though. There doesn't appear to be
a straightforward way to tell the VFS to skip the truncate.

-- 
Jeff Layton <jlayton@...hat.com>
--
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