<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/net/netconsole.c, branch linux-6.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-03-04T12:20:49Z</updated>
<entry>
<title>netconsole: avoid OOB reads, msg is not nul-terminated</title>
<updated>2026-03-04T12:20:49Z</updated>
<author>
<name>Jakub Kicinski</name>
</author>
<published>2026-02-19T19:50:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3126a2f98beaec5a554a1fb31c46db1e8542665e'/>
<id>urn:sha1:3126a2f98beaec5a554a1fb31c46db1e8542665e</id>
<content type='text'>
[ Upstream commit 82aec772fca2223bc5774bd9af486fd95766e578 ]

msg passed to netconsole from the console subsystem is not guaranteed
to be nul-terminated. Before recent
commit 7eab73b18630 ("netconsole: convert to NBCON console infrastructure")
the message would be placed in printk_shared_pbufs, a static global
buffer, so KASAN had harder time catching OOB accesses. Now we see:

    printk: console [netcon_ext0] enabled
    BUG: KASAN: slab-out-of-bounds in string+0x1f7/0x240
    Read of size 1 at addr ffff88813b6d4c00 by task pr/netcon_ext0/594

    CPU: 65 UID: 0 PID: 594 Comm: pr/netcon_ext0 Not tainted 6.19.0-11754-g4246fd6547c9
    Call Trace:
     kasan_report+0xe4/0x120
     string+0x1f7/0x240
     vsnprintf+0x655/0xba0
     scnprintf+0xba/0x120
     netconsole_write+0x3fe/0xa10
     nbcon_emit_next_record+0x46e/0x860
     nbcon_kthread_func+0x623/0x750

    Allocated by task 1:
     nbcon_alloc+0x1ea/0x450
     register_console+0x26b/0xe10
     init_netconsole+0xbb0/0xda0

    The buggy address belongs to the object at ffff88813b6d4000
                which belongs to the cache kmalloc-4k of size 4096
    The buggy address is located 0 bytes to the right of
                allocated 3072-byte region [ffff88813b6d4000, ffff88813b6d4c00)

Fixes: c62c0a17f9b7 ("netconsole: Append kernel version to message")
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20260219195021.2099699-1-kuba@kernel.org
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: Acquire su_mutex before navigating configs hierarchy</title>
<updated>2025-11-01T00:45:06Z</updated>
<author>
<name>Gustavo Luiz Duarte</name>
</author>
<published>2025-10-29T20:50:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7d2fcf7ae31471b4e08b7e448b8fd0ec2e06a1b'/>
<id>urn:sha1:d7d2fcf7ae31471b4e08b7e448b8fd0ec2e06a1b</id>
<content type='text'>
There is a race between operations that iterate over the userdata
cg_children list and concurrent add/remove of userdata items through
configfs. The update_userdata() function iterates over the
nt-&gt;userdata_group.cg_children list, and count_extradata_entries() also
iterates over this same list to count nodes.

Quoting from Documentation/filesystems/configfs.rst:
&gt; A subsystem can navigate the cg_children list and the ci_parent pointer
&gt; to see the tree created by the subsystem.  This can race with configfs'
&gt; management of the hierarchy, so configfs uses the subsystem mutex to
&gt; protect modifications.  Whenever a subsystem wants to navigate the
&gt; hierarchy, it must do so under the protection of the subsystem
&gt; mutex.

Without proper locking, if a userdata item is added or removed
concurrently while these functions are iterating, the list can be
accessed in an inconsistent state. For example, the list_for_each() loop
can reach a node that is being removed from the list by list_del_init()
which sets the nodes' .next pointer to point to itself, so the loop will
never end (or reach the WARN_ON_ONCE in update_userdata() ).

Fix this by holding the configfs subsystem mutex (su_mutex) during all
operations that iterate over cg_children.
This includes:
- userdatum_value_store() which calls update_userdata() to iterate over
  cg_children
- All sysdata_*_enabled_store() functions which call
  count_extradata_entries() to iterate over cg_children

The su_mutex must be acquired before dynamic_netconsole_mutex to avoid
potential lock ordering issues, as configfs operations may already hold
su_mutex when calling into our code.

Fixes: df03f830d099 ("net: netconsole: cache userdata formatted string in netconsole_target")
Signed-off-by: Gustavo Luiz Duarte &lt;gustavold@gmail.com&gt;
Link: https://patch.msgid.link/20251029-netconsole-fix-warn-v1-1-0d0dd4622f48@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: Fix race condition in between reader and writer of userdata</title>
<updated>2025-10-30T00:41:00Z</updated>
<author>
<name>Gustavo Luiz Duarte</name>
</author>
<published>2025-10-28T22:06:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=00764aa5c9bbb2044eb04d6d78584a436666b231'/>
<id>urn:sha1:00764aa5c9bbb2044eb04d6d78584a436666b231</id>
<content type='text'>
The update_userdata() function constructs the complete userdata string
in nt-&gt;extradata_complete and updates nt-&gt;userdata_length. This data
is then read by write_msg() and write_ext_msg() when sending netconsole
messages. However, update_userdata() was not holding target_list_lock
during this process, allowing concurrent message transmission to read
partially updated userdata.

This race condition could result in netconsole messages containing
incomplete or inconsistent userdata - for example, reading the old
userdata_length with new extradata_complete content, or vice versa,
leading to truncated or corrupted output.

Fix this by acquiring target_list_lock with spin_lock_irqsave() before
updating extradata_complete and userdata_length, and releasing it after
both fields are fully updated. This ensures that readers see a
consistent view of the userdata, preventing corruption during concurrent
access.

The fix aligns with the existing locking pattern used throughout the
netconsole code, where target_list_lock protects access to target
fields including buf[] and msgcounter that are accessed during message
transmission.

Also get rid of the unnecessary variable complete_idx, which makes it
easier to bail out of update_userdata().

Fixes: df03f830d099 ("net: netconsole: cache userdata formatted string in netconsole_target")
Signed-off-by: Gustavo Luiz Duarte &lt;gustavold@gmail.com&gt;
Link: https://patch.msgid.link/20251028-netconsole-fix-race-v4-1-63560b0ae1a0@meta.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: use netpoll_parse_ip_addr in local_ip_store</title>
<updated>2025-08-13T00:32:42Z</updated>
<author>
<name>Breno Leitao</name>
</author>
<published>2025-08-11T18:13:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4aeb452c237afa6d7e8d09185bca6e34454ca333'/>
<id>urn:sha1:4aeb452c237afa6d7e8d09185bca6e34454ca333</id>
<content type='text'>
Replace manual IP address parsing with a call to netpoll_parse_ip_addr
in remote_ip_store(), simplifying the code and reducing the chance of
errors.

The error message got removed, since it is not a good practice to
pr_err() if used pass a wrong value in configfs.

Signed-off-by: Breno Leitao &lt;leitao@debian.org&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: use netpoll_parse_ip_addr in local_ip_store</title>
<updated>2025-08-13T00:32:42Z</updated>
<author>
<name>Breno Leitao</name>
</author>
<published>2025-08-11T18:13:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=60cb69214148fbe7fc50239c28e4d052eec6ae61'/>
<id>urn:sha1:60cb69214148fbe7fc50239c28e4d052eec6ae61</id>
<content type='text'>
Replace manual IP address parsing with a call to netpoll_parse_ip_addr
in local_ip_store(), simplifying the code and reducing the chance of
errors.

Also, remove the pr_err() if the user enters an invalid value in
configfs entries. pr_err() is not the best way to alert user that the
configuration is invalid.

Signed-off-by: Breno Leitao &lt;leitao@debian.org&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: add support for strings with new line in netpoll_parse_ip_addr</title>
<updated>2025-08-13T00:32:42Z</updated>
<author>
<name>Breno Leitao</name>
</author>
<published>2025-08-11T18:13:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=364213b736e313fab963b272ebe5a2ffeb888831'/>
<id>urn:sha1:364213b736e313fab963b272ebe5a2ffeb888831</id>
<content type='text'>
The current IP address parsing logic fails when the input string
contains a trailing newline character. This can occur when IP
addresses are provided through configfs, which contains newlines in
a const buffer.

Teach netpoll_parse_ip_addr() how to ignore newlines at the end of the
IPs. Also, simplify the code by:

 * No need to check for separators. Try to parse ipv4, if it fails try
   ipv6 similarly to ceph_pton()
 * If ipv6 is not supported, don't call in6_pton() at all.

Signed-off-by: Breno Leitao &lt;leitao@debian.org&gt;
Link: https://patch.msgid.link/20250811-netconsole_ref-v4-2-9c510d8713a2@debian.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: move netpoll_parse_ip_addr() earlier for reuse</title>
<updated>2025-08-13T00:32:42Z</updated>
<author>
<name>Breno Leitao</name>
</author>
<published>2025-08-11T18:13:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa38524ca5a783aa0cfc8ffa5730c5012edfccf4'/>
<id>urn:sha1:fa38524ca5a783aa0cfc8ffa5730c5012edfccf4</id>
<content type='text'>
Move netpoll_parse_ip_addr() earlier in the file to be reused in
other functions, such as local_ip_store(). This avoids duplicate
address parsing logic and centralizes validation for both IPv4
and IPv6 string input.

No functional changes intended.

Signed-off-by: Breno Leitao &lt;leitao@debian.org&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20250811-netconsole_ref-v4-1-9c510d8713a2@debian.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>netconsole: append msgid to sysdata</title>
<updated>2025-06-18T09:46:10Z</updated>
<author>
<name>Gustavo Luiz Duarte</name>
</author>
<published>2025-06-16T17:08:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c5efaabd45ad1c93679c2529f778569cb2b828c6'/>
<id>urn:sha1:c5efaabd45ad1c93679c2529f778569cb2b828c6</id>
<content type='text'>
Add msgcounter to the netconsole_target struct to generate message IDs.
If the msgid_enabled attribute is true, increment msgcounter and append
msgid=&lt;msgcounter&gt; to sysdata buffer before sending the message.

Signed-off-by: Gustavo Luiz Duarte &lt;gustavold@gmail.com&gt;
Reviewed-by: Breno Leitao &lt;leitao@debian.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netconsole: implement configfs for msgid_enabled</title>
<updated>2025-06-18T09:46:10Z</updated>
<author>
<name>Gustavo Luiz Duarte</name>
</author>
<published>2025-06-16T17:08:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=53def0c4c857d18b553c68b30df13d9229726809'/>
<id>urn:sha1:53def0c4c857d18b553c68b30df13d9229726809</id>
<content type='text'>
Implement the _show and _store functions for the msgid_enabled configfs
attribute under userdata.
Set the sysdata_fields bit accordingly.

Reviewed-by: Breno Leitao &lt;leitao@debian.org&gt;
Signed-off-by: Gustavo Luiz Duarte &lt;gustavold@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netconsole: introduce 'msgid' as a new sysdata field</title>
<updated>2025-06-18T09:46:10Z</updated>
<author>
<name>Gustavo Luiz Duarte</name>
</author>
<published>2025-06-16T17:08:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=15b3c930a29fe00971b52af8b87b1a1d67305190'/>
<id>urn:sha1:15b3c930a29fe00971b52af8b87b1a1d67305190</id>
<content type='text'>
This adds a new sysdata field to enable assigning a per-target unique id
to each message sent to that target. This id can later be appended as
part of sysdata, allowing targets to detect dropped netconsole messages.
Update count_extradata_entries() to take the new field into account.

Reviewed-by: Breno Leitao &lt;leitao@debian.org&gt;
Signed-off-by: Gustavo Luiz Duarte &lt;gustavold@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
