linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: syzbot
	<bot+2357afb48acb76780f3c18867ccfb7aa6fd6c4c9@syzkaller.appspotmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>, Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	syzkaller-bugs@googlegroups.com,
	David Windsor <dave@nullcore.net>
Subject: Re: WARNING in __check_heap_object
Date: Wed, 8 Nov 2017 11:02:25 -0800	[thread overview]
Message-ID: <CAGXu5jLj2NZEhwR_kpuAnJdChmE3V5fMS3Ry9FnncL5XdxVJkA@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+bkTWRcrun95FbfiJseJjzt9z7JXONVJ9N2Hqo1-8yVuA@mail.gmail.com>

On Wed, Nov 8, 2017 at 12:23 AM, Dmitry Vyukov <dvyukov@google.com> wrote:
> On Tue, Nov 7, 2017 at 9:35 PM, Kees Cook <keescook@chromium.org> wrote:
>> On Tue, Nov 7, 2017 at 10:36 AM, syzbot
>> <bot+2357afb48acb76780f3c18867ccfb7aa6fd6c4c9@syzkaller.appspotmail.com>
>> wrote:
>>> Hello,
>>>
>>> syzkaller hit the following crash on
>>> 5a3517e009e979f21977d362212b7729c5165d92
>>> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
>>> compiler: gcc (GCC) 7.1.1 20170620
>>> .config is attached
>>> Raw console output is attached.
>>> C reproducer is attached
>>> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
>>> for information about syzkaller reproducers
>>>
>>>
>>
>> Please include the line _before_ the "cut here" (dumb, I know, but
>> that's where warnings show up...)
>>
>> Found in the raw.log:
>>
>> [   44.227177] unexpected usercopy without slab whitelist from SCTPv6
>> offset 1648 size 11
>>
>> This means some part of the SCTPv6 slab was being poked into userspace
>> without a usercopy whitelist.
>>
>>>  check_heap_object mm/usercopy.c:222 [inline]
>>>  __check_object_size+0x22c/0x4f0 mm/usercopy.c:248
>>>  check_object_size include/linux/thread_info.h:112 [inline]
>>>  check_copy_size include/linux/thread_info.h:143 [inline]
>>>  copy_to_user include/linux/uaccess.h:154 [inline]
>>>  sctp_getsockopt_events net/sctp/socket.c:4972 [inline]
>>>  sctp_getsockopt+0x2b90/0x70b0 net/sctp/socket.c:7012
>>>  sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2924
>>>  SYSC_getsockopt net/socket.c:1882 [inline]
>>>  SyS_getsockopt+0x178/0x340 net/socket.c:1864
>>>  entry_SYSCALL_64_fastpath+0x1f/0xbe
>>
>> Looking at the SCTPv6 slab declaration, it seems David and I missed
>> the usercopy whitelist for the sctpv6_sock struct. I'll update the
>> usercopy whitelist patch with:
>>
>> #syz fix: sctp: Define usercopy region in SCTP proto slab cache
>>
>> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
>> index 5fd83974c5cc..8ac85877c0e4 100644
>> --- a/net/sctp/socket.c
>> +++ b/net/sctp/socket.c
>> @@ -8492,6 +8492,10 @@ struct proto sctpv6_prot = {
>>         .unhash         = sctp_unhash,
>>         .get_port       = sctp_get_port,
>>         .obj_size       = sizeof(struct sctp6_sock),
>> +       .useroffset     = offsetof(struct sctp_sock, subscribe),
>> +       .usersize       = offsetof(struct sctp_sock, initmsg) -
>> +                               offsetof(struct sctp_sock, subscribe) +
>> +                               sizeof_field(struct sctp_sock, initmsg),
>>         .sysctl_mem     = sysctl_sctp_mem,
>>         .sysctl_rmem    = sysctl_sctp_rmem,
>>         .sysctl_wmem    = sysctl_sctp_wmem,
>>
>> Thanks!
>
>
> Kees, please also follow this part once the commit reaches any of
> trees (title is settled):
>
>> syzbot will keep track of this bug report.
>> Once a fix for this bug is committed, please reply to this email with:
>> #syz fix: exact-commit-title
>> Note: all commands must start from beginning of the line.
>
> This will greatly help to keep the whole process running and report
> new bugs in future.

I included that in my email reply already, and the commit will be in
-next shortly. (Do you prefer something else?)

-Kees

-- 
Kees Cook
Pixel Security

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-08 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 18:36 WARNING in __check_heap_object syzbot
2017-11-07 19:34 ` Christopher Lameter
2017-11-07 20:35 ` Kees Cook
2017-11-08  8:23   ` Dmitry Vyukov
2017-11-08 19:02     ` Kees Cook [this message]
2017-11-08 19:08       ` Dmitry Vyukov

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=CAGXu5jLj2NZEhwR_kpuAnJdChmE3V5fMS3Ry9FnncL5XdxVJkA@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=bot+2357afb48acb76780f3c18867ccfb7aa6fd6c4c9@syzkaller.appspotmail.com \
    --cc=cl@linux.com \
    --cc=dave@nullcore.net \
    --cc=dvyukov@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=syzkaller-bugs@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).