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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C3F66C433E2 for ; Thu, 3 Sep 2020 19:56:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8CA7020897 for ; Thu, 3 Sep 2020 19:56:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="B/wF0S73" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CA7020897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 052936B0074; Thu, 3 Sep 2020 15:56:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF5826B0075; Thu, 3 Sep 2020 15:56:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D97606B007B; Thu, 3 Sep 2020 15:56:15 -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 BD6756B0074 for ; Thu, 3 Sep 2020 15:56:15 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 75321181AC9CC for ; Thu, 3 Sep 2020 19:56:15 +0000 (UTC) X-FDA: 77222806710.04.front24_340ee9b270ac Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 4BB188005047 for ; Thu, 3 Sep 2020 19:56:15 +0000 (UTC) X-HE-Tag: front24_340ee9b270ac X-Filterd-Recvd-Size: 5831 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Sep 2020 19:56:14 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id y11so2601639lfl.5 for ; Thu, 03 Sep 2020 12:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+HyCacCrUTSO04Bcz2fAaxbtZLHd8zOfhLgllifmbhk=; b=B/wF0S73fEkmrWeW78FVYp9qaLcNFtik9sGGBc1uklYgCiZlOnL6UKyw8zxdwXKlmM yZe+asx0TMiJqjKXU+9nuISZd3LkJxAOGu4NBUmczdu3m4VNq8bXfQHWIGfk/u5osF/7 jhDBu8BCJd9u28EonQab6s+MaaNgFFzQ7//vo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+HyCacCrUTSO04Bcz2fAaxbtZLHd8zOfhLgllifmbhk=; b=SiQdYy7nDRKMVizhfZ6B6DLbiU5BcrIqSVj8MWaw23XA8GHCLR1yw5fL9o+fJ95ptF 61TzIsm4zMrGxYgcI2NCPTWJENqYXtj2+jQX0pe9y9jVAf/sqFBaHDJw6dzfIUuA9PnA XhqZDSX3jo3QvLp9eMMUmDmETzegPvAK90ej21XBVDU5DKqSgOwkHrlnHTFd+RJmPGSH yPi9GTrDhW8UE6LjVHkvlyIWZ4r56FxNzmZKyAoGBqHJzlWwFwfMS1gsEiK6qsWjo+IZ Bclf11zCrB4nZt0hAXr2nRmesI7CM8DOrEHTUHR3Gb2a//PeOlt9tiQrJ80pMx6IfdOB Q3ew== X-Gm-Message-State: AOAM531xJSfweakw/Nov/css8BxF9C/51z7Uuv0lykkdMO87XMyMNBc3 2QdPHn+qlWbbDViuLhKUmOPNd/OSrk7O2g== X-Google-Smtp-Source: ABdhPJwkm+jvO50qnvUYR7WZPKPD53yedlE1yLvmS7G3O8loVqTfNH9peXfaA8dApU3JSysIvrzVAg== X-Received: by 2002:a19:82c3:: with SMTP id e186mr2056367lfd.144.1599162971824; Thu, 03 Sep 2020 12:56:11 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id h6sm796969ljg.86.2020.09.03.12.56.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 12:56:10 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id w3so5210122ljo.5 for ; Thu, 03 Sep 2020 12:56:10 -0700 (PDT) X-Received: by 2002:a2e:3611:: with SMTP id d17mr6508lja.314.1599162969764; Thu, 03 Sep 2020 12:56:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 3 Sep 2020 12:55:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: a crash when running strace from persistent memory To: Mikulas Patocka , Peter Xu Cc: 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BB188005047 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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, 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. 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/ or if you have 'b4' installed, use b4 am 20200821234958.7896-1-peterx@redhat.com to get the series.. Linus