Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp801139pxk; Thu, 3 Sep 2020 12:59:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOpTBHJ0kl2iUCBnaM0oYMigRm6BDppnH3QphpsxLj05b+mpTJEi77qcFU2sCGg6gIOCHX X-Received: by 2002:a17:906:3191:: with SMTP id 17mr3741082ejy.239.1599163177428; Thu, 03 Sep 2020 12:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599163177; cv=none; d=google.com; s=arc-20160816; b=pwO0Wz7GdIwwbQvY8o3NW4uM/m2yTZN1Gz6D5n+pxo3tT33c3PFCL9kQ1NM7HfuCE8 C7QZtzAr01++b4lNxAYQa9lznKmBjtOknBUwPVqW2m6nYMJN3Ov/z299bO0/Aq+r0YmG 2qC8YCb8qRrL4Y4nOH6lsh5H9fbrU9WN+TdQIIQafT+y2WiAJjYqR7bb2iyuEG3VniGA pZPpNegPDgrfA0hzNyRFnY/1G3KkgiyVXcJaOFE3HmGziqd2rqmAdST4PdFlIvN4eNLa AGnEfctU1NanwSgjYmkO/ySbOI1A0zawcA0teo3jEWG80BfuDpG4bdvrRI0Fee/kc+uj P1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+HyCacCrUTSO04Bcz2fAaxbtZLHd8zOfhLgllifmbhk=; b=dklpSfwP3cJf5fswfX2HWsgo7qSKMLwPSS734AdP4GvbKa7r62NWFMwKmclFQ7zP98 AkTMr25n8AXdNjjwgdFDJijxhqUn5F2wldk2iaTBeYiYnQ0TGEESEyZvJi0Vor8yH90Y JdQ7wpCFaLTkfHoQzdRikxzfddeV+ebXYTt3VuqlOFljnfdP8b8bY4glBJUm7TXN0JO6 Mda27gP9Yy5OD5vePhWMy5dIy3LTZ3mrlEQh/3reUv86lR2dFxtzH7ngaM8RMYXvNr+M lnsLLhnD9mcM/hFeSeV1yGucQVM6yMbO/jHHXIAFKeaYwM/LHanmCZuBOOgHE1OMuSAk 2huA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="B/wF0S73"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si3034564ejh.423.2020.09.03.12.59.13; Thu, 03 Sep 2020 12:59:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="B/wF0S73"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729043AbgICT4P (ORCPT + 99 others); Thu, 3 Sep 2020 15:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbgICT4O (ORCPT ); Thu, 3 Sep 2020 15:56:14 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5DA8C061244 for ; Thu, 3 Sep 2020 12:56:13 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id t7so4519069ljo.13 for ; Thu, 03 Sep 2020 12:56:13 -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=VsZcK7Ptv0q20d7z9KxzWqpbWOmPl6vjvbV0QDlvoUiyJob1CQxVmH0CnQvRcOPx7p kKvnSJMwHlAbRS1sTsBEbIgGzaFWP0yJkYnmlhJdJcy++APLlXHHKKMTLkybxFI2RqF6 MmqUYKmffbHtDRQkjPPp8IY1PZhQnf2iGMbMUN/iG5soxwsAi24ibPTXYJBQ9Fk0XQ3S NZZ7li2waaZcCtdz2BYkRa8Lb/Mc833Ud7bHK0F9WkEjB9q8iZPMHFup4x83PrxgQY8s AABQ4f/BcVAjuUi0ptYaAZpmroVV1QToa1JvOyRd/uWkn+TGbZJyP+HhjLkQiXU7ut6a todg== X-Gm-Message-State: AOAM533dMyduIm5U2ypKGYyFbJyfJb+o2f6f1ls7zl+Lsd0NPjFxoBfv 4cR13EhXt69hKda3IYVZx771NFmaKkrZdg== X-Received: by 2002:a2e:2c0e:: with SMTP id s14mr400460ljs.174.1599162971688; Thu, 03 Sep 2020 12:56:11 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id 69sm791194lfm.83.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-f176.google.com with SMTP id v23so5260603ljd.1 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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