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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 17 Jan 2021 13:33:55 -0800
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     linux-kernel@...r.kernel.org, opendmb@...il.com,
        Barret Rhoden <brho@...gle.com>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] initramfs: Panic with memory information

On Thu, 14 Jan 2021 15:15:16 -0800 Florian Fainelli <f.fainelli@...il.com> wrote:

> On systems with large amounts of reserved memory we may fail to
> successfully complete unpack_to_rootfs() and be left with:
> 
>  Kernel panic - not syncing: write error
> 
> this is not too helpful to understand what happened, so let's wrap the
> panic() calls with a surrounding show_mem() such that we have a chance
> of understanding the memory conditions leading to these allocation
> failures.

Seems sensible.

> @@ -45,6 +46,11 @@ static void __init error(char *x)
>  		message = x;
>  }
>  
> +#define panic_show_mem(...) {	\
> +	show_mem(0, NULL);	\
> +	panic(__VA_ARGS__);	\
> +}
> +

But can we replace nasty macro with pleasing C code?

--- a/init/initramfs.c~initramfs-panic-with-memory-information-fix
+++ a/init/initramfs.c
@@ -46,9 +46,14 @@ static void __init error(char *x)
 		message = x;
 }
 
-#define panic_show_mem(...) {	\
-	show_mem(0, NULL);	\
-	panic(__VA_ARGS__);	\
+static void panic_show_mem(const char *fmt, ...)
+{
+	va_list args;
+
+	show_mem(0, NULL);
+	va_start(args, fmt);
+	panic(fmt, args);
+	va_end(args);
 }
 
 /* link hash */
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ