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:   Tue, 25 Sep 2018 18:46:13 -0400
From:   "Theodore Y. Ts'o" <tytso@....edu>
To:     Adam Borowski <kilobyte@...band.pl>
Cc:     Jeff Layton <jlayton@...hat.com>,
        Alan Cox <gnomes@...rguk.ukuu.org.uk>,
        焦晓冬 <milestonejxd@...il.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rogier Wolff <R.E.Wolff@...Wizard.nl>
Subject: Re: POSIX violation by writeback error

On Tue, Sep 25, 2018 at 07:35:11PM +0200, Adam Borowski wrote:
> Isn't this what the snippet for O_TMPFILE in "man 2 open" does?:
> 
>                   char path[PATH_MAX];
>                   fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
>                                           S_IRUSR | S_IWUSR);
> 
>                   /* File I/O on 'fd'... */
> 
>                   snprintf(path, PATH_MAX,  "/proc/self/fd/%d", fd);
>                   linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file",
>                                           AT_SYMLINK_FOLLOW);

Huh.  I stand corrected.  I had assumed O_TMPFILE worked like any
other file where the link count was zero, and linkat(2) wouldn't allow
this.  But obviously, this does work.  In fact, from the linkat(2) man
page, using:

	linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);

is an even simpler way that doesn't /proc being mounted.

TIL...

					- Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ