From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 813E23D331E for ; Tue, 25 Aug 2026 09:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651362; cv=none; b=GUIBWC5APo4e7N7sFlwC+mdNWbmufw9Ey2fsD8u9QIWNC+527P2PKm7JaWW/qHku2Nu3BpJAbkkIXOZNuk71TWb7iWkTPVqOblQxI0/JshLU4fPe9zRN1CQ6lCXu5HIRfHolc76Qqo61AbxMy9vtJV3kFVyAHALVm0JsNvnBzdM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651362; c=relaxed/simple; bh=SDOK5a982ZwEQnK+mq6ZJyeUw0V3az0fCs0VeBXrxUw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IH1VGLVZmT1Sla0YcmanGtWIbIk1rgpqXRp6TmBeZE+Kfa5H+wNT+kiBX3ncjSvf8OAqotJ5RVsPhbNH5ZCya+D+ZCRVQmMl0aZ1pC0Y+fdOm+ndJ1ZeykY1KFjWg4eHl+FEj0pa6puJWnz0VYQ/TUIK09N/0j0WcfjNvqE5Vyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=EHsQo9IG; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="EHsQo9IG" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c15cf78d1a2so513781266b.1 for ; Tue, 25 Aug 2026 02:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1787651358; x=1788256158; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=jhNcaEAWGOV1mao/QyWB63lyecaeVBUJemIbl04upLg=; b=EHsQo9IGWT9obEWNEWTHRhCCnGixdbrhh0GFiMZKJOfK3h4rIoLxrNpzssR5zoBq/R mEbe4leE3KYiFo3hBMQvcZ5J1irI6RY4615zJJlauK+d4AKOI7muyN9A48IEhBuwahYB oC6yBkCTc72H5BqaicUZ+wEsYuje1dW/pFWk528BB8HMw/Nb8y9bmrAEKsPOdDfyZQaE h4642/3Y82t3mU4YU/LGN14PaKMnXNK5teX75bLRbBJ9hOmfnTODCEiAAMjQrBe+6KtE TsYsT13tG8Z46I3nTkRZjuyS4dJ19TRu4qeU852Te2hoMMnWmKNfMeBHoo2absKLBYb1 LZSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787651358; x=1788256158; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jhNcaEAWGOV1mao/QyWB63lyecaeVBUJemIbl04upLg=; b=SJpCwEuUC4m0xAOsqT2DFsV6Ei98+lU2T1O39jirN5F5foitKDL/mHI1MmZzjz/cEB e8XEGaPbgtnJcu9Giu3r+48qZQJOXB5Nc3QzzRGiOVknAIuEhuBA+43zet9eG6TyiDy1 OAVPEODQyB1XIRjnpeOedAnIQPw4Ky/leAvXlo56FFeIlEXXimBbq13YXPCYvPJQ7oBd uYgEi/+R4PDLez4LNM+R+nXznCzk9rhuyY8ixhXOlGqoP14h2D4nCw0ZNQe6DQqJAVJ2 Uky5duPVw5JWtCnnXfjPiXVHDP61fa0eckSTTa+plLvLmr4jicPdYAhuBXWx12rVow1e b65g== X-Forwarded-Encrypted: i=1; AHgh+Rpf3PBK4hNoz/vGvMxOKL7PYR+toYYTM7u4/nSpTD9CudPWsclR77+ITZCublT/6nDQqyK0RxKwWykjL/Y=@vger.kernel.org X-Gm-Message-State: AFuF++lJjkEh1zpDzhvzjWnKwJJdm1LF6AVULN1Rtdt0MpeRypxSSea/ ZboqdGABLMq55aDZzz56vfnoYoK5FiRBl6aB5ADKC1jtyf+l20PbHL+6qNxJpCbWb/o= X-Gm-Gg: AR+sD10iB6b6M0Kak+Sf+rFLWPx+Ics2RgMJM7Fugy85XUqm3YBtnUfDm+PwwUhMtf6 2oUFkJZeKhmP6AI099UkxAm5EPdYak6+BR0SfCcRUvIeW1akceGMFQicPHpPpWs/DzTpllhOQKt rcYkTnr9cCEQJnLdL0hwBpNgSkUR0guAVDlIFmEtora6+5sLzyAEJteCNETIk9LDzw927cqst3t f0/zjAMvsCqE4il3MxVp+Zhd/dk0XU+FYVGgoxEzkzUyEcXH5tfrNfhoXa0b1+Eb7ST3/9kxRYs VIbpM1Cgg1W1uyBvuRRADn39fd0bcQt0jGOVKCpvY9rhLxgOVhFkytLxyMIHcFeLHZNgiRJKHCm i7qebN/pMAOxCne7XB7AQFPAcI3PVAW8H/AUmyXr+kmWhky6xyOtAX4HTdVWam+obt7H2mA6nCI fzYlTtdL2ZE4ZHey6ACBAA+KJ7trXz33cWr8Yj13PC/4zAIuIwwCe6AK/SJUX9d5Bj3sBzlYX1n Q== X-Received: by 2002:a17:907:9304:b0:c17:cf99:6154 with SMTP id a640c23a62f3a-c24e5b28879mr566987266b.16.1787651357608; Tue, 25 Aug 2026 02:49:17 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249606a8fasm1864582966b.8.2026.08.25.02.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 02:49:17 -0700 (PDT) Date: Tue, 25 Aug 2026 11:49:15 +0200 From: Petr Mladek To: Bradley Morgan Cc: Andrew Morton , Jinchao Wang , Feng Tang , Rio , Pnina Feder , Petr Pavlu , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Sashiko , stable@vger.kernel.org Subject: Re: [PATCH v6 6/6] panic: kill the "buffer unavailable" redirect fallback Message-ID: References: <20260818163806.17460-1-include@grrlz.net> <20260818163806.17460-7-include@grrlz.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260818163806.17460-7-include@grrlz.net> On Tue 2026-08-18 16:38:06, Bradley Morgan wrote: > The redirect buffer is a disgusting terrible hack. panic_force_buf is > kmalloc'ed in a late_initcall, the return value is not even checked, It is not checked intentionally. kmalloc() prints a debug message on its own when it is not able to allocate the memory. And it returns NULL in this case. It is enough in this case. Please, remove this sentence from the commit message. > 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. A > failed kmalloc just keeps it broken forever, silently. > > 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. > > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -413,20 +403,12 @@ 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); > + msg = panic_force_buf; Nit: The "msg" variable is no longer needed. It will always be set to panic_force_buf. The later code could use: panic_smp_redirect_cpu(panic_force_cpu, (void *)panic_force_buf) Otherwise, the change looks good from my POV. Best Regards, Petr