From: David Laight <David.Laight@ACULAB.COM>
To: 'Alistair Delva' <adelva@google.com>,
Ondrej Mosnacek <omosnace@redhat.com>
Cc: 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>
Subject: RE: [PATCH] block: Check ADMIN before NICE for IOPRIO_CLASS_RT
Date: Tue, 16 Nov 2021 09:30:12 +0000 [thread overview]
Message-ID: <43aeb7451621474ea0d7bee6b99039c3@AcuMS.aculab.com> (raw)
In-Reply-To: <CANDihLEFZAz8DwkkMGiDJnDMjxiUuSCanYsJtkRwa9RoyruLFA@mail.gmail.com>
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
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-11-16 9:30 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 [this message]
2021-11-16 13:36 ` Serge E. Hallyn
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=43aeb7451621474ea0d7bee6b99039c3@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=adelva@google.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=gregkh@linuxfoundation.org \
--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=serge@hallyn.com \
--cc=stable@vger.kernel.org \
/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).