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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 163E4C433ED for ; Thu, 1 Apr 2021 19:44:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 72CA0610CA for ; Thu, 1 Apr 2021 19:44:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72CA0610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BFF16B00A3; Thu, 1 Apr 2021 15:44:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 897426B00A5; Thu, 1 Apr 2021 15:44:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75DF86B00A6; Thu, 1 Apr 2021 15:44:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 541026B00A3 for ; Thu, 1 Apr 2021 15:44:04 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 17566EFC6 for ; Thu, 1 Apr 2021 19:44:04 +0000 (UTC) X-FDA: 77984824008.06.3FE32F3 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf03.hostedemail.com (Postfix) with ESMTP id 513A5C0001F7 for ; Thu, 1 Apr 2021 19:44:02 +0000 (UTC) Received: by mail-yb1-f181.google.com with SMTP id 8so2918067ybc.13 for ; Thu, 01 Apr 2021 12:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iF4IO7QJLHB6aKo372bx64673+ThKmhycS/rht00sIM=; b=UqSXdWUdJ61mv2MAEfoJjth4rwv55Z8tDgpBepcP4WQNxezaT9RozpomUKDEgzu0kZ LKLYtEB76D1E7DNJXIw7AD8sDQ2qQq11WaGkX2KBicR1GyTZt6KN/a4wNIn/3MBs9rSD LOoxNUUwlXB2N/figtDa/594dUIrwewp4hTlnXq2bNTeurh0eWGmjjJCRh5Dd13uwS/E 5oFKphZ5dip6g4QIUmPZBu9CPVJjtlesQX+at+Ezrlo5gRyZ6G3vetCXh9MTWCXWD+kK wRJ4eEvLRBc7H5+lzOm+GRxUjcr4+nsNoN8Gpreh9hQ1FGV5+iYNUvra4TjlvuW7b8dn 8DPQ== 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=iF4IO7QJLHB6aKo372bx64673+ThKmhycS/rht00sIM=; b=DDLHDJPMKjwGXXOByOnQpmqS6EQcb0wjfIuMQOAi29Q24iwmzp3rOQwMtI4Ft3njpY LUhnt4F0ynr3Tvd6YvQbYXN8oDvXRc4PeRz3ZsXPQ5eSrZqal4jJNKpPe3Tytxz6C0VO nsU4UcgxmDzM82/fJaZLWOZ0t0+r/7gStaCuFkSturaQ21uAp2pOcsukHt6j2ej5ew1q ykAWoaC4Cz7+2tDuoT5ji5jY3sw+dfGxhyYU8MpCl3v1vcUvaZKudStA2BjxkzKj1zQ0 dclTvIQyxofnAUGWinL1V1ABrQFr8L+cyHqgSOmQHZPZPgn1k2zl1t7JmKDBMdamtR7c B+/w== X-Gm-Message-State: AOAM532DGLynrP50/tzj+hwipUXGBvhGmRwCCh9IT3kl8Zc03OL/DjO5 Ln0xAOIa+i3tqDp6PR2z7/mRQFq75peGkOAUh70U7w== X-Google-Smtp-Source: ABdhPJxrv6pcBArSMr7HCn/xpEaCzYR1DW1hvA3LHx+g2zLnj8kZ3SEH5Uj7nc17H/9/IzV0nAhRoIJbCmibJufgJo4= X-Received: by 2002:a25:38c1:: with SMTP id f184mr14718948yba.84.1617306242737; Thu, 01 Apr 2021 12:44:02 -0700 (PDT) MIME-Version: 1.0 References: <20210401181741.168763-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 1 Apr 2021 12:43:51 -0700 Message-ID: Subject: Re: [PATCH 0/5] 4.14 backports of fixes for "CoW after fork() issue" To: Linus Torvalds Cc: Peter Xu , stable , Greg Kroah-Hartman , Jann Horn , Kirill Tkhai , Shaohua Li , Nadav Amit , Linux-MM , Linux Kernel Mailing List , Android Kernel Team Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 513A5C0001F7 X-Stat-Signature: myyk1r1zjs3ccdi8dniwbbqb61afjso4 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mail-yb1-f181.google.com; client-ip=209.85.219.181 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617306242-355804 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, Apr 1, 2021 at 11:59 AM Linus Torvalds wrote: > > On Thu, Apr 1, 2021 at 11:17 AM Suren Baghdasaryan wrote: > > > > We received a report that the copy-on-write issue repored by Jann Horn in > > https://bugs.chromium.org/p/project-zero/issues/detail?id=2045 is still > > reproducible on 4.14 and 4.19 kernels (the first issue with the reproducer > > coded in vmsplice.c). > > Gaah. > > > I confirmed this and also that the issue was not > > reproducible with 5.10 kernel. I tracked the fix to the following patch > > introduced in 5.9 which changes the do_wp_page() logic: > > > > 09854ba94c6a 'mm: do_wp_page() simplification' > > The problem here is that there's a _lot_ more patches than the few you > found that fixed various other cases (THP etc). > > > I backported this patch (#2 in the series) along with 2 prerequisite patches > > (#1 and #4) that keep the backports clean and two followup fixes to the main > > patch (#3 and #5). I had to skip the following fix: > > > > feb889fb40fa 'mm: don't put pinned pages into the swap cache' > > > > because it uses page_maybe_dma_pinned() which does not exists in earlier > > kernels. Because pin_user_pages() does not exist there as well, I *think* > > we can safely skip this fix on older kernels, but I would appreciate if > > someone could confirm that claim. > > Hmm. I think this means that swap activity can now break the > connection to a GUP page (the whole pre-pinning model), but it > probably isn't a new problem for 4.9/4.19. > > I suspect the test there should be something like > > /* Single mapper, more references than us and the map? */ > if (page_mapcount(page) == 1 && page_count(page) > 2) > goto keep_locked; > > in the pre-pinning days. > > But I really think that there are a number of other commits you're > missing too, because we had a whole series for THP fixes for the same > exact issue. > > Added Peter Xu to the cc, because he probably tracked those issues > better than I did. > > So NAK on this for now, I think this limited patch-set likely > introduces more problems than it fixes. Thanks for confirming my worries. I'll be happy to add additional backports if Peter can point me to them. Thanks, Suren. > > Linus