Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Dec 2024 13:12:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 283179] Support O_TMPFILE in open()
Message-ID:  <bug-283179-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283179

            Bug ID: 283179
           Summary: Support O_TMPFILE in open()
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: vini.ipsmaker@gmail.com

Linux supports the creation of unlinked inodes (unnamed temporary regular
files) that can later be linked in the filesystem with linkat():
https://www.mankier.com/2/open#Description-O_TMPFILE

> Create an unnamed temporary regular file. The pathname argument specifies=
 a directory; an unnamed inode will be created in that directory's filesyst=
em. Anything written to the resulting file will be lost when the last file =
descriptor is closed, unless the file is given a name.

I believe OpenZFS already supports this feature given the history of fixed =
bug
reports such as <https://github.com/openzfs/zfs/issues/14301>.

Could FreeBSD just expose this feature already supported by OpenZFS?

The main use cases:

> * Improved tmpfile(3) functionality: race-free creation of temporary file=
s that (1) are automatically deleted when closed; (2) can never be reached =
via any pathname; (3) are not subject to symlink attacks; and (4) do not re=
quire the caller to devise unique names.
>
> * Creating a file that is initially invisible, which is then populated wi=
th data and adjusted to have appropriate filesystem attributes (fchown(2), =
fchmod(2), fsetxattr(2), etc.) before being atomically linked into the file=
system in a fully formed state (using linkat(2) as described above).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-283179-227>