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 A51C4C433EF for ; Tue, 7 Dec 2021 20:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241408AbhLGU0a (ORCPT ); Tue, 7 Dec 2021 15:26:30 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33930 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241411AbhLGU0J (ORCPT ); Tue, 7 Dec 2021 15:26:09 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B7Jbf89022854; Tue, 7 Dec 2021 20:22:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=FqNzzuC1dwXGRpxrO+fk2Rm5QrQQgrwRT70uZxloxD8=; b=Q19LQsd4f299222xUKhYY4IqR0D5r1HBwWiQBrSUrSRsFTNXVFMi2TVetUawNzVrYATC Mao1km1A+ms25kL6PuOXI5yraSjPZcZ1XQzaysrZJnxmB/F5ZnL261EVsGOBZy9v1XC3 yEfvPQ1tUFQOunmpkxfwqrHBkBfvPynt/UVdXfvG5XlSBhh0ChR/J7s/rnk8ryVgFkcj xyUuZuXoYbWf75C4F1a7pKJLJfS3pvpnrHXHIxVhLcDUttCPXT8wKJVAy2VbbBzaCsWx RHfyAjwhc4NkTS0hhlu8IxrwXMMkttYOk1SBRBQCB/5uzKGKMWGgrE+UlEu59hVfsj9j og== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ctajxnst8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Dec 2021 20:22:28 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1B7KIMr3018927; Tue, 7 Dec 2021 20:22:27 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ctajxnsss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Dec 2021 20:22:27 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1B7K8MNt014428; Tue, 7 Dec 2021 20:22:26 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03wdc.us.ibm.com with ESMTP id 3cqyy7v23j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Dec 2021 20:22:26 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1B7KMO9C62521698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Dec 2021 20:22:24 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7ACC136066; Tue, 7 Dec 2021 20:22:24 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B8A113605D; Tue, 7 Dec 2021 20:22:22 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 7 Dec 2021 20:22:22 +0000 (GMT) From: Stefan Berger To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, serge@hallyn.com, christian.brauner@ubuntu.com, containers@lists.linux.dev, dmitry.kasatkin@gmail.com, ebiederm@xmission.com, krzysztof.struczynski@huawei.com, roberto.sassu@huawei.com, mpeters@redhat.com, lhinds@redhat.com, lsturman@redhat.com, puiterwi@redhat.com, jejb@linux.ibm.com, jamjoom@us.ibm.com, linux-kernel@vger.kernel.org, paul@paul-moore.com, rgb@redhat.com, linux-security-module@vger.kernel.org, jmorris@namei.org, Stefan Berger , James Bottomley Subject: [PATCH v4 12/16] securityfs: Extend securityfs with namespacing support Date: Tue, 7 Dec 2021 15:21:23 -0500 Message-Id: <20211207202127.1508689-13-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211207202127.1508689-1-stefanb@linux.ibm.com> References: <20211207202127.1508689-1-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: iXGjT_TgW3PxKyY_LRsiXAp7CDicn4pM X-Proofpoint-GUID: qglhpMa3UFMiv6gHKXBb7UdGlIJ3Vojo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-07_08,2021-12-06_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112070122 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend 'securityfs' for support of IMA namespacing so that each IMA (user) namespace can have its own front-end for showing the currently active policy, the measurement list, number of violations and so on. Signed-off-by: Stefan Berger Signed-off-by: James Bottomley --- security/inode.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/security/inode.c b/security/inode.c index 1a720b2c566d..121ac1874dde 100644 --- a/security/inode.c +++ b/security/inode.c @@ -54,7 +54,7 @@ static int securityfs_fill_super(struct super_block *sb, struct fs_context *fc) static int securityfs_get_tree(struct fs_context *fc) { - return get_tree_single(fc, securityfs_fill_super); + return get_tree_keyed(fc, securityfs_fill_super, fc->user_ns); } static const struct fs_context_operations securityfs_context_ops = { @@ -67,11 +67,17 @@ static int securityfs_init_fs_context(struct fs_context *fc) return 0; } +static void securityfs_kill_super(struct super_block *sb) +{ + kill_litter_super(sb); +} + static struct file_system_type fs_type = { .owner = THIS_MODULE, .name = "securityfs", .init_fs_context = securityfs_init_fs_context, - .kill_sb = kill_litter_super, + .kill_sb = securityfs_kill_super, + .fs_flags = FS_USERNS_MOUNT, }; /** @@ -130,6 +136,8 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, if (!parent) { if (ns == &init_user_ns) parent = securityfs_mount->mnt_root; + else + return ERR_PTR(-EINVAL); } dir = d_inode(parent); -- 2.31.1