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: <YwZJP25sfKcfw9eT@zn.tnic>
Date:   Wed, 24 Aug 2022 17:52:31 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Jia He <justin.he@....com>
Cc:     Len Brown <lenb@...nel.org>, James Morse <james.morse@....com>,
        Tony Luck <tony.luck@...el.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Robert Richter <rric@...nel.org>,
        Robert Moore <robert.moore@...el.com>,
        Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
        Yazen Ghannam <yazen.ghannam@....com>,
        Jonathan Corbet <corbet@....net>,
        Jan Luebbe <jlu@...gutronix.de>,
        Khuong Dinh <khuong@...amperecomputing.com>,
        Kani Toshi <toshi.kani@....com>,
        Ard Biesheuvel <ardb@...nel.org>, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-edac@...r.kernel.org,
        devel@...ica.org, "Rafael J . Wysocki" <rafael@...nel.org>,
        Shuai Xue <xueshuai@...ux.alibaba.com>,
        Jarkko Sakkinen <jarkko@...nel.org>, linux-efi@...r.kernel.org,
        nd@....com, "Paul E. McKenney" <paulmck@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Neeraj Upadhyay <quic_neeraju@...cinc.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        Muchun Song <songmuchun@...edance.com>,
        linux-doc@...r.kernel.org
Subject: Re: [RESEND PATCH v3 4/9] EDAC/ghes: Move ghes_edac.force_load to
 setup parameter

On Mon, Aug 22, 2022 at 03:40:43PM +0000, Jia He wrote:
> ghes_edac_init() is too late to set this module flag ghes_edac.force_load.
> Also, other edac drivers should not be able to control this flag.
> 
> Move this flag to setup parameter in ghes.
> 
> Suggested-by: Toshi Kani <toshi.kani@....com>
> Signed-off-by: Jia He <justin.he@....com>
> ---
>  .../admin-guide/kernel-parameters.txt         |  5 +++
>  drivers/acpi/apei/ghes.c                      | 24 +++++++++++-
>  drivers/edac/ghes_edac.c                      | 38 +++++++------------
>  include/acpi/ghes.h                           |  7 +++-
>  4 files changed, 46 insertions(+), 28 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index d7f30902fda0..a5f0ee0d7727 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1593,6 +1593,11 @@
>  			When zero, profiling data is discarded and associated
>  			debugfs files are removed at module unload time.
>  
> +	ghes_edac_force= [X86] Skip the platform check and forcibly load the

So there already is ghes.disable which is using the module param thing.
Why don't you do that too?

> +			ghes_edac modules.

"module" - singular.

> +			Format: <bool>
> +			default: false (0)
> +
>  	goldfish	[X86] Enable the goldfish android emulator platform.
>  			Don't use this when you are not running on the
>  			android emulator
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 9c52183e3ad9..e17e0ee8f842 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -94,6 +94,26 @@
>  #define FIX_APEI_GHES_SDEI_CRITICAL	__end_of_fixed_addresses
>  #endif
>  
> +/*
> + * "ghes_edac_force=1" forcibly loads ghes_edac and skips the platform
> + * check.
> + */
> +bool __read_mostly ghes_edac_force;
> +EXPORT_SYMBOL(ghes_edac_force);
> +
> +static int __init setup_ghes_edac_load(char *str)
> +{
> +	if (str)
> +		if (!strcmp("true", str) || !strcmp("1", str))
> +			ghes_edac_force = true;
> +
> +	if (!IS_ENABLED(CONFIG_X86))
> +		ghes_edac_force = true;
> +
> +	return 1;
> +}
> +__setup("ghes_edac_force=", setup_ghes_edac_load);

Why all that?

Isn't specifying

ghes.edac_force_load

on the kernel command line enough? I.e., you don't need to parse the
passed in option - just the presence of the parameter is enough.

> +
>  static ATOMIC_NOTIFIER_HEAD(ghes_report_chain);
>  
>  static inline bool is_hest_type_generic_v2(struct ghes *ghes)
> @@ -1517,13 +1537,13 @@ static struct acpi_platform_list plat_list[] = {
>  	{ } /* End */
>  };
>  
> -struct list_head *ghes_get_devices(bool force)
> +struct list_head *ghes_get_devices(void)
>  {
>  	int idx = -1;
>  
>  	if (IS_ENABLED(CONFIG_X86)) {
>  		idx = acpi_match_platform_list(plat_list);
> -		if (idx < 0 && !force)
> +		if (idx < 0 && !ghes_edac_force)
>  			return NULL;
>  	}
>  
> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
> index bb3ea42ba70b..6a2b54cc7240 100644
> --- a/drivers/edac/ghes_edac.c
> +++ b/drivers/edac/ghes_edac.c
> @@ -54,10 +54,6 @@ static DEFINE_MUTEX(ghes_reg_mutex);
>   */
>  static DEFINE_SPINLOCK(ghes_lock);
>  
> -/* "ghes_edac.force_load=1" skips the platform check */
> -static bool __read_mostly force_load;
> -module_param(force_load, bool, 0);
> -
>  static bool system_scanned;
>  
>  static struct list_head *ghes_devs;
> @@ -437,23 +433,12 @@ static int ghes_edac_register(struct device *dev)
>  	mci->ctl_name = "ghes_edac";
>  	mci->dev_name = "ghes";
>  
> -	if (fake) {
> -		pr_info("This system has a very crappy BIOS: It doesn't even list the DIMMS.\n");
> -		pr_info("Its SMBIOS info is wrong. It is doubtful that the error report would\n");
> -		pr_info("work on such system. Use this driver with caution\n");
> -	} else if (force_load) {
> -		pr_info("This EDAC driver relies on BIOS to enumerate memory and get error reports.\n");
> -		pr_info("Unfortunately, not all BIOSes reflect the memory layout correctly.\n");
> -		pr_info("So, the end result of using this driver varies from vendor to vendor.\n");
> -		pr_info("If you find incorrect reports, please contact your hardware vendor\n");
> -		pr_info("to correct its BIOS.\n");
> -		pr_info("This system has %d DIMM sockets.\n", ghes_hw.num_dimms);
> -	}
> -
>  	if (!fake) {
>  		struct dimm_info *src, *dst;
>  		int i = 0;
>  
> +		pr_info("This system has %d DIMM sockets.\n", ghes_hw.num_dimms);
> +
>  		mci_for_each_dimm(mci, dst) {
>  			src = &ghes_hw.dimms[i];
>  

This hunk...

> @@ -478,6 +463,17 @@ static int ghes_edac_register(struct device *dev)
>  	} else {
>  		struct dimm_info *dimm = edac_get_dimm(mci, 0, 0, 0);
>  
> +		pr_info("This system has a very crappy BIOS: It doesn't even list the DIMMS.\n");
> +		pr_info("Its SMBIOS info is wrong. It is doubtful that the error report would\n");
> +		pr_info("work on such system. Use this driver with caution\n");
> +
> +		if (ghes_edac_force) {
> +			pr_info("This EDAC driver relies on BIOS to enumerate memory and get\n");
> +			pr_info("error reports. Unfortunately, not all BIOSes reflect the\n");
> +			pr_info("memory layout correctly. If you find incorrect reports, please\n");
> +			pr_info("contact your hardware vendor for its in correct BIOS.\n");
> +		}
> +
>  		dimm->nr_pages = 1;
>  		dimm->grain = 128;
>  		dimm->mtype = MEM_UNKNOWN;

... and this hunk look unrelated to what this patch is doing. What are
they for?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ