public inbox for [email protected]
 help / color / mirror / Atom feed
From: Paul Moore <[email protected]>
To: Richard Guy Briggs <[email protected]>
Cc: Linux-Audit Mailing List <[email protected]>,
	LKML <[email protected]>,
	[email protected], Eric Paris <[email protected]>,
	Steve Grubb <[email protected]>, Stefan Roesch <[email protected]>,
	Christian Brauner <[email protected]>,
	Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>
Subject: Re: [PATCH v1 1/2] io_uring,audit: audit IORING_OP_FADVISE but not IORING_OP_MADVISE
Date: Fri, 27 Jan 2023 18:05:48 -0500	[thread overview]
Message-ID: <CAHC9VhS_xpiiiweR_mtKzNanDx_m9tkvhN5dy7FuQm-tuMK6iA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>

On Fri, Jan 27, 2023 at 5:55 PM Richard Guy Briggs <[email protected]> wrote:
> On 2023-01-27 17:35, Paul Moore wrote:
> > On Fri, Jan 27, 2023 at 12:24 PM Richard Guy Briggs <[email protected]> wrote:
> > >
> > > Since FADVISE can truncate files and MADVISE operates on memory, reverse
> > > the audit_skip tags.
> > >
> > > Fixes: 5bd2182d58e9 ("audit,io_uring,io-wq: add some basic audit support to io_uring")
> > > Signed-off-by: Richard Guy Briggs <[email protected]>
> > > ---
> > >  io_uring/opdef.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/io_uring/opdef.c b/io_uring/opdef.c
> > > index 3aa0d65c50e3..a2bf53b4a38a 100644
> > > --- a/io_uring/opdef.c
> > > +++ b/io_uring/opdef.c
> > > @@ -306,12 +306,12 @@ const struct io_op_def io_op_defs[] = {
> > >         },
> > >         [IORING_OP_FADVISE] = {
> > >                 .needs_file             = 1,
> > > -               .audit_skip             = 1,
> > >                 .name                   = "FADVISE",
> > >                 .prep                   = io_fadvise_prep,
> > >                 .issue                  = io_fadvise,
> > >         },
> >
> > I've never used posix_fadvise() or the associated fadvise64*()
> > syscalls, but from quickly reading the manpages and the
> > generic_fadvise() function in the kernel I'm missing where the fadvise
> > family of functions could be used to truncate a file, can you show me
> > where this happens?  The closest I can see is the manipulation of the
> > page cache, but that shouldn't actually modify the file ... right?
>
> I don't know.  I was going on the advice of Steve Grubb.  I'm looking
> for feedback, validation, correction, here.

Keep in mind it's your name on the patch, not Steve's, and I would
hope that you should be able to stand up and vouch for your own patch.
Something to keep in mind for the future.

As it stands, I think the audit_skip line should stay for
IORING_OP_FADVISE, if you feel otherwise please provide more
explanation as to why auditing is necessary for this operation.

> > >         [IORING_OP_MADVISE] = {
> > > +               .audit_skip             = 1,
> > >                 .name                   = "MADVISE",
> > >                 .prep                   = io_madvise_prep,
> > >                 .issue                  = io_madvise,
> >
> > I *think* this should be okay, what testing/verification have you done
> > on this?  One of the things I like to check is to see if any LSMs
> > might perform an access check and/or generate an audit record on an
> > operation, if there is a case where that could happen we should setup
> > audit properly.  I did a very quick check of do_madvise() and nothing
> > jumped out at me, but I would be interested in knowing what testing or
> > verification you did here.
>
> No testing other than build/boot/audit-testsuite.  You had a test you
> had developed that went through several iterations?

There is an io_uring test in the audit-testsuite that verifies basic
audit record generation, it is not exhaustive.

Patch 2/2 is a no-go from a security perspective (we want to see those
records), and I think skipping on IORING_OP_FADVISE is the correct
thing to do.  It may be that skipping on IORING_OP_MADVISE is the
correct thing, but given that it doesn't appear a lot of in-depth
investigation has gone into these patches I would really like to see
some more reasoning on this before we change the current behavior.

-- 
paul-moore.com

  reply	other threads:[~2023-01-27 23:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 17:23 [PATCH v1 0/2] two suggested iouring op audit updates Richard Guy Briggs
2023-01-27 17:23 ` [PATCH v1 1/2] io_uring,audit: audit IORING_OP_FADVISE but not IORING_OP_MADVISE Richard Guy Briggs
2023-01-27 22:35   ` Paul Moore
2023-01-27 22:45     ` Jens Axboe
2023-01-27 22:57       ` Paul Moore
2023-01-28 16:48         ` Steve Grubb
2023-01-27 23:02       ` Richard Guy Briggs
2023-01-27 23:03         ` Jens Axboe
2023-01-27 23:08           ` Richard Guy Briggs
2023-01-27 22:55     ` Richard Guy Briggs
2023-01-27 23:05       ` Paul Moore [this message]
2023-01-27 17:23 ` [PATCH v1 2/2] io_uring,audit: do not log IORING_OP_*GETXATTR Richard Guy Briggs
2023-01-27 22:43   ` Paul Moore
2023-01-27 23:01     ` Richard Guy Briggs
2023-01-27 23:05       ` Jens Axboe
2023-01-28  0:07         ` Paul Moore
2023-01-28  0:06       ` Paul Moore
2023-01-28  0:19         ` Richard Guy Briggs
2023-01-28 17:26     ` Steve Grubb
2023-01-29 23:37       ` Paul Moore
2023-01-27 17:40 ` [PATCH v1 0/2] two suggested iouring op audit updates Jens Axboe
2023-01-27 19:42   ` Paul Moore
2023-01-27 19:43     ` Jens Axboe
2023-01-27 22:38       ` Paul Moore
2023-01-27 22:46         ` Jens Axboe
2023-01-27 22:53           ` Paul Moore
2023-01-27 23:02             ` Jens Axboe
2023-01-27 23:07               ` Richard Guy Briggs
2023-01-27 23:08               ` Paul Moore
2023-01-27 23:10                 ` Jens Axboe
2023-01-28 16:47             ` Steve Grubb
2023-01-28 17:03               ` Paul Moore

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=CAHC9VhS_xpiiiweR_mtKzNanDx_m9tkvhN5dy7FuQm-tuMK6iA@mail.gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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