From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C237C46467 for ; Sat, 14 Jan 2023 19:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbjANTdH (ORCPT ); Sat, 14 Jan 2023 14:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbjANTdH (ORCPT ); Sat, 14 Jan 2023 14:33:07 -0500 Received: from mail.hallyn.com (mail.hallyn.com [178.63.66.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9034F93D6; Sat, 14 Jan 2023 11:33:04 -0800 (PST) Received: by mail.hallyn.com (Postfix, from userid 1001) id D47A510A2; Sat, 14 Jan 2023 13:33:02 -0600 (CST) Date: Sat, 14 Jan 2023 13:33:02 -0600 From: "Serge E. Hallyn" To: Mateusz Guzik Cc: viro@zeniv.linux.org.uk, serge@hallyn.com, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/2] capability: add cap_isidentical Message-ID: <20230114193302.GB23094@mail.hallyn.com> References: <20230114180224.1777699-1-mjguzik@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230114180224.1777699-1-mjguzik@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: On Sat, Jan 14, 2023 at 07:02:23PM +0100, Mateusz Guzik wrote: > Signed-off-by: Mateusz Guzik Reviewed-by: Serge Hallyn > --- > 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