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: <87r067svc6.fsf@intel.com>
Date: Mon, 16 Dec 2024 13:47:37 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Thomas Weißschuh <linux@...ssschuh.net>, Maarten
 Lankhorst
 <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
 Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>, Qiang Yu <yuq825@...il.com>, Joonas
 Lahtinen <joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi
 <rodrigo.vivi@...el.com>, Tvrtko Ursulin <tursulin@...ulin.net>, Alex
 Deucher <alexander.deucher@....com>, Christian König
 <christian.koenig@....com>, Xinhui Pan <Xinhui.Pan@....com>, Harry
 Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>, Rodrigo
 Siqueira <Rodrigo.Siqueira@....com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
 lima@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
 amd-gfx@...ts.freedesktop.org, Thomas Weißschuh
 <linux@...ssschuh.net>
Subject: Re: [PATCH 1/5] drm/sysfs: Constify 'struct bin_attribute'

On Mon, 16 Dec 2024, Thomas Weißschuh <linux@...ssschuh.net> wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>

Reviewed-by: Jani Nikula <jani.nikula@...el.com>

> ---
>  drivers/gpu/drm/drm_sysfs.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index fb3bbb6adcd16f3f325a2ae8e35f41851c00b272..60c1f26edb6fad23153c32a29fd3be02700fc938 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -261,7 +261,7 @@ static ssize_t enabled_show(struct device *device,
>  }
>  
>  static ssize_t edid_show(struct file *filp, struct kobject *kobj,
> -			 struct bin_attribute *attr, char *buf, loff_t off,
> +			 const struct bin_attribute *attr, char *buf, loff_t off,
>  			 size_t count)
>  {
>  	struct device *connector_dev = kobj_to_dev(kobj);
> @@ -315,21 +315,21 @@ static struct attribute *connector_dev_attrs[] = {
>  	NULL
>  };
>  
> -static struct bin_attribute edid_attr = {
> +static const struct bin_attribute edid_attr = {
>  	.attr.name = "edid",
>  	.attr.mode = 0444,
>  	.size = 0,
> -	.read = edid_show,
> +	.read_new = edid_show,
>  };
>  
> -static struct bin_attribute *connector_bin_attrs[] = {
> +static const struct bin_attribute *const connector_bin_attrs[] = {
>  	&edid_attr,
>  	NULL
>  };
>  
>  static const struct attribute_group connector_dev_group = {
>  	.attrs = connector_dev_attrs,
> -	.bin_attrs = connector_bin_attrs,
> +	.bin_attrs_new = connector_bin_attrs,
>  };
>  
>  static const struct attribute_group *connector_dev_groups[] = {

-- 
Jani Nikula, Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ