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: <YuFqh6OrWEQsZV04@kroah.com>
Date:   Wed, 27 Jul 2022 18:40:39 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Petr Vorel <pvorel@...e.cz>
Cc:     linux-kernel@...r.kernel.org,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        David Sterba <dsterba@...e.com>
Subject: Re: [PATCH 1/1] drivers/base/cpu: Print kernel arch

On Wed, Jul 27, 2022 at 06:11:35PM +0200, Petr Vorel wrote:
> Print kernel architecture in /sys/devices/system/cpu/arch
> using UTS_MACHINE, i.e. member of struct uts_namespace.machine.
> 
> This helps people who debug kernel with initramfs with minimal
> environment (i.e. without coreutils or even busybox) or allow to open
> sysfs file instead of run uname -m in high level languages.
> 
> Signed-off-by: Petr Vorel <pvorel@...e.cz>
> ---
>  drivers/base/cpu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

You can't add a new sysfs file without a Documentation/ABI/ update as
well.  Please fix that up.


> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 4c98849577d4..7c8032e3ff10 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -3,6 +3,7 @@
>   * CPU subsystem support
>   */
>  
> +#include <generated/compile.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
> @@ -232,6 +233,13 @@ static ssize_t print_cpus_kernel_max(struct device *dev,
>  }
>  static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
>  
> +static ssize_t print_cpus_arch(struct device *dev,
> +				     struct device_attribute *attr, char *buf)
> +{
> +	return sysfs_emit(buf, "%s\n", UTS_MACHINE);
> +}
> +static DEVICE_ATTR(arch, 0444, print_cpus_arch, NULL);

why just UTS_MACHINE?  Doesn't 'uname' show this already?  And I thought
this was in /proc/cpuinfo but odd, it isn't...

Also what about the other things in compile.h?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ