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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4dwhhlnuv2n3f7d3hqoulcnsg6ljucd6v47kqcszcwcshfoqno@rzxvg456q4fi>
Date: Wed, 7 Jan 2026 08:58:39 -0800
From: Breno Leitao <leitao@...ian.org>
To: John Ogness <john.ogness@...utronix.de>
Cc: pmladek@...e.com, mpdesouza@...e.com, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, asantostc@...il.com, efault@....de, gustavold@...il.com, 
	calvin@...nvd.org, jv@...sburgh.net, kernel-team@...a.com, 
	Simon Horman <horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, rostedt@...dmis.org
Subject: Re: [PATCH net-next 0/2] net: netconsole: convert to NBCON console
 infrastructure

Hi John,

On Wed, Jan 07, 2026 at 04:56:41PM +0106, John Ogness wrote:
> On 2026-01-07, Breno Leitao <leitao@...ian.org> wrote:
> > Upon reviewing the printk subsystem, I noticed that struct
> > printk_info->caller_id stores similar information, but not exactly the
> > same. It contains either the CPU *or* the task, not both, and this data
> > isn't easily accessible from within the ->write_thread() context. 
> >
> > One possible solution that comes to my mind is to pass both the CPU ID
> > and the task_struct/vpid to struct printk_info, and then integrate this
> > into struct nbcon_write_context *wctxt somehow.
> >
> > This way, netconsole could reliably query the original CPU and task that
> > generated the message, regardless of where the netconsole code is
> > executed.
> 
> But by the time the printer is active, that task may no longer exist,
> may have migrated to a different CPU and/or may be sleeping.
> 
> IIUC, basically you want to attach console-specific additional
> information to ringbuffer records, but only that specific console should
> see/use the additional information. In this case it could be up to 4+16
> additional bytes (depending on @sysdata_fields).
> 
> A while ago we had a discussion[0] about adding custom

Thanks for sharing that discussion link—very helpful context!

> information. There I even went so far as to suggest supporting things
> like a new boot argument:
> 
>     printk.format=ts,cpu,comm,pid,in_atomic
>
> (which could also be console-specific)

This is essentially what we ended up implementing in netconsole.

Netconsole makes this straightforward and efficient since I don't need to worry
about ring buffer space. The approach is simple: receive the char *msg, copy it
to a bounce buffer, append raw_smp_processor_id(), current->comm, etc., send
the packet, and free the buffer. No impact on the ring buffer or other side
effects.

> The result of the discussion was killing off dictionaries (that allowed
> variable length custom data) and replacing them with the dev_printk_info
> struct.
> 
> I am just pointing out that this kind of discussion has existed in the
> past and not suggesting that we should reintroduce dictionaries.
> 
> A simple fix could be to add an extra 36-byte struct to both
> dev_printk_info and nbcon_write_context that exists conditionally on
> CONFIG_NETCONSOLE_DYNAMIC.

I believe we can achieve this with less than 36 bytes per entry. Taking
inspiration from printk_caller_id(), we could store both the PID and
smp_processor_id() more compactly, 8 bytes total ?!

Something like the following should address netconsole's needs:

	diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
	index eb2094e43050..908cb891af0d 100644
	--- a/include/linux/dev_printk.h
	+++ b/include/linux/dev_printk.h
	@@ -27,6 +27,10 @@ struct device;
	struct dev_printk_info {
		char subsystem[PRINTK_INFO_SUBSYSTEM_LEN];
		char device[PRINTK_INFO_DEVICE_LEN];
	+#ifdef CONFIG_DEV_PRINTK_ENRICHED_CTX 		/* Something that I can select when CONFIG_NETCONSOLE_DYNAMIC is selected */
	+       pid_t pid;
	+       int cpu;
	+#endif
	};

> vprintk_store() would set the extra data to dev_printk_info.
> 
> nbcon_emit_next_record() would copy the data to nbcon_write_context.

Thanks. Let me prototype this and see how it turns out.
--breno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ