netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: Baozeng Ding <sploving1@gmail.com>
Cc: Vladislav Yasevich <vyasevich@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	David Miller <davem@davemloft.net>,
	linux-sctp@vger.kernel.org, network dev <netdev@vger.kernel.org>
Subject: Re: net/sctp: BUG: KASAN: stack-out-of-bounds in memcmp
Date: Fri, 14 Oct 2016 19:13:47 +0800	[thread overview]
Message-ID: <CADvbK_emewigJ3pcxy5W4h5UdcA1LtTmFz4Zkqtit6An9OaYpg@mail.gmail.com> (raw)
In-Reply-To: <6843fbba-a11c-8bc4-495a-294dc7fdcc35@gmail.com>

On Sat, Aug 20, 2016 at 3:51 PM, Baozeng Ding <sploving1@gmail.com> wrote:
> Hello all,
> The following program triggers  stack-out-of-bounds in memcmp. The kernel version is 4.8.0-rc1+ (on Aug 13 commit 118253a593bd1c57de2d1193df1ccffe1abe745b). Thanks.
...
>
> #define _GNU_SOURCE
> #include <unistd.h>
> #include <stdint.h>
> #include <sys/socket.h>
> #include <sys/mman.h>
> #include <linux/in.h>
> #include <fcntl.h>
> #include <string.h>
> #include <stdio.h>
>
> int main()
> {
>         int fd;
>         mmap((void *)0x20000000ul, 0xff2000ul, 0x3ul, 0x32ul, -1, 0x0ul);
>         fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_SCTP);
>         memcpy((void*)0x20f82f80, "\x0a\x00\xab\x12\x72\xd4\x19\x9a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x85\xda\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 128);
>         bind(fd, (struct sockaddr*)0x20f82f80ul, 0x80ul);
>         *(uint64_t*)0x202e1fc8 = (uint64_t)0x20f77f80;
>         *(uint32_t*)0x202e1fd0 = (uint32_t)0x80;
>         *(uint64_t*)0x202e1fd8 = (uint64_t)0x20f7dfe0;
>         *(uint64_t*)0x202e1fe0 = (uint64_t)0x2;
>         *(uint64_t*)0x202e1fe8 = (uint64_t)0x20f77000;
>         *(uint64_t*)0x202e1ff0 = (uint64_t)0x3;
>         *(uint32_t*)0x202e1ff8 = (uint32_t)0x80;
>         memcpy((void*)0x20f77f80, "\x0a\x00\xab\x12\xb0\xb3\x20\x7b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc2\xc2\x0b\xb2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 128);
>         *(uint64_t*)0x20f7dfe0 = (uint64_t)0x20f77fc5;
>         *(uint64_t*)0x20f7dfe8 = (uint64_t)0x3b;
>         *(uint64_t*)0x20f7dff0 = (uint64_t)0x20f77fac;
>         *(uint64_t*)0x20f7dff8 = (uint64_t)0x54;
>         memcpy((void*)0x20f77fc5, "\xa5\x7d\xf3\xc4\xfe\xd3\xfd\x44\x63\x00\x8c\x1e\x4c\x2e\x8d\x8d\x9a\x9c\x9c\x9d\x5b\x7c\xe1\x06\xf7\x15\x16\xed\x68\xd1\xfc\xf4\xa4\x3a\xe4\x69\x51\x16\x74\xf4\x1a\xcf\x0e\x99\xc3\xa3\x87\xe7\x81\x6c\x10\x78\x75\x17\x69\x9d\x11\x0c\xc7", 59);
>         memcpy((void*)0x20f77fac, "\x86\x08\x89\x3c\xf3\x58\xea\xe7\x64\x6a\xfb\xb5\xe8\xdd\x5f\x69\xa5\xd4\xdc\xd9\xe7\x71\x95\x07\x78\x7b\x21\xda\x43\x9c\x62\x4d\xca\x64\xb5\x6e\x96\x55\xe9\x58\x76\x66\x1d\xb9\x7b\xe6\x20\xc1\xa9\xed\x70\xc1\x2b\x7c\x86\x8c\xba\x28\xb3\x2c\xb9\x64\xb7\x84\x65\x0d\x7f\xa6\x98\x6f\x49\xcb\x35\xad\x5a\xdf\x13\x75\x99\x57\x7e\xbb\x38\x89", 84);
>         *(uint64_t*)0x20f77000 = (uint64_t)0x15;
>         *(uint32_t*)0x20f77008 = (uint32_t)0x1;
>         *(uint32_t*)0x20f7700c = (uint32_t)0xfffffffffffffffe;
>         *(uint8_t*)0x20f77010 = (uint8_t)0xbb;
>         *(uint8_t*)0x20f77011 = (uint8_t)0x2;
>         *(uint8_t*)0x20f77012 = (uint8_t)0x5;
>         *(uint8_t*)0x20f77013 = (uint8_t)0x2;
>         *(uint8_t*)0x20f77014 = (uint8_t)0x80000000;
>         *(uint64_t*)0x20f77015 = (uint64_t)0x10;
>         *(uint32_t*)0x20f7701d = (uint32_t)0xffff;
>         *(uint32_t*)0x20f77021 = (uint32_t)0x1;
>         *(uint64_t*)0x20f77025 = (uint64_t)0x13;
>         *(uint32_t*)0x20f7702d = (uint32_t)0x6;
>         *(uint32_t*)0x20f77031 = (uint32_t)0xfffffffffffffe00;
>         *(uint8_t*)0x20f77035 = (uint8_t)0x80000000;
>         *(uint8_t*)0x20f77036 = (uint8_t)0xfffffffffffffff8;
>         sendmmsg(fd, (struct mmsghdr *)0x202e1fc8ul, 0x1ul, 0x1ul);
>         return 0;
> }
>
Hi, Baozeng, I couldn't reproduce this issue with this script,
even in 118253a593bd1c57de2d1193df1ccffe1abe745b
do I need to do some extra config for this ?

  reply	other threads:[~2016-10-14 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-20  7:51 net/sctp: BUG: KASAN: stack-out-of-bounds in memcmp Baozeng Ding
2016-10-14 11:13 ` Xin Long [this message]
2016-10-15  8:28   ` Baozeng Ding
2016-11-10  5:48     ` Xin Long
2016-11-12 10:12       ` Baozeng Ding
2016-11-20 14:48         ` Xin Long

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=CADvbK_emewigJ3pcxy5W4h5UdcA1LtTmFz4Zkqtit6An9OaYpg@mail.gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=sploving1@gmail.com \
    --cc=vyasevich@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).