Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4890084rdh; Wed, 29 Nov 2023 13:51:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPd5qYtkYLsCGU1YqK7mJECe+a79PTHB6rhjoCSMpBrQZeTy88sWxriSg3lCZVYM+q184N X-Received: by 2002:a17:902:b282:b0:1cf:b190:ea09 with SMTP id u2-20020a170902b28200b001cfb190ea09mr19071063plr.42.1701294708101; Wed, 29 Nov 2023 13:51:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701294708; cv=none; d=google.com; s=arc-20160816; b=Kt51a1eVM+D/7oR4Gbg4BSLG6GGMdcFuvzGbS9QvXscJYgyM69XODiEHWuSHe0MUON qvlvNfLA0kad8uXl5Eboll9RQ3ZYXQLMhRzv+/4Hy+FScYTCB7tMyqfIkm19jS0C/XPi k0JHdrnjXaxVv/RK6mQT4sH5dC17HydRLh88atCyWrJUEpnNG14RXih/4q117FIIVdow yCDLZQOI2hkrEzuLbFvSzmN5G0MucZyulJebJpUgwC2tbuS8d9EiH6spEGHEiE0O1Phe /CaPV7Dvo5nyPRQNAoUvQ5Z76LcM4uJJ4pFqcvrM25K8ehpmDqOv+7bHAJZc++7CU7Xf nKpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QBPvuUzt3di2uIY9dcHMxTM34jNdB/H27kw5Ncf1L+I=; fh=4HVRO6f3g8DInYYG3BlLnBn0oEBT/lWvUFCM3YKQyDw=; b=O04WPylFVkNybjzQGl/69Ngt0F46o0aBOOfGOUASzpBuoX+Rp2m1SiGFPNni7JDEEc gwyrrNLy7qOTyHUCAemTFPZGwZXQBoQ3gqYEibdNdpq5gnGV8eyiPvcfN7uG/UnyEsXw ODMrW6h7w8pXJmAmyqPW8KJS1LXzejdCBy5/d2b+6GFaZyAenh8Rh7E4x7UVZXh3ttS1 z5ZeV2oEg+v5B5daZAgzBB5qrp11bMGXa18/HpPpmISX/cjo3PEqU56Uxv1wOaaAk7Fw /1LdpnSZ4RYQpEqVTFVPSKiNv89E/qeIjFF72zkRWLC7AG3+W0oPKtaYXu/nz+qbxogX wUyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fQIMu9V0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y2-20020a170902ed4200b001b3d6c68bd1si14232208plb.643.2023.11.29.13.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:51:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fQIMu9V0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CDE19802C8FF; Wed, 29 Nov 2023 13:51:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234919AbjK2Vva (ORCPT + 99 others); Wed, 29 Nov 2023 16:51:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234609AbjK2Vuy (ORCPT ); Wed, 29 Nov 2023 16:50:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A4E10D4 for ; Wed, 29 Nov 2023 13:51:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPS id BCC2EC433CC; Wed, 29 Nov 2023 21:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701294658; bh=TIgQ5CbkliqAVMldXf5Py2rYlW1ruP/xbtTpoJwKMY8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fQIMu9V0oT8xUK0GL+HsYCv1d6LOK+fR4jAaYG8Do89RGP+xAS7dBjCHFKKlCb+9C lezD6IPNQGoRz+LXbUElA8DxWqLKijC0oA3S4flAeQAILZVmC4E+4i6aR4tPWvP8Yd 199/qQn8/qv0DO4UKHiGYgs8YDavd/NKnQCC+Y5Gn4Va2T44He7/pvBvafz38/2Lca tV7UWIJ0J87nZiWdQyi5ofbpPMxWL9VL6Q3cYoxQYbUUPtnCOUgJUA6MfrTtuU2p9Z 6rQlVXJe5XKOJHHk4sx4wYcgzIilxUqryDHbNXdas4D+z9VYj3B1gMvu/MMGV72ue/ 0E41N/P3bGGeg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5D51C10DC2; Wed, 29 Nov 2023 21:50:57 +0000 (UTC) From: "Seth Forshee (DigitalOcean)" Date: Wed, 29 Nov 2023 15:50:21 -0600 Subject: [PATCH 03/16] capability: rename cpu_vfs_cap_data to vfs_caps MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231129-idmap-fscap-refactor-v1-3-da5a26058a5b@kernel.org> References: <20231129-idmap-fscap-refactor-v1-0-da5a26058a5b@kernel.org> In-Reply-To: <20231129-idmap-fscap-refactor-v1-0-da5a26058a5b@kernel.org> To: Christian Brauner , Serge Hallyn , Paul Moore , Eric Paris , James Morris , Alexander Viro , Miklos Szeredi , Amir Goldstein Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, audit@vger.kernel.org, linux-unionfs@vger.kernel.org, "Seth Forshee (DigitalOcean)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3448; i=sforshee@kernel.org; h=from:subject:message-id; bh=TIgQ5CbkliqAVMldXf5Py2rYlW1ruP/xbtTpoJwKMY8=; =?utf-8?q?b=3DowEBbQGS/pANAwAKAVMDma7l9DHJAcsmYgBlZ7I0nwuW1xpac3xkFjSxN46Ko?= =?utf-8?q?GJvViTQQr5z+iz5_Wk9fgqyJATMEAAEKAB0WIQSQnt+rKAvnETy4Hc9TA5mu5fQxy?= =?utf-8?q?QUCZWeyNAAKCRBTA5mu5fQxyaNwB/_9pyZQEBnedvrvYiYrFWuw3BEQLrhwzPeP+j?= =?utf-8?q?XU2KRZgr6vrzRbFlDtNuNLFIBATPoVujyOCLkUK7H+f_88lE3d/IbtjndsgxfUqO4?= =?utf-8?q?TK/qiimK2hWIqmPKh2moxUobyRKRFeZqZyjXt3tN73mRM6/6ip9yTWhXi_w9Tagm/?= =?utf-8?q?A2MzQBmlYG/S003GXBPgisL/bWyg0XaQMqt6pSFNEzG6a/OmHE+fIxUWKIQmNvfVn?= =?utf-8?q?XfwqH3_4xF2MKBcZI5Mi3fIVSJlEUD/7vjTTKelJa9ZqUYbjF+AL28JxwDjvHdvF0?= =?utf-8?q?VE5Rdweg/uJpBt9jyE1v?= 0o/JdYEKaL3Qh3x94fc5HOxAJ3GcBV X-Developer-Key: i=sforshee@kernel.org; a=openpgp; fpr=2ABCA7498D83E1D32D51D3B5AB4800A62DB9F73A X-Endpoint-Received: by B4 Relay for sforshee@kernel.org/default with auth_id=103 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 13:51:46 -0800 (PST) vfs_caps is a more generic name which is better suited to the broader use this struct will see in subsequent commits. Signed-off-by: Seth Forshee (DigitalOcean) --- include/linux/capability.h | 4 ++-- kernel/auditsc.c | 4 ++-- security/commoncap.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/capability.h b/include/linux/capability.h index 0c356a517991..c24477e660fc 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -24,7 +24,7 @@ extern int file_caps_enabled; typedef struct { u64 val; } kernel_cap_t; /* same as vfs_ns_cap_data but in cpu endian and always filled completely */ -struct cpu_vfs_cap_data { +struct vfs_caps { __u32 magic_etc; kuid_t rootid; kernel_cap_t permitted; @@ -211,7 +211,7 @@ static inline bool checkpoint_restore_ns_capable(struct user_namespace *ns) /* audit system wants to get cap info from files as well */ int get_vfs_caps_from_disk(struct mnt_idmap *idmap, const struct dentry *dentry, - struct cpu_vfs_cap_data *cpu_caps); + struct vfs_caps *cpu_caps); int cap_convert_nscap(struct mnt_idmap *idmap, struct dentry *dentry, const void **ivalue, size_t size); diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 6f0d6fb6523f..783d0bf69ca5 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2247,7 +2247,7 @@ void __audit_getname(struct filename *name) static inline int audit_copy_fcaps(struct audit_names *name, const struct dentry *dentry) { - struct cpu_vfs_cap_data caps; + struct vfs_caps caps; int rc; if (!dentry) @@ -2800,7 +2800,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm, { struct audit_aux_data_bprm_fcaps *ax; struct audit_context *context = audit_context(); - struct cpu_vfs_cap_data vcaps; + struct vfs_caps vcaps; ax = kmalloc(sizeof(*ax), GFP_KERNEL); if (!ax) diff --git a/security/commoncap.c b/security/commoncap.c index 8e8c630ce204..cf130d81b8b4 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -583,7 +583,7 @@ int cap_convert_nscap(struct mnt_idmap *idmap, struct dentry *dentry, * Calculate the new process capability sets from the capability sets attached * to a file. */ -static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps, +static inline int bprm_caps_from_vfs_caps(struct vfs_caps *caps, struct linux_binprm *bprm, bool *effective, bool *has_fcap) @@ -634,7 +634,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps, */ int get_vfs_caps_from_disk(struct mnt_idmap *idmap, const struct dentry *dentry, - struct cpu_vfs_cap_data *cpu_caps) + struct vfs_caps *cpu_caps) { struct inode *inode = d_backing_inode(dentry); __u32 magic_etc; @@ -645,7 +645,7 @@ int get_vfs_caps_from_disk(struct mnt_idmap *idmap, vfsuid_t rootvfsuid; struct user_namespace *fs_ns; - memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data)); + memset(cpu_caps, 0, sizeof(struct vfs_caps)); if (!inode) return -ENODATA; @@ -724,7 +724,7 @@ static int get_file_caps(struct linux_binprm *bprm, const struct file *file, bool *effective, bool *has_fcap) { int rc = 0; - struct cpu_vfs_cap_data vcaps; + struct vfs_caps vcaps; cap_clear(bprm->cred->cap_permitted); -- 2.43.0