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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 9FA46C433E2 for ; Fri, 4 Sep 2020 08:08:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 412AD206B8 for ; Fri, 4 Sep 2020 08:08:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LzJoNwO4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 412AD206B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A381E6B0002; Fri, 4 Sep 2020 04:08:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C1436B005C; Fri, 4 Sep 2020 04:08:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 888D58E0001; Fri, 4 Sep 2020 04:08:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 6DC806B0002 for ; Fri, 4 Sep 2020 04:08:40 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 33215180AD807 for ; Fri, 4 Sep 2020 08:08:40 +0000 (UTC) X-FDA: 77224652400.18.plot72_3c0dc32270b0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 07BD6100ED3C8 for ; Fri, 4 Sep 2020 08:08:40 +0000 (UTC) X-HE-Tag: plot72_3c0dc32270b0 X-Filterd-Recvd-Size: 5910 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Sep 2020 08:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599206918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SO1+KNA9ZAbDAbragBawZT9Ig1IFiDJv5+VVeyfD9cA=; b=LzJoNwO4vmw7Cg29MOB7z7zi1AcbsxNn2ItdLVNEvjcPegm0IT4U5vm9+SmLdBrGrtY/fG hcCNhi2je+3wcQKkmtUhYYcZXQFWUKiC3bQeqOMKQ6f1mVF7giGQRKHDT7Iv8UMazJMbka H6G9GWNHVwLfT5z/lF6D/X0crBAUAvs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-vmHYr-41PsCP_UiG7NElMA-1; Fri, 04 Sep 2020 04:08:36 -0400 X-MC-Unique: vmHYr-41PsCP_UiG7NElMA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBA7656BE3; Fri, 4 Sep 2020 08:08:34 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D0F01A4D6; Fri, 4 Sep 2020 08:08:28 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 08488SAu016399; Fri, 4 Sep 2020 04:08:28 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 08488Qmj016395; Fri, 4 Sep 2020 04:08:26 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 4 Sep 2020 04:08:26 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Linus Torvalds cc: Peter Xu , Jann Horn , Christoph Hellwig , Oleg Nesterov , Kirill Shutemov , Jan Kara , Andrea Arcangeli , Matthew Wilcox , Andrew Morton , Dan Williams , Linux-MM , Linux Kernel Mailing List , linux-nvdimm Subject: Re: a crash when running strace from persistent memory In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Rspamd-Queue-Id: 07BD6100ED3C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 Thu, 3 Sep 2020, Linus Torvalds wrote: > On Thu, Sep 3, 2020 at 12:24 PM Mikulas Patocka wrote: > > > > There's a bug when you run strace from dax-based filesystem. > > > > -- create real or emulated persistent memory device (/dev/pmem0) > > mkfs.ext2 /dev/pmem0 > > -- mount it > > mount -t ext2 -o dax /dev/pmem0 /mnt/test > > -- copy the system to it (well, you can copy just a few files that are > > needed for running strace and ls) > > cp -ax / /mnt/test > > -- bind the system directories > > mount --bind /dev /mnt/test/dev > > mount --bind /proc /mnt/test/proc > > mount --bind /sys /mnt/test/sys > > -- run strace on the ls command > > chroot /mnt/test/ strace /bin/ls > > > > You get this warning and ls is killed with SIGSEGV. > > > > I bisected the problem and it is caused by the commit > > 17839856fd588f4ab6b789f482ed3ffd7c403e1f (gup: document and work around > > "COW can break either way" issue). When I revert the patch (on the kernel > > 5.9-rc3), the bug goes away. > > Funky. I really don't see how it could cause that, but we have the > UDDF issue too, so I'm guessing I will have to fix it the radical way > with Peter Xu's series based on my "rip out COW special cases" patch. > > Or maybe I'm just using that as an excuse for really wanting to apply > that series.. Because we can't just revert that GUP commit due to > security concerns. > > > [ 84.191504] WARNING: CPU: 6 PID: 1350 at mm/memory.c:2486 wp_page_copy.cold+0xdb/0xf6 > > I'm assuming this is the WARN_ON_ONCE(1) on line 2482, and you have > some extra debug patch that causes that line to be off by 4? Because > at least for me, line 2486 is actually an empty line in v5.9-rc3. Yes, that's it. I added a few printk to look at the control flow. > That said, I really think this is a pre-existing race, and all the > "COW can break either way" patch does is change the timing (presumably > due to the actual pattern of actually doing the COW changing). > > See commit c3e5ea6ee574 ("mm: avoid data corruption on CoW fault into > PFN-mapped VMA") for background. > > Mikulas, can you check that everything works ok for that case if you > apply Peter's series? See > > https://lore.kernel.org/lkml/20200821234958.7896-1-peterx@redhat.com/ I applied these four patches and strace works well. There is no longer any warning or crash. Mikulas > or if you have 'b4' installed, use > > b4 am 20200821234958.7896-1-peterx@redhat.com > > to get the series.. > > Linus >