Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp59095pxy; Wed, 21 Apr 2021 18:28:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz64/TPzK8/zZ0JcEfmU5+gFPY2tH4mxHq9vC9AYrVAjBIlXx9RRlvPAcd2Tmvq/hpfe9XN X-Received: by 2002:a17:902:ea0e:b029:ec:7cd0:9106 with SMTP id s14-20020a170902ea0eb02900ec7cd09106mr893320plg.9.1619054880469; Wed, 21 Apr 2021 18:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619054880; cv=none; d=google.com; s=arc-20160816; b=CSsfIKeNaPEw34c1iivvxgBHp+5V4Bw5BrpnNmXPKt7xI8LTfQG6k/rhWY0XIGk3DH aF+1yoOGv00rrUUXHrXba52hxHdKF3rk69IDKVDANPi4BfsrHnCopeNr2eX0bKLhMpDF jxj+TBWoV5KPwzmHLm8aJOxqmtI3Tv41wzbw9iDou1wuNY3dNyNGfd/i/hm00Bhx5O3B VECZs9YbmguYcNResMei3A0WjCXQ+4PGmbCcA48a9M39tMtwL2/r9pigBYVf2KxdsIwc 02CHF/dthhTXTMH9fgJ9GPJL4dc/8gcADcKqwHZ2aHYt+QJrV+YWyyzrDtrxVvznYmBT v4NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=MB9zO7McvPmioxzhN+e5Vh39AUmsx8/cXEwQ1feTM0s=; b=WfOhfempZf8C6syFjk4yX9iTt2aSXAiSPky9Pe0hJGA2SFL6p4Js0MDIAYNars+ecd 0/3CWeo/1jYKz+sT1zYiiv2/u4S9lFs+GvIFoupQI3MvSaRjDZNu3Nfxi3IKPsMAzLFK kNGqG1fGwfilgB08uEc+uXgRBZfSGPtEOftfIzYNFXhPcEeNj26mAKao1D4uFbC5Lt6Y cMdRXeCoJwGY5gM3mBS5HKJXiYIk0P31xTD3hdZBHuy3VDZxz+09jeWm1js3B8gUdJzH EXLUTQY4dGwxDNjRku5VNtfaWcY1fOQCAfysA6/q0+U6eJXS20okXLBzWLe6dhbY1BHg htew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=DmWXKFnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si1411603pfd.331.2021.04.21.18.27.48; Wed, 21 Apr 2021 18:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=DmWXKFnj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbhDUWoc (ORCPT + 99 others); Wed, 21 Apr 2021 18:44:32 -0400 Received: from sonic311-30.consmr.mail.ne1.yahoo.com ([66.163.188.211]:43842 "EHLO sonic311-30.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234183AbhDUWo3 (ORCPT ); Wed, 21 Apr 2021 18:44:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1619045035; bh=MB9zO7McvPmioxzhN+e5Vh39AUmsx8/cXEwQ1feTM0s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject:Reply-To; b=DmWXKFnjz2d6JUBIVczNc/zjMfKTXbm21VW1dfa04ONIPY/snL8uluYvp4jhdUFbhYqzLMjOIcl+d/2/Z4LwOaQGug4Z4bsBS2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M6KYOeg2Huyj 5fE1v_UnNE9ncTpEVK8_XttWxinoTQAk703aZcHCYTYjcQNc40mHILrqBe0O38nt58Wtfj.W2N1I gOh1lTm62P3MafcsZwhc2qQANTfew1d78rxI.12lvGWUjSawzsGHTC9UL4bUSGzf_yZNXlLuh0Z0 NjfRNINbJCQFaP5m9rxtP9IsD0jYgmQzWDbO9QS1oqPiV6dxX_vh7R3a3cBAJ6ucMvA.BGSpAHiC LozmVd1noItGTAax8HHXjOoEBVpIfi_6L3jUZe7gp0o0ycM9O4L7LiuyYePPLKIYu5wXq82bBQe0 UoxgVXK2wxQa_mYvIPKifSZWwoQJfAlQXHRyn2geJ0jeabI59l93vMHdNcH17PrBzREqxbLFM_bf _wH_ifcfiYsR2.rdXW5ftwRZLmk574KwkTKWcecthxiOyXIpYMrTy9wmvB69OOAdvICxyBZzPIfY DiKgdY3wnNnrh.zCH6a18zi0jBSmjPszZfjCUlXpKpeWMzOCTUTuX3LzdsAWH65gFGMp1wUEIv63 4SWd4eEHVkLTou1reciNJGTs9WKGuNvwG44FzRjptJTYwj_aoYroUKeutjpf3zow8tnoRb6N7bt8 8fAOcJG7ulzv5tfsDVrizfg_hBYyOnS1kYKyZS19cPFepFSPEgS.3vvpB X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Wed, 21 Apr 2021 22:43:55 +0000 Received: by kubenode512.mail-prod1.omega.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 8d5fac0008ab4c1e871a17521cafc02e; Wed, 21 Apr 2021 22:43:49 +0000 (UTC) Subject: Re: [PATCH v2 3/6] security: Pass xattrs allocated by LSMs to the inode_init_security hook To: Roberto Sassu , zohar@linux.ibm.com, jmorris@namei.org, paul@paul-moore.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, reiserfs-devel@vger.kernel.org, Casey Schaufler References: <20210421161925.968825-1-roberto.sassu@huawei.com> <20210421161925.968825-4-roberto.sassu@huawei.com> From: Casey Schaufler Message-ID: <0caf1e58-1e2d-c781-3f71-18aaf55cada2@schaufler-ca.com> Date: Wed, 21 Apr 2021 15:43:49 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210421161925.968825-4-roberto.sassu@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Mailer: WebService/1.1.18121 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/16) Content-Length: 9045 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/2021 9:19 AM, Roberto Sassu wrote: > In preparation for moving EVM to the LSM infrastructure, this patch > replaces the name, value, len triple with the xattr array pointer provi= ded > by security_inode_init_security(). LSMs are expected to call the new > function lsm_find_xattr_slot() to find the first unused slot of the arr= ay > where the xattr should be written. > > This patch modifies also SELinux and Smack to search for an unused slot= , to > have a consistent behavior across LSMs (the unmodified version would > overwrite the xattr set by the first LSM in the chain). It is also > desirable to have the modification in those LSMs, as they are likely us= ed > as a reference for the development of new LSMs. This looks better than V1. One safety comment below. > > Signed-off-by: Roberto Sassu > --- > include/linux/lsm_hook_defs.h | 4 ++-- > include/linux/lsm_hooks.h | 18 +++++++++++++++--- > security/security.c | 13 +++++++------ > security/selinux/hooks.c | 13 ++++++------- > security/smack/smack_lsm.c | 20 +++++++++----------- > 5 files changed, 39 insertions(+), 29 deletions(-) > > diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_def= s.h > index 477a597db013..afb9dd122f60 100644 > --- a/include/linux/lsm_hook_defs.h > +++ b/include/linux/lsm_hook_defs.h > @@ -111,8 +111,8 @@ LSM_HOOK(int, 0, path_notify, const struct path *pa= th, u64 mask, > LSM_HOOK(int, 0, inode_alloc_security, struct inode *inode) > LSM_HOOK(void, LSM_RET_VOID, inode_free_security, struct inode *inode)= > LSM_HOOK(int, 0, inode_init_security, struct inode *inode, > - struct inode *dir, const struct qstr *qstr, const char **name, > - void **value, size_t *len) > + struct inode *dir, const struct qstr *qstr, struct xattr *xattrs, > + void *fs_data) > LSM_HOOK(int, 0, inode_init_security_anon, struct inode *inode, > const struct qstr *name, const struct inode *context_inode) > LSM_HOOK(int, 0, inode_create, struct inode *dir, struct dentry *dentr= y, > diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h > index c5498f5174ce..e8c9bac29b9d 100644 > --- a/include/linux/lsm_hooks.h > +++ b/include/linux/lsm_hooks.h > @@ -27,6 +27,7 @@ > =20 > #include > #include > +#include > #include > =20 > /** > @@ -227,9 +228,11 @@ > * @inode contains the inode structure of the newly created inode. > * @dir contains the inode structure of the parent directory. > * @qstr contains the last path component of the new object > - * @name will be set to the allocated name suffix (e.g. selinux). > - * @value will be set to the allocated attribute value. > - * @len will be set to the length of the value. > + * @xattrs contains the full array of xattrs allocated by LSMs where > + * ->name will be set to the allocated name suffix (e.g. selinux). > + * ->value will be set to the allocated attribute value. > + * ->len will be set to the length of the value. > + * @fs_data contains filesystem-specific data. > * Returns 0 if @name and @value have been successfully set, > * -EOPNOTSUPP if no security attribute is needed, or > * -ENOMEM on memory allocation failure. > @@ -1661,4 +1664,13 @@ static inline void security_delete_hooks(struct = security_hook_list *hooks, > =20 > extern int lsm_inode_alloc(struct inode *inode); > =20 Some "security researcher" with a fuzz tester is going to manage to dump = junk into the slots and ruin your week. I suggest a simple change to make boun= ds checking possible. It should never happen, but if that was sufficient people would=20 love C string processing better. > +static inline struct xattr *lsm_find_xattr_slot(struct xattr *xattrs) +static inline struct xattr *lsm_find_xattr_slot(struct xattr *xattrs, in= t available) > +{ > + struct xattr *slot; > + > + for (slot =3D xattrs; slot && slot->name !=3D NULL; slot++) + for (slot =3D xattrs; slot && slot->name !=3D NULL; slot++) if (WARN_ON(slot > xattrs[available])) return NULL;=20 > + ; > + > + return slot; > +} > #endif /* ! __LINUX_LSM_HOOKS_H */ > diff --git a/security/security.c b/security/security.c > index 7f14e59c4f8e..2c1fe1496069 100644 > --- a/security/security.c > +++ b/security/security.c > @@ -1037,18 +1037,16 @@ int security_inode_init_security(struct inode *= inode, struct inode *dir, > =20 > if (!initxattrs) > return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, > - dir, qstr, NULL, NULL, NULL); > + dir, qstr, NULL, fs_data); > memset(new_xattrs, 0, sizeof(new_xattrs)); > lsm_xattr =3D new_xattrs; > ret =3D call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, q= str, > - &lsm_xattr->name, > - &lsm_xattr->value, > - &lsm_xattr->value_len); > + lsm_xattr, fs_data); > if (ret) > goto out; > =20 > evm_xattr =3D lsm_xattr + 1; > - ret =3D evm_inode_init_security(inode, lsm_xattr, evm_xattr); > + ret =3D evm_inode_init_security(inode, new_xattrs, evm_xattr); > if (ret) > goto out; > ret =3D initxattrs(inode, new_xattrs, fs_data); > @@ -1071,10 +1069,13 @@ int security_old_inode_init_security(struct ino= de *inode, struct inode *dir, > const struct qstr *qstr, const char **name, > void **value, size_t *len) > { > + struct xattr xattr =3D { .name =3D NULL, .value =3D NULL, .value_len = =3D 0 }; > + struct xattr *lsm_xattr =3D (name && value && len) ? &xattr : NULL; > + > if (unlikely(IS_PRIVATE(inode))) > return -EOPNOTSUPP; > return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, > - qstr, name, value, len); > + qstr, lsm_xattr, NULL); > } > EXPORT_SYMBOL(security_old_inode_init_security); > =20 > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index ddd097790d47..806827eb132a 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -2916,11 +2916,11 @@ static int selinux_dentry_create_files_as(struc= t dentry *dentry, int mode, > =20 > static int selinux_inode_init_security(struct inode *inode, struct ino= de *dir, > const struct qstr *qstr, > - const char **name, > - void **value, size_t *len) > + struct xattr *xattrs, void *fs_data) > { > const struct task_security_struct *tsec =3D selinux_cred(current_cred= ()); > struct superblock_security_struct *sbsec; > + struct xattr *xattr =3D lsm_find_xattr_slot(xattrs); > u32 newsid, clen; > int rc; > char *context; > @@ -2947,16 +2947,15 @@ static int selinux_inode_init_security(struct i= node *inode, struct inode *dir, > !(sbsec->flags & SBLABEL_MNT)) > return -EOPNOTSUPP; > =20 > - if (name) > - *name =3D XATTR_SELINUX_SUFFIX; > + if (xattr) { > + xattr->name =3D XATTR_SELINUX_SUFFIX; > =20 > - if (value && len) { > rc =3D security_sid_to_context_force(&selinux_state, newsid, > &context, &clen); > if (rc) > return rc; > - *value =3D context; > - *len =3D clen; > + xattr->value =3D context; > + xattr->value_len =3D clen; > } > =20 > return 0; > diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c > index 12a45e61c1a5..af7eee0fee52 100644 > --- a/security/smack/smack_lsm.c > +++ b/security/smack/smack_lsm.c > @@ -962,26 +962,24 @@ static int smack_inode_alloc_security(struct inod= e *inode) > * @inode: the newly created inode > * @dir: containing directory object > * @qstr: unused > - * @name: where to put the attribute name > - * @value: where to put the attribute value > - * @len: where to put the length of the attribute > + * @xattrs: where to put the attribute > * > * Returns 0 if it all works out, -ENOMEM if there's no memory > */ > static int smack_inode_init_security(struct inode *inode, struct inode=20 *dir, > - const struct qstr *qstr, const char **name, > - void **value, size_t *len) > + const struct qstr *qstr, > + struct xattr *xattrs, void *fs_data) > { > struct inode_smack *issp =3D smack_inode(inode); > struct smack_known *skp =3D smk_of_current(); > struct smack_known *isp =3D smk_of_inode(inode); > struct smack_known *dsp =3D smk_of_inode(dir); > + struct xattr *xattr =3D lsm_find_xattr_slot(xattrs); > int may; > =20 > - if (name) > - *name =3D XATTR_SMACK_SUFFIX; > + if (xattr) { > + xattr->name =3D XATTR_SMACK_SUFFIX; > =20 > - if (value && len) { > rcu_read_lock(); > may =3D smk_access_entry(skp->smk_known, dsp->smk_known, > &skp->smk_rules); > @@ -999,11 +997,11 @@ static int smack_inode_init_security(struct inode=20 *inode, struct inode *dir, > issp->smk_flags |=3D SMK_INODE_CHANGED; > } > =20 > - *value =3D kstrdup(isp->smk_known, GFP_NOFS); > - if (*value =3D=3D NULL) > + xattr->value =3D kstrdup(isp->smk_known, GFP_NOFS); > + if (xattr->value =3D=3D NULL) > return -ENOMEM; > =20 > - *len =3D strlen(isp->smk_known); > + xattr->value_len =3D strlen(isp->smk_known); > } > =20 > return 0;