lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84e400ac-fb52-4305-e3c4-204e2c2b91b8@schaufler-ca.com>
Date:   Mon, 8 May 2023 10:24:43 -0700
From:   Casey Schaufler <casey@...aufler-ca.com>
To:     Roberto Sassu <roberto.sassu@...weicloud.com>, paul@...l-moore.com,
        jmorris@...ei.org, serge@...lyn.com
Cc:     linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, zohar@...ux.ibm.com,
        linux-unionfs@...r.kernel.org, miklos@...redi.hu,
        yoonjaeh@...zon.com, kamatam@...zon.com, mengcc@...zon.com,
        Roberto Sassu <roberto.sassu@...wei.com>,
        Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [RFC][PATCH 1/2] smack: Retrieve transmuting information in
 smack_inode_getsecurity()

On 5/8/2023 10:02 AM, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@...wei.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.

I will kick the tires on these patches. They look good at first glance.

>
> Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
> ---
>  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;
>  }
>  
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ