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] [day] [month] [year] [list]
Date:   Fri, 9 Nov 2018 20:15:58 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Jerry Lin <wahahab11@...il.com>
Cc:     Greg Kroah-Hartman <greg@...ah.com>, devel@...verdev.osuosl.org,
        Todd Kjos <tkjos@...roid.com>, ghartman@...gle.com,
        astrachan@...gle.com, linux-kernel@...r.kernel.org,
        Arve Hjønnevåg <arve@...roid.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Martijn Coenen <maco@...roid.com>
Subject: Re: [PATCH v3] driver-staging: vsoc.c: Add sysfs support for
 examining the permissions of regions.

On Wed, Nov 07, 2018 at 10:30:43AM +0800, Jerry Lin wrote:
> Add a attribute called permissions under vsoc device node for examining
> current granted permissions in vsoc_device.
> 
> This file will display permissions in following format:
>   begin_offset  end_offset  owner_offset  owned_value
>             %x          %x            %x           %x
> 

(I'm not totally an expert on sysfs rules).

Sysfs are supposed to be one value per file, so instead of doing this
you would create a directory with four files like
vsoc_device/begin_offset vsoc_device/end_offset etc.  And each would
just hae a %x output.

> +static ssize_t permissions_show(struct device *dev,
> +				struct device_attribute *attr,
> +				char *buffer)
> +{
> +	struct fd_scoped_permission_node *node;
> +	char *row;
> +	int ret;
> +	ssize_t written = 0;
> +
> +	row = kzalloc(sizeof(char) * 128, GFP_KERNEL);
> +	if (!row)
> +		return 0;

Don't allocate this, just snprintf() directly into the buffer.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ