Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794046269; b=rW0Sxo4pH4VMeOOoIc+fDVCAguH93+w20OIFEHXnzVYD1eT81WqsRSFa1tr19nxQMBTA KrqhW0msBWC0UlC0e2qP4ABX8imvZdWzBLi0iesJefaehXuS3oYCTvxQKKaMUQkf6mm1p kbBkFrLwoho/Yc+C8kHKZJxNKhXqSnMpKewOUuRhn+M78aldpIt2UmwB/uKcpR+gM9pn3 lzsJqwSDXw1K+C8Oxgbv0BAZ7ARZJXnfAxET6STODg2NfNxNulUthyakbjUbCD64UoLE9 XQ1LFpjHWdeTQB7xGBjP7Q+EICUF+YoQfAWGg31jIKel1jK37+K525SL1OVzng6RiWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794046269; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=9Z3qte8A7x3/4tEVbKnD1W5NUSFcbdGyWxfRoVVoikQ=; b=rjrMc4Oqnfqt99fiSWbe3O78RuAcyQ+8mLp0FYz0uJBVOWV8SAjo08d5EFasrDAzBXa8 acc/+shWCQBnJHqilbjZkr1tmvwC/N1KNHfj9V02l6Holv4U1E24haeCE/rUS6VhoCG/E 3PlaWL2QkaOJX4CxoAh7n8uaF6Vh7q6NwgvIY3pGTXC+TstvhWYRJe/AeC1Re4HIIB22A Y6aKe/zeSEU8ERX1iv/9eNfN83rAd63SzaRy+IYsn3MT8Nc9noq16sYOyNg3OdN5Eh+ZQ n/dDr4BDCXi+epZZsCBA28Jng0ikzSRwiHoE3GGfxhO928gMlrkqBTxIEsiwfihowZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fSAbZDBl; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68DA5606A32D for ; Sat, 7 Nov 2026 10:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fSAbZDBl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D561F0089F; Sat, 7 Nov 2026 10:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794046269; bh=9Z3qte8A7x3/4tEVbKnD1W5NUSFcbdGyWxfRoVVoikQ=; h=From:To:Cc:Subject:Date; b=fSAbZDBl2QEvYtDokn4+J3HUL5J/RpTMNoQ+TPhH3s1O815Zbt4K9qbzTmDdVwNA9 d8usEAuuNQ5lAdFi17+iVlFZ9edBgEob6zu25pUP0VAgh5zgimzoD8qSOZ6m8s9RlI DTNBQRVMNHAExJDRQFV/ALX9/OBB3Ifw8igIKVnualytbUWGE8SWoSOCHMhJ0U9441 DqZGlz3UGMPGWqVpw7kkzn/ogPLmBO/xqUlRDQmGq7dlvOv0rtFo3cC2k7UaHF46Yq rI27/k81RXmFUWewa0P5q6yT4mbdKel96c0kUYYo6n/AojIUNvwojLGwPJWT0p1eBT fYdACY+F/PoBw== From: Sasha Levin To: brads@mainlining.org, akpm@linux-foundation.org, pmladek@suse.com, linux@roeck-us.net, sashiko-bot@kernel.org, wangjinchao600@gmail.com, wim@linux-watchdog.org Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] panic: kill the "buffer unavailable" redirect fallback" failed to apply to 6.18-stable tree Date: Sat, 7 Nov 2026 05:11:07 -0500 Message-ID: <20261107051107-failed-6.18-68d956e9e235@kernel.org> X-Mailer: git-send-email 2.53.0 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x 68d956e9e235c2e125f77a9e98831e297b624a75 # git commit -s git send-email --to '' --in-reply-to '20261107051107-failed-6.18-68d956e9e235@kernel.org' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Thanks, Sasha ------------------ original commit in Linus's tree ------------------ From 68d956e9e235c2e125f77a9e98831e297b624a75 Mon Sep 17 00:00:00 2001 From: Bradley Morgan Date: Wed, 16 Sep 2026 18:29:57 +0000 Subject: [PATCH] panic: kill the "buffer unavailable" redirect fallback The redirect buffer is a disgusting terrible hack. panic_force_buf is kmalloc'ed in a late_initcall, and until then the redirect delivers this as the panic message: Redirected panic (buffer unavailable) The whole point of the redirect is to hand the panic message to the target CPU, so the crash kernel boots knowing it panicked and not why. And that window is the entire boot, from the early_param to the late_initcall, which is exactly when you most want the message. Make it a static 1KB buffer and kill the initcall. The cost is 1KB of .bss in SMP crash dump builds, and it is only ever touched when panic_force_cpu= is set anyway. The local msg variable is gone too, the buffer goes directly to panic_smp_redirect_cpu(). Link: https://lore.kernel.org/20260916182957.7788-7-brads@mainlining.org Signed-off-by: Bradley Morgan Signed-off-by: Andrew Morton Suggested-by: Petr Mladek Reviewed-by: Petr Mladek Cc: Guenetr Roeck Cc: Sashiko Cc: Wang Jinchao Cc: Wim Van Sebroeck Cc: --- kernel/panic.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index 29c981926f5f3..170744163fc2a 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -307,7 +307,7 @@ atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID); atomic_t panic_redirect_cpu = ATOMIC_INIT(PANIC_CPU_INVALID); #if defined(CONFIG_SMP) && defined(CONFIG_CRASH_DUMP) -static char *panic_force_buf; +static char panic_force_buf[PANIC_MSG_BUFSZ]; static int __init panic_force_cpu_setup(char *str) { @@ -326,17 +326,6 @@ static int __init panic_force_cpu_setup(char *str) } early_param("panic_force_cpu", panic_force_cpu_setup); -static int __init panic_force_cpu_late_init(void) -{ - if (panic_force_cpu < 0) - return 0; - - panic_force_buf = kmalloc(PANIC_MSG_BUFSZ, GFP_KERNEL); - - return 0; -} -late_initcall(panic_force_cpu_late_init); - static void do_panic_on_target_cpu(void *info) { panic("%s", (char *)info); @@ -380,7 +369,7 @@ static bool panic_try_force_cpu(const char *fmt, va_list args) { int this_cpu = raw_smp_processor_id(); int old_cpu = PANIC_CPU_INVALID; - const char *msg; + va_list ap; /* Feature not enabled via boot parameter */ if (panic_force_cpu < 0) @@ -413,20 +402,11 @@ static bool panic_try_force_cpu(const char *fmt, va_list args) return old_cpu != this_cpu; /* - * Use dynamically allocated buffer if available, otherwise - * fall back to static message for early boot panics or allocation failure. + * Do not consume args, the caller reuses them if we fail. */ - if (panic_force_buf) { - va_list ap; - - /* Do not consume args, the caller reuses it if we fail */ - va_copy(ap, args); - vsnprintf(panic_force_buf, PANIC_MSG_BUFSZ, fmt, ap); - va_end(ap); - msg = panic_force_buf; - } else { - msg = "Redirected panic (buffer unavailable)"; - } + va_copy(ap, args); + vsnprintf(panic_force_buf, PANIC_MSG_BUFSZ, fmt, ap); + va_end(ap); console_verbose(); bust_spinlocks(1); @@ -441,7 +421,7 @@ static bool panic_try_force_cpu(const char *fmt, va_list args) dump_stack(); } - if (panic_smp_redirect_cpu(panic_force_cpu, (void *)msg) != 0) { + if (panic_smp_redirect_cpu(panic_force_cpu, panic_force_buf) != 0) { atomic_set(&panic_redirect_cpu, PANIC_CPU_INVALID); pr_warn("panic: failed to redirect to CPU %d, continuing on CPU %d\n", panic_force_cpu, this_cpu); -- 2.53.0