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: <20220425154616.a0e38aea35649d13d5afb5d4@linux-foundation.org>
Date:   Mon, 25 Apr 2022 15:46:16 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Tony Luck <tony.luck@...el.com>
Cc:     Borislav Petkov <bp@...en8.de>, x86@...nel.org,
        linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Smita Koralahalli Channabasappa 
        <smita.koralahallichannabasappa@....com>,
        Wei Huang <wei.huang2@....com>,
        Tom Lendacky <thomas.lendacky@....com>, patches@...ts.linux.dev
Subject: Re: [PATCH] topology/sysfs: Hide PPIN on systems that do not
 support it.

On Wed,  6 Apr 2022 15:01:50 -0700 Tony Luck <tony.luck@...el.com> wrote:

> Systems that do not support a Protected Processor Identification Number
> currently report:
> 
> 	# cat /sys/devices/system/cpu/cpu0/topology/ppin
> 	0x0
> 
> which is confusing/wrong.
> 
> Add a ".is_visible" function to suppress inclusion of the ppin file.
> 
> --- a/drivers/base/topology.c
> +++ b/drivers/base/topology.c
> @@ -152,9 +152,21 @@ static struct attribute *default_attrs[] = {
>  	NULL
>  };
>  
> +static umode_t topology_is_visible(struct kobject *kobj,
> +				   struct attribute *attr, int unused)
> +{
> +	struct device *dev = kobj_to_dev(kobj);
> +
> +	if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
> +		return 0;
> +
> +	return attr->mode;
> +}
> +
>  static const struct attribute_group topology_attr_group = {
>  	.attrs = default_attrs,
>  	.bin_attrs = bin_attrs,
> +	.is_visible = topology_is_visible,
>  	.name = "topology"
>  };

x86_64 allnoconfig:

drivers/base/topology.c: In function 'topology_is_visible':
drivers/base/topology.c:158:24: warning: unused variable 'dev' [-Wunused-variable]
  158 |         struct device *dev = kobj_to_dev(kobj);
      |                        ^~~

I suggest this be fixed in the topology_ppin() stub implementation.  Do
it as a nice inlined C function which avoids such problems.  Rather
than as a crappy macro which causes them...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ