Message ID | 20230116212105.1840362-1-mjguzik@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1407927wrn; Mon, 16 Jan 2023 13:25:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXtNKQ7qAdQ241ENvyFVw9iMdb+qy7ico60QwwhQH/tM0ECVIaXXcy5Rv8Pomurc6y4xSCP0 X-Received: by 2002:a17:906:1605:b0:870:2f70:c631 with SMTP id m5-20020a170906160500b008702f70c631mr594201ejd.2.1673904337340; Mon, 16 Jan 2023 13:25:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673904337; cv=none; d=google.com; s=arc-20160816; b=aj4qLGj9yWCyEEOOZuAM73QqlxLUyPJvslEqWrDXHWiRVytQe5QNdOhEMCSziUB3R4 HOXL/xUU7WwcjMxZl2Vl9WAsDIfbzZSbm+uO7YPh3DEwZss61YsKcz4wJDt4oIxZ74zC YBoHlbWIs0l3KtyinmyoOZM1KFBJNN7AYuyCpfpX25q0z62F6srxrJKc6zS5IH7bQMT8 /two+g8MZklIGPnyix2w+BBrfw1v/tD8UDOoLSdeGZGg9Dd3xkNrAkj2cFDWvtLo8IGb L200PrX9vVFfvb9ZG3awRxrdBukxtFl2t/Ce8TKSh9GM4UA/mzfZtpkraOh5Q6zfiSu/ oZtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1ZUr775SZEUdEUVQ50LyInwYmbWVTce14ME9QhXkqM8=; b=IoHFVCSgAXNUzjTvA/8Hk0ws8pK54MIFAWEV5n6hq3M/4b+IWv513vQXTkhCLFWdq4 X4o2yWN3lmbqTl2cq/c+qk9j7YZppHpJxtKDcjaTPKHqu6JKqdHB6Rzhazft5R8oIqVu EFgrUjSFexU+38ZWvCZ2q2wNEUwPRmK66UxO73Nj9nENmYQUxLE2Mo+OZURLXrNlobz1 tRnKAffChcLkyK0ECmWqDNeJLmlHPmZrg4iWUOEwEiU3QpJOQ9msE2Ws+h0uvwKqhYN6 7qYN6mBD/uSphfeTKMF/fnS7SZ8KlW9N/xQuTT+7UZ2eirmgaIpT8WpCJBkUwHNYAt5E XRNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EXi/YH/G"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402270600b0049e190b68f1si4364703edd.499.2023.01.16.13.25.12; Mon, 16 Jan 2023 13:25:37 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EXi/YH/G"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234078AbjAPVVT (ORCPT <rfc822;stefanalexe802@gmail.com> + 99 others); Mon, 16 Jan 2023 16:21:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbjAPVVQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Jan 2023 16:21:16 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDE623858; Mon, 16 Jan 2023 13:21:15 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id v6so27887374ejg.6; Mon, 16 Jan 2023 13:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1ZUr775SZEUdEUVQ50LyInwYmbWVTce14ME9QhXkqM8=; b=EXi/YH/G3S3FVDSqo2MMGTcu9D/1ESejD72sgxsRBtmzrBOrZU5zlWQmckWD2bY+jr FrCHz8y6RUp2GyS49S8LKfpMqLQKjSx25pz3bqFWCrefLFzuOWr5pbDibIyJMqLSgXFq 34SmGJHjFpHi4AA5yMRIyqIcEqTPOm2vHqx/oKv3QjWd73L22NArkdUr5YDSB7mkThtq ISyULCs8LUoeFh24UHcBgZz4D4nAdCK11Olhk68L95Qe6pYyd6QJU95MBrVSReULPPiW 44Y+HmMWRYet6UVRWy2vlhlGuJkfxZ3YTS4tl+zzjrqHmTekATEzm6QOXDWY+TfVa4V/ BW+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1ZUr775SZEUdEUVQ50LyInwYmbWVTce14ME9QhXkqM8=; b=RO7NF9eWpoxbELFNLxhcK05nbkLm6dzf7Bc0KdLRDgOScT6KRMl9fH+DSYvnP4xcb4 iG58ps4VEcZE4/e2QZILF0k2oBJml3I/60wMaq0E/Q0XKgTBMHuw05rh0/1+cY0IIL/3 Fass/r+7qmF/WblIi2jHlhwmsqzK734b6QRx7mklddbxMdJG7Cek5ktMz838Q//jOQ4l bw8hm43Slul1glyK+PrTA8qTfdnv/x4EILFOh7dByF3gXwgy+6jlNalNtcdTotqoYAEq ico0SAR9qtn53dryLTjrC0EP4zBcEWwf2Hnbrb5rkJUBW3+7zbzi0vOV14ypM0J3XyQ5 7r8g== X-Gm-Message-State: AFqh2krSzOl9rWnGTdEoMxM3xXbzbXadZiexGlHstBYpBy6gMfaXYdyX i00xuWrLRNJooIGnmW5FFVE= X-Received: by 2002:a17:907:2bdf:b0:86e:38ae:8713 with SMTP id gv31-20020a1709072bdf00b0086e38ae8713mr431733ejc.51.1673904074355; Mon, 16 Jan 2023 13:21:14 -0800 (PST) Received: from f.. (cst-prg-72-175.cust.vodafone.cz. [46.135.72.175]) by smtp.gmail.com with ESMTPSA id q18-20020a17090676d200b00857c2c29553sm7961721ejn.197.2023.01.16.13.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 13:21:13 -0800 (PST) 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 Message-Id: <20230116212105.1840362-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755215914032177842?= X-GMAIL-MSGID: =?utf-8?q?1755215914032177842?= |
Series |
[v2,1/2] capability: add cap_isidentical
|
|
Commit Message
Mateusz Guzik
Jan. 16, 2023, 9:21 p.m. UTC
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"