From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F37EDC2D0D2 for ; Wed, 18 Dec 2019 15:11:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AAAD2218AC for ; Wed, 18 Dec 2019 15:11:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="Fkg0mQdK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAAD2218AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3ED548E0118; Wed, 18 Dec 2019 10:11:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 39E9F8E00F5; Wed, 18 Dec 2019 10:11:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2663C8E0118; Wed, 18 Dec 2019 10:11:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 121B48E00F5 for ; Wed, 18 Dec 2019 10:11:25 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id CECF0246A for ; Wed, 18 Dec 2019 15:11:24 +0000 (UTC) X-FDA: 76278600888.29.offer55_80a7d836b8710 X-HE-Tag: offer55_80a7d836b8710 X-Filterd-Recvd-Size: 7676 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Dec 2019 15:11:23 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id k8so2544742ljh.5 for ; Wed, 18 Dec 2019 07:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0o452dtZDcKvnVAQ8Kj3Gm0Xbx2pj/IYUiQTJzQO9gE=; b=Fkg0mQdKOLV1WZE8Z1XxbvNcqJdb67rz/Q/NjePD7qIU9ny1yPyJKOOfsOOA4OEkL5 u+WyT9wy7radyNji9r6O0NL01H1e+aRCp58B6flFwf4fmwkGrGcLEA71Xm7XdDJu9GCh NowL3CKkqunsqL0t1gWO2GDCHsWK7l81/dWd7viQeajhILnoEgRkGoTYqA+M8YJN+p0m /aiV9wMWADePF00JXxJUjmUrnTyi/mWhUAvDUJCJypvfxj0NKsQhgC5Ui4jhFwGIUnd8 yZmidC4lSdm9/1PCTq2HFveGp/PVULv2K8U0MH2xtFCdG4H6z4GEhB12BFgYynk34v3W 79nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0o452dtZDcKvnVAQ8Kj3Gm0Xbx2pj/IYUiQTJzQO9gE=; b=dsGCgnq/U9bd56E0eD2ZdCYhPn4MrfujYIC137Dss6fwXjP5CMe6wKdfO9gDi/ifXp KZNj6o2TWtaml/rgrxKTpWj6eNQFVs4r0zzwIqzwYpa/PreU2ro8elY7w7BQhZd3evr/ PQk2m6HpsEiXoO/mc+HytO4PI2uFyrghVIaa130qK8+UV4xFf54CXpyeD5xvj3MdW6R8 MmnpXvGA7iPcrMUcahBizi3OiqSsck9EYuX/CtLAf5D1IVl9bgFFglSGTwPLZGN/ZGiW Cw7Y9QsEUoveGajhxYoqwmnVtLjI6Bfob25NNHRxEwKkRksTTUwSM/NSQ7tgKkr7XVXY T/sw== X-Gm-Message-State: APjAAAU1Igw662L60zdEo8fO4z5066rCXCTLqfJ16LTNo/5feODMeY5O 2esPhEXhR6I1aLqzUyyBEIoafQ== X-Google-Smtp-Source: APXvYqwoxIn9nfRFjJUPqQwR+khLXfWKms5b5AuArgOziPlcTFDSZdYBhtuiosiiZzJKNtWPyEXDzg== X-Received: by 2002:a2e:58c:: with SMTP id 134mr2221234ljf.12.1576681882374; Wed, 18 Dec 2019 07:11:22 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id i4sm1736919lji.0.2019.12.18.07.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 07:11:20 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 934571012CF; Wed, 18 Dec 2019 18:11:21 +0300 (+03) Date: Wed, 18 Dec 2019 18:11:21 +0300 From: "Kirill A. Shutemov" To: Catalin Marinas Cc: Magnus Karlsson , Daniel Borkmann , kirill.shutemov@linux.intel.com, justin.he@arm.com, linux-mm@kvack.org, syzbot , Andrii Nakryiko , Alexei Starovoitov , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , bpf , "David S. Miller" , hawk@kernel.org, Jakub Kicinski , John Fastabend , Jonathan Lemon , Martin KaFai Lau , linux-kernel@vger.kernel.org, "Karlsson, Magnus" , Network Development , Song Liu , syzkaller-bugs@googlegroups.com, Yonghong Song Subject: Re: WARNING in wp_page_copy Message-ID: <20191218151121.nllpaaq4v5yictib@box> References: <000000000000a6f2030598bbe38c@google.com> <0000000000000e32950599ac5a96@google.com> <20191216150017.GA27202@linux.fritz.box> <20191217154031.GI5624@arrakis.emea.arm.com> <20191217223808.GA14982@mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191217223808.GA14982@mbp> User-Agent: NeoMutt/20180716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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 > > > > wrote: > > > > > On Mon, Dec 16, 2019 at 4:00 PM Daniel Borkmann 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@syzkaller.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