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: <CALLzPKYNGbksuMNKPBr-G-YVW8by3QQfx1rudf8pwqMxs=fotA@mail.gmail.com>
Date:	Thu, 22 Dec 2011 12:29:49 +0200
From:	"Kasatkin, Dmitry" <dmitry.kasatkin@...el.com>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	linux-fsdevel@...r.kernel.org,
	linux-security-module@...r.kernel.org, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, zohar@...ux.vnet.ibm.com
Subject: Re: [PATCH v2 0/2] vfs: truncate bug fixes

On Thu, Dec 22, 2011 at 11:10 AM, Al Viro <viro@...iv.linux.org.uk> wrote:
> On Thu, Dec 22, 2011 at 10:55:24AM +0200, Dmitry Kasatkin wrote:
>> When a file is opened with O_TRUNC or truncated with truncate()/ftruncate(),
>> and then closed, iversion is not updated. This patch uses ATTR_OPEN flag,
>> which is currently used to identify files opened with O_TRUNC,
>> as an indication to increment iversion.
>> Also it adds passing of this flag from do_sys_truncate and do_sys_ftruncate.
>> To reflect real meaning, ATTR_OPEN is suggested to be renamed to ATTR_TRUNC.
>
> Um...  Is there any difference left between that and ATTR_SIZE, then?

Oops. Indeed. It becomes simpler..

Comments and using ATTR_OPEN in fs/fuse/dir.c confused me.

update_mtime()
{
	/* If it's an open(O_TRUNC) or an ftruncate(), don't update */
	if ((ivalid & ATTR_SIZE) && (ivalid & (ATTR_OPEN | ATTR_FILE)))
}

do_sys_truncate() calls do_truncate(path.dentry, length, 0, NULL);
while do_sys_ftruncate calls do_truncate(dentry, length,
ATTR_MTIME|ATTR_CTIME, file);

Notice the last file parameter... NULL or file..

As truncate and ftruncate syscalls should do the same job as fstat or stat.
It will lead to different results for FUSE.
Following will be 0: (ivalid & (ATTR_OPEN | ATTR_FILE)

FUSE comments says.. OR
/* If it's an open(O_TRUNC) or an ftruncate(), don't update */

Will make new version..

- Dmitry
--
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