From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92A4D4207A for ; Sat, 21 Feb 2026 20:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771704205; cv=none; b=OAbgEV8eaawGAN44YTV3IwmGJGu9gT9U75Y9uEg1mEX5okrbxaFES+gmmJUXgU2OvsTrFEo3OY1cVnEavbmIJy4KKSleXQHJeWzYHQ600f/ZrdM3sYQwRYCKt2mZtOYH5o3ZeSBL68HsAHPampBQMR1j/gFsM7dKQcQXKqMjk6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771704205; c=relaxed/simple; bh=Dst4ZoBeK8k4SD4aAc7AJn/DrAZ5s0FLKzeC4RG5qJo=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=FTVguf+E9VJVNHj5qfV6k6QqkhWdZp5d4N2tQRzL67duBIAX6WqGxUTdgFX+m3ZsefohbyHcZRGwgwOQccO9NR4u0PlhMfQp28LZApIwcRC/PYFoQk5GqNAuzhSQhrOLnRVjiUaIqxJnOXI8Ya2YM80tt44vzUgZsiery6N+Ufs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=oHfceSDu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="oHfceSDu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10042C4CEF7; Sat, 21 Feb 2026 20:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1771704205; bh=Dst4ZoBeK8k4SD4aAc7AJn/DrAZ5s0FLKzeC4RG5qJo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oHfceSDuSazniqoDygl50AjSKNdiVkhKB6OyisfwpxnvMdMak3xlNqCL7ZLSzgaLG vQuC0KkivuvidBnlTF6KL8SG6bdlJ8g5Va8yg7I1QJeU7eaX4gnLVfkGXy50K8HYz4 Q3R4rrGshPm7igYEUM4FRm4fqe7xhRnYaLIYPVT8= Date: Sat, 21 Feb 2026 12:03:24 -0800 From: Andrew Morton To: Rio Cc: feng.tang@linux.alibaba.com, joel.granados@kernel.org, linux-kernel@vger.kernel.org, pmladek@suse.com, pnina.feder@mobileye.com, wangjinchao600@gmail.com Subject: Re: [PATCH] kernel/panic: increase buffer size for verbose taint logging Message-Id: <20260221120324.aefaf060faa571e55c30b465@linux-foundation.org> In-Reply-To: <20260221065603.24754-1-rioo.tsukatsukii@gmail.com> References: <20260220130643.cd980ab5593e36f84fa72034@linux-foundation.org> <20260221065603.24754-1-rioo.tsukatsukii@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Sat, 21 Feb 2026 12:26:03 +0530 Rio wrote: > > "accommodate". I'll fix this. > > Thanks > > > How does this look? > > > + * > > + * Also, update TAINT_BUF_MAX below. > > */ > > ... > > -/* 350 can accomadate all taint flags in verbose mode, with some headroom */ > > +/* 350 can accommodate all taint flags in verbose mode, with some headroom */ > > #define TAINT_BUF_MAX 350 > > Looks good, though it might help future maintainers if we document the current > maximum length of the verbose string (excluding the trailing NULL). Happy to > send a small follow-up patch if needed. OK, how about this idea. - Allocating static storage is annoying: dynamic allocation is better - Now knowing how large to make the storage is also annoying. So: - define a static buffer, mark it __initdata so it gets released later in boot. Make print_tainted() use that, initially, so print_tainted() is available at initial bootup time. - write a new __init function which adds up all string lengths in taint_flags[] and calculates the precise maximum needed buffer size. Allocate that much memory (kmalloc) and switch print_tainted() over to using that buffer. - When __init data gets released, the initial static buffer and the new __init function get thrown away.