lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 12 Apr 2019 16:07:38 +0000
From:   Song Liu <songliubraving@...com>
To:     Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
CC:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>,
        "David S. Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 9/9] udpv6: Check address length before reading address
 family



> On Apr 12, 2019, at 3:56 AM, Tetsuo Handa <penguin-kernel@...ove.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@...ove.SAKURA.ne.jp>

Looks good. 

Acked-by: Song Liu <songliubraving@...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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ