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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Mar 2024 14:58:49 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: linux-kernel@...r.kernel.org, x86@...nel.org
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "H. Peter Anvin" <hpa@...or.com>, Andy Lutomirski <luto@...nel.org>,
 Peter Zijlstra <peterz@...radead.org>,
 Dan Williams <dan.j.williams@...el.com>, Michael Roth
 <michael.roth@....com>, Ashish Kalra <ashish.kalra@....com>,
 Joel Becker <jlbec@...lplan.org>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 12/14] fs/configfs: Add a callback to determine
 attribute visibility

On 3/8/24 12:35, Tom Lendacky wrote:
> In order to support dynamic decisions as to whether an attribute should be
> created, add a callback that returns a bool to indicate whether the
> attribute should be display. If no callback is registered, the attribute
> is displayed by default.
> 
> Cc: Joel Becker <jlbec@...lplan.org>
> Cc: Christoph Hellwig <hch@....de>
> Signed-off-by: Tom Lendacky <thomas.lendacky@....com>
> ---
>   fs/configfs/file.c       |  13 +++++
>   include/linux/configfs.h | 114 +++++++++++++++++++++++++++------------
>   2 files changed, 93 insertions(+), 34 deletions(-)
> 
> diff --git a/fs/configfs/file.c b/fs/configfs/file.c
> index 0ad32150611e..c758bcc11235 100644
> --- a/fs/configfs/file.c
> +++ b/fs/configfs/file.c
> @@ -451,6 +451,12 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib
>   	umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;

I missed making this adjustment on the returned mode parameter below. So 
this patch will change slightly to just initialize mode to attr->ca_mode 
and then after the if statement, apply the masks as done above.

Thanks,
Tom

>   	int error = 0;
>   
> +	if (attr->ca_is_visible) {
> +		mode = attr->ca_is_visible(item, attr);
> +		if (!mode)
> +			return 0;
> +	}
> +
>   	inode_lock_nested(d_inode(dir), I_MUTEX_NORMAL);
>   	error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode,
>   				     CONFIGFS_ITEM_ATTR, parent_sd->s_frag);
> @@ -470,9 +476,16 @@ int configfs_create_bin_file(struct config_item *item,
>   {
>   	struct dentry *dir = item->ci_dentry;
>   	struct configfs_dirent *parent_sd = dir->d_fsdata;
> +	const struct configfs_attribute *attr = &bin_attr->cb_attr;
>   	umode_t mode = (bin_attr->cb_attr.ca_mode & S_IALLUGO) | S_IFREG;
>   	int error = 0;
>   
> +	if (attr->ca_is_visible) {
> +		mode = attr->ca_is_visible(item, attr);
> +		if (!mode)
> +			return 0;
> +	}
> +
>   	inode_lock_nested(dir->d_inode, I_MUTEX_NORMAL);
>   	error = configfs_make_dirent(parent_sd, NULL, (void *) bin_attr, mode,
>   				     CONFIGFS_ITEM_BIN_ATTR, parent_sd->s_frag);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ