public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: dhowells@redhat.com, netdev@vger.kernel.org,
	syzbot+f527b971b4bdc8e79f9e@syzkaller.appspotmail.com,
	bpf@vger.kernel.org, brauner@kernel.org, davem@davemloft.net,
	dsahern@kernel.org, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, axboe@kernel.dk, viro@zeniv.linux.org.uk,
	linux-fsdevel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] udp: Fix __ip_append_data()'s handling of MSG_SPLICE_PAGES
Date: Tue, 01 Aug 2023 17:57:40 +0100	[thread overview]
Message-ID: <1481564.1690909060@warthog.procyon.org.uk> (raw)
In-Reply-To: <64c93109c084e_1c5e3529452@willemb.c.googlers.com.notmuch>

Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote:

> copy -= -fraggap definitely seems off. You point out that it even can
> turn length negative?

Yes.  See the logging I posted:

	==>splice_to_socket() 6630
	udp_sendmsg(8,8)
	__ip_append_data(copy=-1,len=8, mtu=8192 skblen=8189 maxfl=8188)
	pagedlen 9 = 9 - 0
	copy -1 = 9 - 0 - 1 - 9
	length 8 -= -1 + 0

Since datalen and transhdrlen cancel, and fraggap is unsigned, if fraggap is
non-zero, copy will be negative.

> The WARN_ON_ONCE, if it can be reached, will be user triggerable.
> Usually for those cases and when there is a viable return with error
> path, that is preferable. But if you prefer to taunt syzbot, ok. We
> can always remove this later.

It shouldn't be possible for length to exceed msg->msg_iter.count (assuming
there is a msg) coming from userspace; further, userspace can't directly
specify MSG_SPLICE_PAGES.

> __ip6_append_data probably needs the same.

Good point.  The arrangement of the code is a bit different, but I think it's
substantially the same in this regard.

David


  reply	other threads:[~2023-08-01 16:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 15:48 [PATCH net] udp: Fix __ip_append_data()'s handling of MSG_SPLICE_PAGES David Howells
2023-08-01 16:21 ` Willem de Bruijn
2023-08-01 16:57   ` David Howells [this message]
2023-08-01 20:11   ` David Howells
2023-08-01 21:11     ` Willem de Bruijn
2023-08-02 14:27 ` Willem de Bruijn
2023-08-03  2:30 ` patchwork-bot+netdevbpf

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=1481564.1690909060@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+f527b971b4bdc8e79f9e@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willemdebruijn.kernel@gmail.com \
    /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