netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Jordan Rife <jrife@google.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	 netdev@vger.kernel.org
Cc: dborkman@kernel.org, stable@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>,
	 Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH net v4 2/3] net: prevent rewrite of msg_name in sock_sendmsg()
Date: Thu, 21 Sep 2023 10:32:16 +0200	[thread overview]
Message-ID: <139933c6013e444047dc685ade53fa3dc1ad68d3.camel@redhat.com> (raw)
In-Reply-To: <650af39492a56_37ac7329469@willemb.c.googlers.com.notmuch>

On Wed, 2023-09-20 at 09:28 -0400, Willem de Bruijn wrote:
> Jordan Rife wrote:
> > Callers of sock_sendmsg(), and similarly kernel_sendmsg(), in kernel
> > space may observe their value of msg_name change in cases where BPF
> > sendmsg hooks rewrite the send address. This has been confirmed to break
> > NFS mounts running in UDP mode and has the potential to break other
> > systems.
> > 
> > This patch:
> > 
> > 1) Creates a new function called __sock_sendmsg() with same logic as the
> >    old sock_sendmsg() function.
> > 2) Replaces calls to sock_sendmsg() made by __sys_sendto() and
> >    __sys_sendmsg() with __sock_sendmsg() to avoid an unnecessary copy,
> >    as these system calls are already protected.
> > 3) Modifies sock_sendmsg() so that it makes a copy of msg_name if
> >    present before passing it down the stack to insulate callers from
> >    changes to the send address.
> > 
> > Link: https://lore.kernel.org/netdev/20230912013332.2048422-1-jrife@google.com/
> > Fixes: 1cedee13d25a ("bpf: Hooks for sys_sendmsg")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jordan Rife <jrife@google.com>
> 
> Reviewed-by: Willem de Bruijn <willemb@google.com>

CC Jens and Pavel, as I guess io_uring likely want to use
__sock_sendmsg(), in a follow-up patch.

Cheers,

Paolo


  reply	other threads:[~2023-09-21 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 17:52 [PATCH net v4 2/3] net: prevent rewrite of msg_name in sock_sendmsg() Jordan Rife
2023-09-20 13:28 ` Willem de Bruijn
2023-09-21  8:32   ` Paolo Abeni [this message]
2023-09-21 12:30     ` Pavel Begunkov

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=139933c6013e444047dc685ade53fa3dc1ad68d3.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dborkman@kernel.org \
    --cc=edumazet@google.com \
    --cc=jrife@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).