From: Mateusz Guzik <mjguzik@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: serge@hallyn.com, torvalds@linux-foundation.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH v2 1/2] capability: add cap_isidentical
Date: Mon, 16 Jan 2023 22:21:04 +0100 [thread overview]
Message-ID: <20230116212105.1840362-1-mjguzik@gmail.com> (raw)
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
---
include/linux/capability.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 65efb74c3585..736a973c677a 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -156,6 +156,16 @@ static inline bool cap_isclear(const kernel_cap_t a)
return true;
}
+static inline bool cap_isidentical(const kernel_cap_t a, const kernel_cap_t b)
+{
+ unsigned __capi;
+ CAP_FOR_EACH_U32(__capi) {
+ if (a.cap[__capi] != b.cap[__capi])
+ return false;
+ }
+ return true;
+}
+
/*
* Check if "a" is a subset of "set".
* return true if ALL of the capabilities in "a" are also in "set"
--
2.34.1
next reply other threads:[~2023-01-16 21:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 21:21 Mateusz Guzik [this message]
2023-01-16 21:21 ` [PATCH v2 2/2] vfs: avoid duplicating creds in faccessat if possible Mateusz Guzik
2023-01-20 20:45 ` Paul Moore
2023-01-21 0:50 ` Mateusz Guzik
2023-01-21 1:18 ` Mateusz Guzik
2023-01-23 21:29 ` Paul Moore
2023-01-24 10:16 ` Mateusz Guzik
2023-01-24 17:00 ` Paul Moore
2023-01-24 17:14 ` Linus Torvalds
2023-01-24 18:42 ` Mateusz Guzik
2023-01-24 20:37 ` Linus Torvalds
2023-01-24 21:33 ` Paul Moore
2023-01-25 15:00 ` Mateusz Guzik
2023-01-25 16:17 ` Mateusz Guzik
2023-01-25 17:11 ` Paul Moore
2023-01-25 17:07 ` 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=20230116212105.1840362-1-mjguzik@gmail.com \
--to=mjguzik@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=torvalds@linux-foundation.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).