All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, Martin Lau <kafai@fb.com>,
	Yonghong Song <yhs@fb.com>,
	"David S. Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 9/9] udpv6: Check address length before reading address family
Date: Fri, 12 Apr 2019 16:07:38 +0000	[thread overview]
Message-ID: <E3FF43AC-1956-4CD7-97CA-7ECB6E5300C3@fb.com> (raw)
In-Reply-To: <1555066599-9698-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp>



> On Apr 12, 2019, at 3:56 AM, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:
> 
> KMSAN will complain if valid address length passed to udpv6_pre_connect()
> is shorter than sizeof("struct sockaddr"->sa_family) bytes.
> 
> (This patch is bogus if it is guaranteed that udpv6_pre_connect() is
> always called after checking "struct sockaddr"->sa_family. In that case,
> we want a comment why we don't need to check valid address length here.)
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Looks good. 

Acked-by: Song Liu <songliubraving@fb.com>


> ---
> net/ipv6/udp.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index d538fafaf4a9..2464fba569b4 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1045,6 +1045,8 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
> static int udpv6_pre_connect(struct sock *sk, struct sockaddr *uaddr,
> 			     int addr_len)
> {
> +	if (addr_len < offsetofend(struct sockaddr, sa_family))
> +		return -EINVAL;
> 	/* The following checks are replicated from __ip6_datagram_connect()
> 	 * and intended to prevent BPF program called below from accessing
> 	 * bytes that are out of the bound specified by user in addr_len.
> -- 
> 2.16.5
> 


  reply	other threads:[~2019-04-12 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 10:56 [PATCH 9/9] udpv6: Check address length before reading address family Tetsuo Handa
2019-04-12 16:07 ` Song Liu [this message]
2019-04-12 16:49 ` Andrey Ignatov
2019-04-13  2:06   ` Tetsuo Handa
2019-04-12 17:26 ` David Miller

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=E3FF43AC-1956-4CD7-97CA-7ECB6E5300C3@fb.com \
    --to=songliubraving@fb.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.