From: Munehisa Kamata <kamatam@amazon.com>
To: <casey@schaufler-ca.com>
Cc: <jmorris@namei.org>, <kamatam@amazon.com>,
<linux-kernel@vger.kernel.org>,
<linux-security-module@vger.kernel.org>,
<linux-unionfs@vger.kernel.org>, <mengcc@amazon.com>,
<miklos@szeredi.hu>, <paul@paul-moore.com>,
<roberto.sassu@huawei.com>, <roberto.sassu@huaweicloud.com>,
<serge@hallyn.com>, <yoonjaeh@amazon.com>, <zohar@linux.ibm.com>
Subject: Re: [RFC][PATCH 1/2] smack: Retrieve transmuting information in smack_inode_getsecurity()
Date: Mon, 21 Aug 2023 00:55:17 -0700 [thread overview]
Message-ID: <20230821075517.2320555-1-kamatam@amazon.com> (raw)
In-Reply-To: <b0a4fa15-df54-46df-afe7-2af03c3d56df@schaufler-ca.com>
Hi Casey, Roberto
On Thu, 2023-05-11 17:12:50 +0000, Casey Schaufler wrote:
>
> On 5/8/2023 10:02 AM, Roberto Sassu wrote:
> > From: Roberto Sassu <roberto.sassu@huawei.com>
> >
> > Enhance smack_inode_getsecurity() to retrieve the value for
> > SMACK64TRANSMUTE from the inode security blob, similarly to SMACK64.
> >
> > This helps to display accurate values in the situation where the security
> > labels come from mount options and not from xattrs.
> >
> > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
>
> Looks good. I have added to smack next.
Do you have any objections to backporting these patches to -stable? If not,
I'll ask it in the stable list along with another overlayfs-related fix
387ef964460f ("Smack:- Use overlay inode label in smack_inode_copy_up()").
Thanks,
Munehisa
>
> > ---
> > security/smack/smack_lsm.c | 22 ++++++++++++++++++----
> > 1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> > index 7a3e9ab137d..c7e37ed2799 100644
> > --- a/security/smack/smack_lsm.c
> > +++ b/security/smack/smack_lsm.c
> > @@ -1463,10 +1463,19 @@ static int smack_inode_getsecurity(struct mnt_idmap *idmap,
> > struct super_block *sbp;
> > struct inode *ip = inode;
> > struct smack_known *isp;
> > + struct inode_smack *ispp;
> > + size_t label_len;
> > + char *label = NULL;
> >
> > - if (strcmp(name, XATTR_SMACK_SUFFIX) == 0)
> > + if (strcmp(name, XATTR_SMACK_SUFFIX) == 0) {
> > isp = smk_of_inode(inode);
> > - else {
> > + } else if (strcmp(name, XATTR_SMACK_TRANSMUTE) == 0) {
> > + ispp = smack_inode(inode);
> > + if (ispp->smk_flags & SMK_INODE_TRANSMUTE)
> > + label = TRANS_TRUE;
> > + else
> > + label = "";
> > + } else {
> > /*
> > * The rest of the Smack xattrs are only on sockets.
> > */
> > @@ -1488,13 +1497,18 @@ static int smack_inode_getsecurity(struct mnt_idmap *idmap,
> > return -EOPNOTSUPP;
> > }
> >
> > + if (!label)
> > + label = isp->smk_known;
> > +
> > + label_len = strlen(label);
> > +
> > if (alloc) {
> > - *buffer = kstrdup(isp->smk_known, GFP_KERNEL);
> > + *buffer = kstrdup(label, GFP_KERNEL);
> > if (*buffer == NULL)
> > return -ENOMEM;
> > }
> >
> > - return strlen(isp->smk_known);
> > + return label_len;
> > }
> >
> >
>
prev parent reply other threads:[~2023-08-21 7:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-08 17:02 [RFC][PATCH 1/2] smack: Retrieve transmuting information in smack_inode_getsecurity() Roberto Sassu
2023-05-08 17:02 ` [RFC][PATCH 2/2] smack: Record transmuting in smk_transmuted Roberto Sassu
2023-05-11 17:13 ` Casey Schaufler
2023-05-08 17:24 ` [RFC][PATCH 1/2] smack: Retrieve transmuting information in smack_inode_getsecurity() Casey Schaufler
2023-05-11 17:12 ` Casey Schaufler
2023-08-21 7:55 ` Munehisa Kamata [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230821075517.2320555-1-kamatam@amazon.com \
--to=kamatam@amazon.com \
--cc=casey@schaufler-ca.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=mengcc@amazon.com \
--cc=miklos@szeredi.hu \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
--cc=roberto.sassu@huaweicloud.com \
--cc=serge@hallyn.com \
--cc=yoonjaeh@amazon.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).