[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230125155557.37816-1-mjguzik@gmail.com>
Date: Wed, 25 Jan 2023 16:55:56 +0100
From: Mateusz Guzik <mjguzik@...il.com>
To: viro@...iv.linux.org.uk
Cc: serge@...lyn.com, torvalds@...ux-foundation.org,
paul@...l-moore.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Mateusz Guzik <mjguzik@...il.com>
Subject: [PATCH v3 1/2] capability: add cap_isidentical
Signed-off-by: Mateusz Guzik <mjguzik@...il.com>
Reviewed-by: Serge Hallyn <serge@...lyn.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.39.0
Powered by blists - more mailing lists