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.8 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 8D500C433B4 for ; Wed, 7 Apr 2021 17:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67A93610FB for ; Wed, 7 Apr 2021 17:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354509AbhDGRFS (ORCPT ); Wed, 7 Apr 2021 13:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242968AbhDGRFR (ORCPT ); Wed, 7 Apr 2021 13:05:17 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E55DC06175F for ; Wed, 7 Apr 2021 10:05:07 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id s17so21564931ljc.5 for ; Wed, 07 Apr 2021 10:05:07 -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=+88jxDCU+SNdWXTN3z3TZI8sQwpTFP6rVmjQ1IvMUp0=; b=NEqJedWWmmdhqwXjNwjktue2V23wNTRtBfoImIIAzQVurOySj5Javl6oNqSxLuGk/6 H5db28mPuPm8ZICBA974Hz2HSIUZgFYCpQjj7wNrm2YortKw0r9rkQz6xqx2G3ohOwJL KBqlJrRjasxTbcKYfFCNzd5whuFSFbHBux824= 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=+88jxDCU+SNdWXTN3z3TZI8sQwpTFP6rVmjQ1IvMUp0=; b=e4TwyX7+nX9TC43e/gy5nKCL33PNJ/rsg4zKSFjOBO7/bjjd7XDQYYh790LuQzg9bK otVdmjQx1MywgEHqirBA4Q8cKZOCfnRKPfOin3EpRTItYn6FsBPCfsqYTFajmtqi0nps axdH/+Z9Yrn736wKNARXt/WLm7quZxzcs+KU7G1iCoiameKPS3+HmiTCSVz0KR/oApAq UYNY/RG+32qoo3A0khjj2Rj1pcz77cSzB58xXRajsENyFWPrzE14uL3+NvXkPBwJofXH U26d9MrcmXNQMNuqJRz1iWP0HPMR+a4zjcJOx5K5Q/fby+lD4F6SHZ9OnexsxM81yfUl 3vhw== X-Gm-Message-State: AOAM532A/aazcR2lENacT5YqoJyUn4Td/oVT15Nacmo6qzqaxGHbfPUG XC9IpPvY+zRcxwA4ODvD3samOitu0Nk/XKx7 X-Google-Smtp-Source: ABdhPJwZVlH8xY/iPok7pYoPHJal6Fk3yGtQn/XW3wvcTEWd477mxQDikcJtiNyieNWEEqyPijQ7Ug== X-Received: by 2002:a2e:9151:: with SMTP id q17mr2660497ljg.107.1617815106082; Wed, 07 Apr 2021 10:05:06 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id v20sm2513611ljh.105.2021.04.07.10.05.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 10:05:06 -0700 (PDT) Received: by mail-lj1-f171.google.com with SMTP id u20so21525222lja.13 for ; Wed, 07 Apr 2021 10:05:05 -0700 (PDT) X-Received: by 2002:a2e:9acf:: with SMTP id p15mr2701576ljj.61.1617815105311; Wed, 07 Apr 2021 10:05:05 -0700 (PDT) MIME-Version: 1.0 References: <20210401181741.168763-1-surenb@google.com> In-Reply-To: From: Linus Torvalds Date: Wed, 7 Apr 2021 10:04:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/5] 4.14 backports of fixes for "CoW after fork() issue" To: Suren Baghdasaryan , Mikulas Patocka Cc: Vlastimil Babka , Peter Xu , stable , Greg Kroah-Hartman , Jann Horn , Kirill Tkhai , Shaohua Li , Nadav Amit , Linux-MM , Linux Kernel Mailing List , Android Kernel Team , Andrea Arcangeli , David Hildenbrand , Jason Gunthorpe Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 7, 2021 at 9:33 AM Suren Baghdasaryan wrote: > > Trying my hand at backporting the patchsets Peter mentioned proved > this to be far from easy with many dependencies. Let me look into > Vlastimil's suggestion to backport only 17839856fd58 and it sounds > like 5.4 already followed that path. Well, in many ways 17839856fd58 was the "simple and obvious" fix, and I do think it's easily backportable. But it *did* cause problems too. Those problems may not be issues on those old kernels, though. In particular, commit 17839856fd58 caused uffd-wp to stop working right, and it caused some issues with debugging (I forget the exact details, but I think it was strace accessing PROT_NONE or write-only pages or something like that, and COW failed). But yes, in many ways that commit is a much simpler and more straightforward one (which is why I tried it once - we ended up with the much more subtle and far-reaching fixes after the UFFD issues crept up). The issues that 17839856fd58 caused may be entire non-events in old kernels. In fact, the uffd writeprotect API was added fairly recently (see commit 63b2d4174c4a that made it into v5.7), so the uffd-wp issue that was triggered probably cannot happen in the old kernels. The strace issue might not be relevant either, but I forget what the details were. Mikilas should know. See https://lore.kernel.org/lkml/alpine.LRH.2.02.2009031328040.6929@file01.intranet.prod.int.rdu2.redhat.com/ for Mikulas report. I never looked into it in detail, because by then the uffd-wp issue had already come up, so it was juat another nail in the coffin for that simpler approach. Mikulas, do you remember? Linus 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.8 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 82980C43460 for ; Wed, 7 Apr 2021 17:05:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C148610FB for ; Wed, 7 Apr 2021 17:05:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C148610FB 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 32B8B6B0072; Wed, 7 Apr 2021 13:05:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28D5C6B0073; Wed, 7 Apr 2021 13:05:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B9DD6B007D; Wed, 7 Apr 2021 13:05:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id E3CA96B0072 for ; Wed, 7 Apr 2021 13:05:09 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 900AF180AD83B for ; Wed, 7 Apr 2021 17:05:09 +0000 (UTC) X-FDA: 78006196338.35.B2E95C7 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf24.hostedemail.com (Postfix) with ESMTP id 59053A0009ED for ; Wed, 7 Apr 2021 17:05:05 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id n8so10926523lfh.1 for ; Wed, 07 Apr 2021 10:05:08 -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=+88jxDCU+SNdWXTN3z3TZI8sQwpTFP6rVmjQ1IvMUp0=; b=NEqJedWWmmdhqwXjNwjktue2V23wNTRtBfoImIIAzQVurOySj5Javl6oNqSxLuGk/6 H5db28mPuPm8ZICBA974Hz2HSIUZgFYCpQjj7wNrm2YortKw0r9rkQz6xqx2G3ohOwJL KBqlJrRjasxTbcKYfFCNzd5whuFSFbHBux824= 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=+88jxDCU+SNdWXTN3z3TZI8sQwpTFP6rVmjQ1IvMUp0=; b=T03sFHDteYbg+5HjOQ/fGs9guOnpWvW/OfllKYiOANPexV9ubj3Yyirm9ytxr2uggX Nc+WW1GPVFTW0nwlpIYdffxFv/v59tTlmxCssr9Id3WtUyCnisH9qbM79Asaqi2hmoF2 Tg14lpFedO520b9c9vVOKHgkMBOUNIkQUdb0xaS3Xk5wcOuBHHnqOJ7h5nm08O1LJsRG 0Mnvzb8qe/SB200w48aO61fT8dd31fsSIJXlRyYP1w/lDdSPAjNsq+Zmsak6uO2fy0JA lFWVDacrjqr6mM6LPah/i42qPkfFOrQ29FYs3EMj78icEnIrbkVPdgWUElcwczka5SZD NS3Q== X-Gm-Message-State: AOAM531gU/wRptlAmI5YjMeJtkJc2HqMrsrHhToSiEYpBpLVDJgId7Cw MkekFbATE8WW4xl8eA2Gsof8RDlZjt7FhUMu X-Google-Smtp-Source: ABdhPJzUY/TsYD68Dv3VFIsI14BMCQf1WCQ8eIXSSXJ64zzBiqI0gPAyJE0vTU+6cWtJY89fze+LMg== X-Received: by 2002:a05:6512:201b:: with SMTP id a27mr3036683lfb.202.1617815106668; Wed, 07 Apr 2021 10:05:06 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id f2sm2341018lfq.139.2021.04.07.10.05.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 10:05:05 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id y1so21545767ljm.10 for ; Wed, 07 Apr 2021 10:05:05 -0700 (PDT) X-Received: by 2002:a2e:9acf:: with SMTP id p15mr2701576ljj.61.1617815105311; Wed, 07 Apr 2021 10:05:05 -0700 (PDT) MIME-Version: 1.0 References: <20210401181741.168763-1-surenb@google.com> In-Reply-To: From: Linus Torvalds Date: Wed, 7 Apr 2021 10:04:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/5] 4.14 backports of fixes for "CoW after fork() issue" To: Suren Baghdasaryan , Mikulas Patocka Cc: Vlastimil Babka , Peter Xu , stable , Greg Kroah-Hartman , Jann Horn , Kirill Tkhai , Shaohua Li , Nadav Amit , Linux-MM , Linux Kernel Mailing List , Android Kernel Team , Andrea Arcangeli , David Hildenbrand , Jason Gunthorpe Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 59053A0009ED X-Stat-Signature: r5kqep5qeknfxpj5t9w46jw8nzp1eha3 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mail-lf1-f47.google.com; client-ip=209.85.167.47 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617815105-351812 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 Wed, Apr 7, 2021 at 9:33 AM Suren Baghdasaryan wrote: > > Trying my hand at backporting the patchsets Peter mentioned proved > this to be far from easy with many dependencies. Let me look into > Vlastimil's suggestion to backport only 17839856fd58 and it sounds > like 5.4 already followed that path. Well, in many ways 17839856fd58 was the "simple and obvious" fix, and I do think it's easily backportable. But it *did* cause problems too. Those problems may not be issues on those old kernels, though. In particular, commit 17839856fd58 caused uffd-wp to stop working right, and it caused some issues with debugging (I forget the exact details, but I think it was strace accessing PROT_NONE or write-only pages or something like that, and COW failed). But yes, in many ways that commit is a much simpler and more straightforward one (which is why I tried it once - we ended up with the much more subtle and far-reaching fixes after the UFFD issues crept up). The issues that 17839856fd58 caused may be entire non-events in old kernels. In fact, the uffd writeprotect API was added fairly recently (see commit 63b2d4174c4a that made it into v5.7), so the uffd-wp issue that was triggered probably cannot happen in the old kernels. The strace issue might not be relevant either, but I forget what the details were. Mikilas should know. See https://lore.kernel.org/lkml/alpine.LRH.2.02.2009031328040.6929@file01.intranet.prod.int.rdu2.redhat.com/ for Mikulas report. I never looked into it in detail, because by then the uffd-wp issue had already come up, so it was juat another nail in the coffin for that simpler approach. Mikulas, do you remember? Linus