From: Mimi Zohar <zohar@linux.ibm.com>
To: Ignaz Forster <ignaz.forster@gmx.de>,
zohar@linux.vnet.ibm.com, linux-integrity@vger.kernel.org,
Al Viro <viro@ZenIV.linux.org.uk>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>, Fabian Vogt <fvogt@suse.de>
Subject: Re: Bug: Persisting O_TMPFILE with IMA
Date: Sun, 16 Dec 2018 09:36:19 -0500 [thread overview]
Message-ID: <1544970979.4541.10.camel@linux.ibm.com> (raw)
In-Reply-To: <8dd90198-00ef-a43f-194b-9c4dcfc2227a@gmx.de>
On Sat, 2018-12-15 at 12:07 +0100, Ignaz Forster wrote:
> Mimi Zohar schrieb am 14.12.2018 um 20:01 Uhr:
> > On Fri, 2018-12-14 at 19:11 +0100, Ignaz Forster wrote:
> >> Hello,
> >>
> >> persisting files opened with O_TMPFILE doesn't seem to work on IMA as
> >> expected: The IMA xattr won't be written. This makes it impossible to
> >> access the file later.
> >> The following example application, based on the O_TMPFILE example from
> >> man 2 open
> >> will demonstrate this:
> >>
> >>
> >> #include <fcntl.h>
> >> #include <unistd.h>
> >> #include <linux/limits.h>
> >> #include <stdio.h>
> >>
> >> int main(int argc, char *argv[]) {
> >> char path[PATH_MAX];
> >> int fd = open("/tmp", __O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
> >> write(fd, "test", 4);
> >> snprintf(path, PATH_MAX, "/proc/self/fd/%d", fd);
> >> linkat(AT_FDCWD, path, AT_FDCWD, "/tmp/tmpfile_persisted.txt",
> >> AT_SYMLINK_FOLLOW);
> >> }
> >>
> >>
> >> (/tmp should not be a tmpfs of course; change to paths to a supported
> >> file system if necessary.)
[ snip ]
There is indeed a missing call to ima_file_check() in do_tmpfile(),
but it requires FMODE_CREATED to be set. Al, is there a reason that
FMODE_CREATED is not set?
Mimi
prev parent reply other threads:[~2018-12-16 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 18:11 Bug: Persisting O_TMPFILE with IMA Ignaz Forster
2018-12-14 19:01 ` Mimi Zohar
2018-12-15 11:07 ` Ignaz Forster
2018-12-16 14:36 ` Mimi Zohar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1544970979.4541.10.camel@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=fvogt@suse.de \
--cc=ignaz.forster@gmx.de \
--cc=linux-integrity@vger.kernel.org \
--cc=rgoldwyn@suse.com \
--cc=viro@ZenIV.linux.org.uk \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).