Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp979575rwb; Sat, 14 Jan 2023 11:48:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXsy5Sv+dTXtkgQWGAdPfCCMI02+0M6tJlmBIgrY+0mPvUfLGLS5S0QIRH6U9PBP8hXe3Wqs X-Received: by 2002:a17:90a:ac12:b0:226:ca91:3979 with SMTP id o18-20020a17090aac1200b00226ca913979mr15082434pjq.26.1673725681448; Sat, 14 Jan 2023 11:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673725681; cv=none; d=google.com; s=arc-20160816; b=F6cJIgsFnCoR4vD/ynR2taT1gHYTc0v7JkFFE6gk3nLUQrE10aF4VnZgDuPeCIHqHf +66UwIFGm2+YNYiYMOQsUijxMaBQG8iznwnBB6pet2WYH0uIC+niPCUkXBB+KtiQHbms kK+PaOKjyG2SfESnsAuJi3o9wvc0sHz5r+AYcPsZixUIiNkW8thiQxUce82Bgs4de5HR GDuFJTZahlFd4DMJUu127a834sIF/tPfadzbngcNMKMCnso22TYaC6oyB2IKjrtJe9ty qVzskWJQ0rGx8bRpgZEE0G72gADzGDK95kt8ea95JOMOWEeiRfYdIDSY+jdkJP1o9m6J CXuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=yIPV9lwt8EVepPj6rMYIAi2SvCBynJ8LmuPoE+97tcg=; b=B9Z1wl9cSx7JWlMeZzTKgxE/7Mld26ArcDihffu0qvMSbhQaGusFk72ivVoKZASA4P P4BMAgqVOd6GVIiQbAW21gJ2G2kcHwtHC3ZzQG3UH0GJFFW4liU1GqVUHM+XpiApr+0S KawbjhyOUO+gaNMdrkiuOJGIEw4FRx8NH/UjLn2dBG5SBk0Qw1k2Qx3G4QE9Wnpmweqn 8FWb50W8ovTlpXwtdqyNknTxvQPl/e68GeKS/E7EhST/NkEe7dCRRbf53uN0xjNYOw4Q cOE0o/QEozEBXyPR6GGWHvDLfV8nlmbtR93gKyhwV5ITGE7J5DDNLxC/FYydwVDDHEYE tm3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf2-20020a17090b1d8200b00223b92028c1si25694290pjb.190.2023.01.14.11.47.54; Sat, 14 Jan 2023 11:48:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjANTdI (ORCPT + 54 others); Sat, 14 Jan 2023 14:33:08 -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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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