From: Mikulas Patocka <mpatocka@redhat.com> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Xu <peterx@redhat.com>, Jann Horn <jannh@google.com>, Christoph Hellwig <hch@lst.de>, Oleg Nesterov <oleg@redhat.com>, Kirill Shutemov <kirill@shutemov.name>, Jan Kara <jack@suse.cz>, Andrea Arcangeli <aarcange@redhat.com>, Matthew Wilcox <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Linux-MM <linux-mm@kvack.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-nvdimm <linux-nvdimm@lists.01.org> Subject: Re: a crash when running strace from persistent memory Date: Fri, 4 Sep 2020 04:08:26 -0400 (EDT) [thread overview] Message-ID: <alpine.LRH.2.02.2009040402560.14993@file01.intranet.prod.int.rdu2.redhat.com> (raw) In-Reply-To: <CAHk-=whpJp9W_eyhqJU3Y2JsnX45xMfQHFNQSsb9dNirdMFnaA@mail.gmail.com> On Thu, 3 Sep 2020, Linus Torvalds wrote: > On Thu, Sep 3, 2020 at 12:24 PM Mikulas Patocka <mpatocka@redhat.com> 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 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Mikulas Patocka <mpatocka@redhat.com> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Xu <peterx@redhat.com>, Jann Horn <jannh@google.com>, Christoph Hellwig <hch@lst.de>, Oleg Nesterov <oleg@redhat.com>, Kirill Shutemov <kirill@shutemov.name>, Jan Kara <jack@suse.cz>, Andrea Arcangeli <aarcange@redhat.com>, Matthew Wilcox <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Dan Williams <dan.j.williams@intel.com>, Linux-MM <linux-mm@kvack.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, linux-nvdimm <linux-nvdimm@lists.01.org> Subject: Re: a crash when running strace from persistent memory Date: Fri, 4 Sep 2020 04:08:26 -0400 (EDT) [thread overview] Message-ID: <alpine.LRH.2.02.2009040402560.14993@file01.intranet.prod.int.rdu2.redhat.com> (raw) In-Reply-To: <CAHk-=whpJp9W_eyhqJU3Y2JsnX45xMfQHFNQSsb9dNirdMFnaA@mail.gmail.com> On Thu, 3 Sep 2020, Linus Torvalds wrote: > On Thu, Sep 3, 2020 at 12:24 PM Mikulas Patocka <mpatocka@redhat.com> 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 >
next prev parent reply other threads:[~2020-09-04 8:08 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-03 19:24 a crash when running strace from persistent memory Mikulas Patocka 2020-09-03 19:24 ` Mikulas Patocka 2020-09-03 19:55 ` Linus Torvalds 2020-09-03 19:55 ` Linus Torvalds 2020-09-03 19:55 ` Linus Torvalds 2020-09-04 8:08 ` Mikulas Patocka [this message] 2020-09-04 8:08 ` Mikulas Patocka 2020-09-04 17:11 ` Linus Torvalds 2020-09-04 17:11 ` Linus Torvalds 2020-09-04 17:11 ` Linus Torvalds 2020-09-04 16:21 ` make misbehavior on ext2 in dax mode (was: a crash when running strace from persistent memory) Mikulas Patocka 2020-09-04 16:21 ` Mikulas Patocka 2020-09-05 12:11 ` Mikulas Patocka 2020-09-05 12:11 ` Mikulas Patocka 2020-09-05 12:12 ` [PATCH 1/2] ext2: don't update mtime on COW faults Mikulas Patocka 2020-09-05 12:12 ` Mikulas Patocka 2020-09-07 9:00 ` Jan Kara 2020-09-07 9:00 ` Jan Kara 2020-09-07 15:03 ` Sasha Levin 2020-09-05 12:13 ` [PATCH 2/2] xfs: " Mikulas Patocka 2020-09-05 12:13 ` Mikulas Patocka 2020-09-05 15:36 ` Darrick J. Wong 2020-09-05 15:36 ` Darrick J. Wong 2020-09-05 17:02 ` Mikulas Patocka 2020-09-05 17:02 ` Mikulas Patocka 2020-09-10 6:06 ` Darrick J. Wong 2020-09-10 6:06 ` Darrick J. Wong 2020-09-11 16:41 ` Mikulas Patocka 2020-09-11 16:41 ` Mikulas Patocka 2020-09-05 16:47 ` Linus Torvalds 2020-09-05 16:47 ` Linus Torvalds 2020-09-05 16:47 ` Linus Torvalds 2020-09-05 17:03 ` Linus Torvalds 2020-09-05 17:03 ` Linus Torvalds 2020-09-05 17:03 ` Linus Torvalds 2020-09-07 8:59 ` Jan Kara 2020-09-07 8:59 ` Jan Kara 2020-09-05 17:04 ` [PATCH 2/2 v2] " Mikulas Patocka 2020-09-05 17:04 ` Mikulas Patocka 2020-09-07 6:47 ` [PATCH 2/2] " Christoph Hellwig 2020-09-07 6:47 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=alpine.LRH.2.02.2009040402560.14993@file01.intranet.prod.int.rdu2.redhat.com \ --to=mpatocka@redhat.com \ --cc=aarcange@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=hch@lst.de \ --cc=jack@suse.cz \ --cc=jannh@google.com \ --cc=kirill@shutemov.name \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-nvdimm@lists.01.org \ --cc=oleg@redhat.com \ --cc=peterx@redhat.com \ --cc=torvalds@linux-foundation.org \ --cc=willy@infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.