linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] netconsole: Fix userdata race condition
@ 2025-10-20 21:22 Gustavo Luiz Duarte
  2025-10-20 21:22 ` [PATCH net 1/2] selftests: netconsole: Add race condition test for userdata corruption Gustavo Luiz Duarte
  2025-10-20 21:22 ` [PATCH net 2/2] netconsole: Fix race condition in between reader and writer of userdata Gustavo Luiz Duarte
  0 siblings, 2 replies; 6+ messages in thread
From: Gustavo Luiz Duarte @ 2025-10-20 21:22 UTC (permalink / raw)
  To: Breno Leitao, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, Matthew Wood
  Cc: linux-kernel, netdev, linux-kselftest, Gustavo Luiz Duarte

This series fixes a race condition in netconsole's userdata handling
where concurrent message transmission could read partially updated
userdata fields, resulting in corrupted netconsole output.

The first patch adds a selftest that reproduces the race condition by
continuously sending messages while rapidly changing userdata values,
detecting any torn reads in the output.

The second patch fixes the issue by ensuring update_userdata() holds
the target_list_lock while updating both extradata_complete and
userdata_length, preventing readers from seeing inconsistent state.

This targets net tree as it fixes a bug introduced in commit df03f830d099
("net: netconsole: cache userdata formatted string in netconsole_target").

Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
Gustavo Luiz Duarte (2):
      selftests: netconsole: Add race condition test for userdata corruption
      netconsole: Fix race condition in between reader and writer of userdata

 drivers/net/netconsole.c                           |  5 ++
 .../selftests/drivers/net/netcons_race_userdata.sh | 87 ++++++++++++++++++++++
 2 files changed, 92 insertions(+)
---
base-commit: ffff5c8fc2af2218a3332b3d5b97654599d50cde
change-id: 20251020-netconsole-fix-race-f465f37b57ea

Best regards,
-- 
Gustavo Luiz Duarte <gustavold@gmail.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-22 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 21:22 [PATCH net 0/2] netconsole: Fix userdata race condition Gustavo Luiz Duarte
2025-10-20 21:22 ` [PATCH net 1/2] selftests: netconsole: Add race condition test for userdata corruption Gustavo Luiz Duarte
2025-10-20 23:14   ` Andre Carvalho
2025-10-22 15:31     ` Gustavo Luiz Duarte
2025-10-20 21:22 ` [PATCH net 2/2] netconsole: Fix race condition in between reader and writer of userdata Gustavo Luiz Duarte
2025-10-21 10:04   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).