Thread (7 messages) flat view 7 messages, 3 authors, 2015-10-19

Re: [PATCH] netlink: trim skb to exact size to avoid MSG_TRUNC

From: Thomas Graf <tgraf@suug.ch>
Date: 2015-10-13 08:56:03

On 10/12/15 at 06:15pm, Ronen Arad wrote:
The available room in the skb allocated in netlink_dump for iproute2
show requests (e.g. "ip link [show]", "bridge [-c] vlan show") should
be trimmed to the exact size requested in order to avoid MSG_TRUNC flag
set in netlink_recvmg.
This was handled properly for small skb allocated when no interface has
many VLANs configured. This patch applies the same logic to larger skbs
which are allocated using the calculated min_dump_alloc size.

Signed-off-by: Ronen Arad <redacted>
Wouldn't this imply a bug in which rtnl_calcit() does not account for
some data that is later dumped? How else could the skb end up being
larger than what alloc_size accounts for at this point unless we end
up stuffing 2x smallish messages into the padded projection of the
calculated maximum message size of that type. Is that what you are
seeing?

Regardless of that, alloc_size is likely larger than nlk->max_recvmsg_len
anyway at this point so unless the reader suddenly provides a different
message size or does peeking it will likely still be truncated.

I'm just trying to understand which exact case you are solving here.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help