From: David Miller <davem@davemloft.net>
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org,
marcelo.leitner@gmail.com, nhorman@tuxdriver.com,
syzkaller@googlegroups.com
Subject: Re: [PATCH net] sctp: initialize _pad of sockaddr_in before copying to user memory
Date: Mon, 01 Apr 2019 18:09:16 -0700 (PDT) [thread overview]
Message-ID: <20190401.180916.964654086564122108.davem@davemloft.net> (raw)
In-Reply-To: <b4aeae8a46f4dcddcfddb0ba3943abda3413f142.1554022695.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 31 Mar 2019 16:58:15 +0800
> Syzbot report a kernel-infoleak:
>
> BUG: KMSAN: kernel-infoleak in _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
> Call Trace:
> _copy_to_user+0x16b/0x1f0 lib/usercopy.c:32
> copy_to_user include/linux/uaccess.h:174 [inline]
> sctp_getsockopt_peer_addrs net/sctp/socket.c:5911 [inline]
> sctp_getsockopt+0x1668e/0x17f70 net/sctp/socket.c:7562
> ...
> Uninit was stored to memory at:
> sctp_transport_init net/sctp/transport.c:61 [inline]
> sctp_transport_new+0x16d/0x9a0 net/sctp/transport.c:115
> sctp_assoc_add_peer+0x532/0x1f70 net/sctp/associola.c:637
> sctp_process_param net/sctp/sm_make_chunk.c:2548 [inline]
> sctp_process_init+0x1a1b/0x3ed0 net/sctp/sm_make_chunk.c:2361
> ...
> Bytes 8-15 of 16 are uninitialized
>
> It was caused by that th _pad field (the 8-15 bytes) of a v4 addr (saved in
> struct sockaddr_in) wasn't initialized, but directly copied to user memory
> in sctp_getsockopt_peer_addrs().
>
> So fix it by calling memset(addr->v4.sin_zero, 0, 8) to initialize _pad of
> sockaddr_in before copying it to user memory in sctp_v4_addr_to_user(), as
> sctp_v6_addr_to_user() does.
>
> Reported-by: syzbot+86b5c7c236a22616a72f@syzkaller.appspotmail.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied and queued up for -stable, thanks Xin!
prev parent reply other threads:[~2019-04-02 1:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-31 8:58 [PATCH net] sctp: initialize _pad of sockaddr_in before copying to user memory Xin Long
2019-04-01 8:43 ` Alexander Potapenko
2019-04-01 21:02 ` Neil Horman
2019-04-02 1:09 ` David Miller [this message]
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=20190401.180916.964654086564122108.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=syzkaller@googlegroups.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).