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: <YuPYWLD7xxcNmuCx@pevik>
Date:   Fri, 29 Jul 2022 14:53:44 +0200
From:   Petr Vorel <pvorel@...e.cz>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        David Sterba <dsterba@...e.com>
Subject: Re: [PATCH v2 1/1] drivers/base/cpu: Print kernel arch

Hi all,

> Print the machine hardware name (UTS_MACHINE) in /proc/sys/kernel/arch.

> 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>
> ---

Changes v1->v2:
* Add file into /proc/sys/kernel/ (previously it was in
  /sys/devices/system/cpu/). There are 
* Update Documentation/ABI/ (Greg)

Kind regards,
Petr

>  Documentation/admin-guide/sysctl/kernel.rst | 5 +++++ kernel/utsname_sysctl.c
>  | 7 +++++++ 2 files changed, 12 insertions(+)

> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index ddccd1077462..70a0acf07101 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -65,6 +65,11 @@ combining the following values:
>  4 s3_beep
>  = =======

> +arch
> +====
> +
> +The machine hardware name, the same output as ``uname -m``
> +(e.g. ``x86_64`` or ``aarch64``).

>  auto_msgmni
>  ===========
> diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
> index 4ca61d49885b..7ffdd2cd5ff9 100644
> --- a/kernel/utsname_sysctl.c
> +++ b/kernel/utsname_sysctl.c
> @@ -73,6 +73,13 @@ static DEFINE_CTL_TABLE_POLL(hostname_poll);
>  static DEFINE_CTL_TABLE_POLL(domainname_poll);

>  static struct ctl_table uts_kern_table[] = {
> +	{
> +		.procname	= "arch",
> +		.data		= init_uts_ns.name.machine,
> +		.maxlen		= sizeof(init_uts_ns.name.machine),
> +		.mode		= 0444,
> +		.proc_handler	= proc_do_uts_string,
> +	},
>  	{
>  		.procname	= "ostype",
>  		.data		= init_uts_ns.name.sysname,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ