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 2123027603F for ; Fri, 20 Feb 2026 21:06:44 +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=1771621605; cv=none; b=AX6Cf/fYDDWQc7qA57TJ58BJ6flT0kNflfTwP/rO8n9UEgmHNZA6ebhoK60pwMNeKuhhsxjzpECEu6DKUde/7CvD9/W5+hLh41JVcJfc4JPxJcTREQZENka4vKIjBsojcwgOt+cBWhh39UbMTEXjRv4Kcqyw7WAhq33Qwr/EJGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771621605; c=relaxed/simple; bh=J47OizD76oTogPGhkAXzd64mRZ2wTOIsMe72Jo/bolI=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=UZexMoJgyndh04SDkcprYUYi3lGDb08hPRnDXRw+NRPks86BlNhRjB8XHgccVpfyl9EwhGNqKPxsvZFAxObcGmaDSKdDBbSEtpFjYx5nmbhXXnTvQp6utYUaxBzvJvySIRUQP15Taz4p5FqafTnz+QbCnbE8G90rdZsKi9sVPl0= 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=BP115mHt; 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="BP115mHt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A8F0C116C6; Fri, 20 Feb 2026 21:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1771621604; bh=J47OizD76oTogPGhkAXzd64mRZ2wTOIsMe72Jo/bolI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BP115mHtFH+Eoukhjp0JURATdC6PAH/CFRchKX+uVwyOtAqy6yLk0VZGQcDS3C2rs bxsoAfSNBEysQGedN1mCT/yvwJiqj10tiUTIIXnlyt2Gd6lxJqD6EoiSwxOptyy+ra zdbAU607PN5VrNydxi7WeAaWwx6n16dDDHP1BSFk= Date: Fri, 20 Feb 2026 13:06:43 -0800 From: Andrew Morton To: Rio Cc: Feng Tang , Petr Mladek , Jinchao Wang , Joel Granados , Pnina Feder , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel/panic: increase buffer size for verbose taint logging Message-Id: <20260220130643.cd980ab5593e36f84fa72034@linux-foundation.org> In-Reply-To: <20260220151500.13585-1-rioo.tsukatsukii@gmail.com> References: <20260220151500.13585-1-rioo.tsukatsukii@gmail.com> X-Mailer: Sylpheed 3.7.0 (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 Fri, 20 Feb 2026 20:45:00 +0530 Rio wrote: > The verbose 'Tainted: ...' string in print_tainted_seq > can total to 327 characters while the buffer defined in > _print_tainted is 320 bytes. Increase its size to 350 > characters to hold all flags, along with some headroom. > > ... > > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -854,10 +854,12 @@ static void print_tainted_seq(struct seq_buf *s, bool verbose) > } > } > > +/* 350 can accomadate all taint flags in verbose mode, with some headroom */ "accommodate". I'll fix this. > +#define TAINT_BUF_MAX 350 > + > static const char *_print_tainted(bool verbose) > { > - /* FIXME: what should the size be? */ > - static char buf[sizeof(taint_flags)]; Well that was weird. > + static char buf[TAINT_BUF_MAX]; Can you think of a way to do this more flexibly? Something which scales as we add more flags? Probably not, as it's dependent upon the length of the various taint_flags.desc strings. > struct seq_buf s; > > BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT); How does this look? --- a/kernel/panic.c~kernel-panic-increase-buffer-size-for-verbose-taint-logging-fix +++ a/kernel/panic.c @@ -801,6 +801,8 @@ EXPORT_SYMBOL(panic); * Documentation/admin-guide/tainted-kernels.rst, including its * small shell script that prints the TAINT_FLAGS_COUNT bits of * /proc/sys/kernel/tainted. + * + * Also, update TAINT_BUF_MAX below. */ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { TAINT_FLAG(PROPRIETARY_MODULE, 'P', 'G'), @@ -854,7 +856,7 @@ static void print_tainted_seq(struct seq } } -/* 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 static const char *_print_tainted(bool verbose) _