From: Jens Axboe <axboe@kernel.dk>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, audit@vger.kernel.org,
io-uring@vger.kernel.org
Subject: Re: [RFC] struct filename, io_uring and audit troubles
Date: Tue, 24 Sep 2024 05:15:13 -0600 [thread overview]
Message-ID: <fb2d2ec3-f0c6-4116-a574-eef8f79afee4@kernel.dk> (raw)
In-Reply-To: <20240923150745.GB3550746@ZenIV>
On 9/23/24 9:07 AM, Al Viro wrote:
> On Mon, Sep 23, 2024 at 12:30:48AM -0600, Jens Axboe wrote:
>
>> 1) Just don't reuse the entry. Then we can drop the struct
>> filename->aname completely as well. Yes that might incur an extra
>> alloc for the odd case of audit_enabled and being deep enough that
>> the preallocated names have been used, but doesn't anyone really
>> care? It'll be noise in the overhead anyway. Side note - that would
>> unalign struct filename again. Would be nice to drop audit_names from
>> a core fs struct...
>
> You'll get different output in logs, though. Whether that breaks userland
> setups/invalidates certifications/etc.... fuck knows.
No idea about that... But I'd say without strong evidence that this
breaks userland for something as odd as audit, well... And honestly
really a layering problem that struct filename has an audit link in
there.
> If anything, a loop through the list, searching for matching entry would
> be safer in that respect. Order of the items... might or might not be
> an issue - see above.
>
>> 2) Add a ref to struct audit_names, RCU kfree it when it drops to zero.
>> This would mean dropping struct audit_context->preallocated_names, as
>
> Costly, that.
For sure. And you could keep preallocated_names if you rcu free the
context too. But I strongly believe that approach #1 is, by far, the
cheaper alternative. If we can tolerate the ordering potentially
changing.
>> otherwise we'd run into trouble there if a context gets blown away
>> while someone else has a ref to that audit_names struct. We could do
>> this without a ref as well, as long as we can store an audit_context
>> pointer in struct audit_names and be able to validate it under RCU.
>> If ctx doesn't match, don't use it.
>
> That's one of the variants I mentioned upthread...
Sorry, still away on travels and conferences, so haven't been keeping up
on replies.
--
Jens Axboe
prev parent reply other threads:[~2024-09-24 11:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 0:49 [RFC] struct filename, io_uring and audit troubles Al Viro
2024-09-22 4:10 ` Al Viro
2024-09-22 15:09 ` Al Viro
2024-09-23 1:50 ` Al Viro
2024-09-23 6:30 ` Jens Axboe
2024-09-23 12:54 ` Paul Moore
2024-09-23 14:48 ` Al Viro
2024-09-23 16:14 ` Paul Moore
2024-09-23 18:17 ` Al Viro
2024-09-23 23:49 ` Paul Moore
2024-09-23 20:36 ` Al Viro
2024-09-24 0:11 ` Paul Moore
2024-09-24 7:01 ` Al Viro
2024-09-24 23:17 ` Paul Moore
2024-09-25 20:44 ` Al Viro
2024-09-25 20:58 ` Paul Moore
2024-09-24 21:40 ` Al Viro
2024-09-25 6:01 ` Jens Axboe
2024-09-25 17:39 ` Al Viro
2024-09-25 17:58 ` Jens Axboe
2024-09-26 3:56 ` Al Viro
2024-09-23 15:07 ` Al Viro
2024-09-24 11:15 ` Jens Axboe [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=fb2d2ec3-f0c6-4116-a574-eef8f79afee4@kernel.dk \
--to=axboe@kernel.dk \
--cc=audit@vger.kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).