From: "Serge E. Hallyn" <serge@hallyn.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: 'Alistair Delva' <adelva@google.com>,
Ondrej Mosnacek <omosnace@redhat.com>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>,
Khazhismel Kumykov <khazhy@google.com>,
Bart Van Assche <bvanassche@acm.org>,
Serge Hallyn <serge@hallyn.com>, Jens Axboe <axboe@kernel.dk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Paul Moore <paul@paul-moore.com>,
SElinux list <selinux@vger.kernel.org>,
Linux Security Module list
<linux-security-module@vger.kernel.org>,
"Cc: Android Kernel" <kernel-team@android.com>,
Linux Stable maillist <stable@vger.kernel.org>,
john.johansen@canonical.com, James Morris <jmorris@namei.org>,
Christian Brauner <christian@brauner.io>,
Tycho Andersen <tycho@tycho.ws>
Subject: Re: [PATCH] block: Check ADMIN before NICE for IOPRIO_CLASS_RT
Date: Tue, 16 Nov 2021 07:36:28 -0600 [thread overview]
Message-ID: <20211116133628.GA6728@mail.hallyn.com> (raw)
In-Reply-To: <43aeb7451621474ea0d7bee6b99039c3@AcuMS.aculab.com>
On Tue, Nov 16, 2021 at 09:30:12AM +0000, David Laight wrote:
> From: Alistair Delva
> > Sent: 15 November 2021 19:09
> ...
> > > > - if (!capable(CAP_SYS_NICE) && !capable(CAP_SYS_ADMIN))
> > > > + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))
> > > > return -EPERM;
>
> Isn't the real problem that you actually want to test:
> if (!capable(CAP_SYS_NICE | CAP_SYS_ADMIN))
> return -EPERM;
> so that you only get the fail 'splat' when neither is set.
>
> This will be true whenever more than one capability enables something.
>
> Possibly this needs something like:
> int capabale_or(unsigned int, ...);
> #define capabale_or(...) capabable_or(__VA_LIST__, ~0u)
>
> David
Right, that's what i was suggesting yesterday. We do this in other
places, where we split off a more fine-grained version of a gross
capability. If we care enough about the audit messages, then we
probably do need a new primitive.
-serge
next prev parent reply other threads:[~2021-11-16 13:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 17:38 [PATCH] block: Check ADMIN before NICE for IOPRIO_CLASS_RT Alistair Delva
2021-11-15 18:04 ` Jens Axboe
2021-11-15 18:17 ` Alistair Delva
2021-11-15 19:04 ` Ondrej Mosnacek
2021-11-15 19:08 ` Alistair Delva
2021-11-15 21:01 ` Dominick Grift
2021-11-15 21:42 ` Casey Schaufler
2021-11-16 8:21 ` Greg Kroah-Hartman
2021-11-16 9:30 ` David Laight
2021-11-16 13:36 ` Serge E. Hallyn [this message]
2021-11-15 19:31 ` Greg Kroah-Hartman
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=20211116133628.GA6728@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=David.Laight@ACULAB.COM \
--cc=adelva@google.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=christian@brauner.io \
--cc=gregkh@linuxfoundation.org \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=kernel-team@android.com \
--cc=khazhy@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tycho@tycho.ws \
/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).