Thread (4 messages) flat view 4 messages, 2 authors, 4d ago

Re: [PATCH iproute2 1/2] ss: validate sscanf() return value in packet_show_line()

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2026-09-01 13:45:56

On Mon, 31 Aug 2026 10:41:15 +0000
Prabhakar Pujeri [off-list ref] wrote:
The /proc/net/packet fallback parser never checks the return value of
sscanf().  On a malformed or truncated line some of the output
variables (type, prot, iface, state, rq, uid, ino) stay
uninitialized and garbage values are used both for type based
filtering and for the printed socket state.

Require all eight fields to be converted before using the values and
return -1 on failure, which makes generic_record_read() stop
processing, the same way tcp_show_line() bails out on a malformed
/proc/net/tcp line.

Fixes: aba5acdfdb34 ("(Logical change 1.3)")
Signed-off-by: Prabhakar Pujeri <redacted>
---
Good to check but if kernel gives garbage, kernel is seriously buggy.

I am thinking it would be best to just remove /proc fallback stuff.
It only exists to handle really old systems before netlink diag info
was supported; or embedded hardware kernel configs without netlink diag info.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help