From: Dominique Martinet <asmadeus@codewreck.org>
To: Tom Herbert <tom@quantonium.net>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: KCM - recvmsg() mangles packets?
Date: Sun, 5 Aug 2018 16:12:53 +0200 [thread overview]
Message-ID: <20180805141253.GA22780@nautica> (raw)
In-Reply-To: <20180805064410.GA26807@nautica>
Dominique Martinet wrote on Sun, Aug 05, 2018:
> (I'm not sure about offset, since we pass the full skb to parse message,
> wouldn't it look at the start of the buffer everytime? Well, offset
> seems to be 0 everytime the first time that check fails so I can
> probably ignore that for now...)
Oh, this might actually not have been such a bad remark; if I have the
client write two "messages" in a single write() kcm seems to reliably
fail the same way...
Conversely, if I setsockopt(s, IPPROTO_TCP, TCP_NODELAY...) on the
sender socket, *and* make it wait till the kcm socket has been created
to start sending data, then it dramatically reduces the probability of
this happening (I had to let the reproducer run in a loop for 5 minutes,
wheras it used to happen within seconds).
So I think the problem is packet aggregation, and strparser not handling
that properly... The first packet still fails with TCP_NODELAY but
there's probably aggregation on the recv side as well before the socket
is attached to the multiplexor... I guess the low probability failure
that is still happening could be similar.
(I also noticed that I've mistakedly believed that the problem was the
first packet contained the 2nd packet's data because of an off-by-one in
the receiver, it really is the second packet, it only has the first
packet's length)
I've moved my check from kcm_rcv_strparser to just before parse_msg in
__strp_recv and surely enough it fails everytime there's an offset.
It's getting late but I'll try adding a pskb_pull in there tomorrow, it
would be better to make the bpf program start with an offset but I don't
think that'll be easy to change...
I'm almost done spamming, thanks for being a good rubber duck! :p
--
Dominique Martinet
next prev parent reply other threads:[~2018-08-05 16:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 18:28 KCM - recvmsg() mangles packets? Dominique Martinet
2018-08-03 22:46 ` Tom Herbert
2018-08-03 23:20 ` Dominique Martinet
2018-08-04 1:18 ` Tom Herbert
2018-08-04 1:41 ` Dominique Martinet
2018-08-04 2:08 ` Dominique Martinet
2018-08-05 6:44 ` Dominique Martinet
2018-08-05 14:12 ` Dominique Martinet [this message]
2018-08-05 23:39 ` Dominique Martinet
2018-08-09 20:58 ` Tom Herbert
2018-08-09 22:06 ` Dominique Martinet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180805141253.GA22780@nautica \
--to=asmadeus@codewreck.org \
--cc=netdev@vger.kernel.org \
--cc=tom@quantonium.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox