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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Dec 2019 18:11:21 +0300
From:   "Kirill A. Shutemov" <kirill@...temov.name>
To:     Catalin Marinas <catalin.marinas@....com>
Cc:     Magnus Karlsson <magnus.karlsson@...il.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        kirill.shutemov@...ux.intel.com, justin.he@....com,
        linux-mm@...ck.org,
        syzbot <syzbot+9301f2f33873407d5b33@...kaller.appspotmail.com>,
        Andrii Nakryiko <andriin@...com>,
        Alexei Starovoitov <ast@...nel.org>,
        Björn Töpel <bjorn.topel@...el.com>,
        bpf <bpf@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>, hawk@...nel.org,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        John Fastabend <john.fastabend@...il.com>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Martin KaFai Lau <kafai@...com>,
        linux-kernel@...r.kernel.org,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        Network Development <netdev@...r.kernel.org>,
        Song Liu <songliubraving@...com>,
        syzkaller-bugs@...glegroups.com, Yonghong Song <yhs@...com>
Subject: Re: WARNING in wp_page_copy

On Tue, Dec 17, 2019 at 10:38:09PM +0000, Catalin Marinas wrote:
> On Tue, Dec 17, 2019 at 04:57:34PM +0100, Magnus Karlsson wrote:
> > On Tue, Dec 17, 2019 at 4:40 PM Catalin Marinas <catalin.marinas@....com> wrote:
> > > On Tue, Dec 17, 2019 at 02:27:22PM +0100, Magnus Karlsson wrote:
> > > > On Mon, Dec 16, 2019 at 4:10 PM Magnus Karlsson
> > > > <magnus.karlsson@...il.com> wrote:
> > > > > On Mon, Dec 16, 2019 at 4:00 PM Daniel Borkmann <daniel@...earbox.net> wrote:
> > > > > > On Sat, Dec 14, 2019 at 08:20:07AM -0800, syzbot wrote:
> > > > > > > syzbot has found a reproducer for the following crash on:
> > > > > > >
> > > > > > > HEAD commit:    1d1997db Revert "nfp: abm: fix memory leak in nfp_abm_u32_..
> > > > > > > git tree:       net-next
> > > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=1029f851e00000
> > > > > > > kernel config:  https://syzkaller.appspot.com/x/.config?x=cef1fd5032faee91
> > > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=9301f2f33873407d5b33
> > > > > > > compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> > > > > > > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=119d9fb1e00000
> > > > > > >
> > > > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > > > > > > Reported-by: syzbot+9301f2f33873407d5b33@...kaller.appspotmail.com
> > > > > >
> > > > > > Bjorn / Magnus, given xsk below, PTAL, thanks!
> > > > >
> > > > > Thanks. I will take a look at it right away.
> > > > >
> > > > > /Magnus
> > > >
> > > > After looking through the syzcaller report, I have the following
> > > > hypothesis that would dearly need some comments from MM-savy people
> > > > out there. Syzcaller creates, using mmap, a memory area that is
> > >
> > > I guess that's not an anonymous mmap() since we don't seem to have a
> > > struct page for src in cow_user_page() (the WARN_ON_ONCE path). Do you
> > > have more information on the mmap() call?
> > 
> > I have this from the syzcaller logs:
> > 
> > mmap(&(0x7f0000001000/0x2000)=nil, 0x2000, 0xfffffe, 0x12, r8, 0x0)
> > getsockopt$XDP_MMAP_OFFSETS(r8, 0x11b, 0x7, &(0x7f0000001300),
> > &(0x7f0000000100)=0x60)
> > 
> > The full log can be found at:
> > https://syzkaller.appspot.com/x/repro.syz?x=119d9fb1e00000
> 
> Thanks. Prior to mmap, we have:
> 
> r8 = socket$xdp(0x2c, 0x3, 0x0)
> 
> So basically we have an mmap() on a socket descriptor with a subsequent
> copy_to_user() writing this range. We do we even end up doing CoW on
> such mapping?

It's a non-readable private mapping of a socket. Any write to it would
cause CoW.

BTW, how useful memory mapped sockets are? I don't know much about
networking, but it looks like a rarely used feature that substantially
increase attack surface. CAP_NET_RAW is easy to come by nowadays with
user-ns.

Few years back I was able to modify zero page via memory mapped socket...

> Maybe the socket code should also implement the .fault()
> file op. It needs more digging.

Caller definitely does a weird thing here that doesn't suppose to produce
a meaningful result. I think we can keep the warning for now just to make
sure we don't have any more-or-less legitimate obscure use-case.

But ultimately this WARN_ON_ONCE() has to be upgraded to SIGSEGV or
SIGBUS. Pretending that we do anything meaningful here by clearing the
page unlikely does anything useful to a user.

-- 
 Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ