Received: by 2002:ab3:5012:0:b0:1d7:b7fe:f8b7 with SMTP id y18csp3085780ltb; Tue, 9 Aug 2022 12:15:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LpRV1J5q4ypT9c8MQuAE2adg3G9UxjssB3AMzW83Ph/y11PnrTjUDtXNfOssUgGumXRhO X-Received: by 2002:a05:6402:100e:b0:440:785c:20c9 with SMTP id c14-20020a056402100e00b00440785c20c9mr13301547edu.184.1660072535446; Tue, 09 Aug 2022 12:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660072535; cv=none; d=google.com; s=arc-20160816; b=E7tVeKf1eoqFr9lMUOJEq/Av+7oa2RY8SJXPeoTOTWo1yTCgTGYf3HYcU/Lv8tLKRf KTJNDoKLsR5z2Wgi4P+Rm+tWXJ5Lh/AzeL7u+ZxeGcrrS1t1EQZWKrw3WyxEOpKTSous Nr42+m8zPdEdder6JQyj1i6PJdWep3nS33qCNrI6FS87u9tfboqeJ5Whag6NA0/oCg9L 2A1DnKjEW/QHM33OXopU4Z1PhvPeS/daInmcqPE2lpOiBy6eP7pYEEmclsSdvQgCOVyC 7w5WqrT8CnoxKppPhs7d0wRZBUa3cfk89BxjncDvMEk4kPkJq5Ux9GsYxLs/ttizIPrx jcEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IqVJxNw31cQs7x7vLdkBRYf56RsQMoz2IVQHanq9IpQ=; b=ff/PtCkX5OW94qp1ZLxOJSw6i8+tSsv7q1/JjUjHzjgjZ6OQ97c90m3tpfJqzEfxok BKPGtjivYW0+tGS45ZGnnB6PuDFEIpjKs/TsXZkL8SiVaz3ioXuMZTHd4zQyym2IAaB1 /RFejhlz/GnFfpfhYESkf252FU2ippYl4Be+AGsXZsrOvRiZeWn7CoZMlwyP5mVpqDFa 31/LgzLw6/lRZFxF1cyF7XSXbLd1/PVpJL7wqn0KxFEcrhzUQMKOZ4Gr2drMz0bLUOoZ f8ZmirXOg0BA0VrA0Ec5GkjlAYm4dcarkWcgX1Wmr4z+tgFoaofafwWGKaQmIBP2G5P1 AEOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Mz533wEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a056402238800b00440e91f3123si3550043eda.37.2022.08.09.12.15.10; Tue, 09 Aug 2022 12:15:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Mz533wEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245678AbiHIS5o (ORCPT + 99 others); Tue, 9 Aug 2022 14:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348017AbiHISzo (ORCPT ); Tue, 9 Aug 2022 14:55:44 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780F126ADC for ; Tue, 9 Aug 2022 11:27:41 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a7so23717758ejp.2 for ; Tue, 09 Aug 2022 11:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=IqVJxNw31cQs7x7vLdkBRYf56RsQMoz2IVQHanq9IpQ=; b=Mz533wEeIainxieri2T6/kLUzCHS1auwXeNqVpxcKibNIUElVoN7j622ZmbeuctLhd KBlwbRp7UoBAFyt0TTzfk3cDg+OeRcIEIG0mzz8D+bQ7jO9T8t+YG3zq/ICdBPoLblhS ZDLr2rEu0YOmG869ckXDpRM0fDbJcMqjQwIh8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=IqVJxNw31cQs7x7vLdkBRYf56RsQMoz2IVQHanq9IpQ=; b=T7KhxX8eBQL0iGJcpLP3Mk+/Iu+T/FdYO02ZkaBrN5lCAosAuSya3o9mXQC01xnLBW 2NoIlPj8bpmdxOxqRTyrTfs8H/0ybSCqihuIghcNyqwDprOV7d+GrX6U469lRknjE2xm Nu91p1NFkXdOFankGhY9kQB4iEOlO0KjbOmGdJf54f7XYIg/HCWKURgw9cAABRYzumlA JguBgiOYWDMk0tysUdnz99Vh5IypUg/2ajdR6U3hx7xVS5hlWQfzn43D5a9DNo7vvS+M 0j5qRo/QqTGs4We8khNTxC5F2Nvp7QBjDC9GI15J1weijSlVLJYI8IOE7ikGh0owfDJH 0ZCQ== X-Gm-Message-State: ACgBeo1fRCty4Nl9ucG9CQ02ox8ZMFJCLC10hIMAWCjde3mTR6j6mvqL cj7BR5AeDayANKI4POtSfqLUntwwJm00SM8J X-Received: by 2002:a17:907:7b95:b0:72f:9c64:4061 with SMTP id ne21-20020a1709077b9500b0072f9c644061mr17739117ejc.351.1660069659803; Tue, 09 Aug 2022 11:27:39 -0700 (PDT) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com. [209.85.221.52]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b0072b2ef2757csm1358520ejm.180.2022.08.09.11.27.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Aug 2022 11:27:38 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id bv3so15218947wrb.5 for ; Tue, 09 Aug 2022 11:27:38 -0700 (PDT) X-Received: by 2002:a05:6000:1888:b0:222:ca41:dc26 with SMTP id a8-20020a056000188800b00222ca41dc26mr6957079wri.442.1660069658303; Tue, 09 Aug 2022 11:27:38 -0700 (PDT) MIME-Version: 1.0 References: <20220808073232.8808-1-david@redhat.com> In-Reply-To: <20220808073232.8808-1-david@redhat.com> From: Linus Torvalds Date: Tue, 9 Aug 2022 11:27:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1] mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Andrew Morton , Greg Kroah-Hartman , Axel Rasmussen , Peter Xu , Hugh Dickins , Andrea Arcangeli , Matthew Wilcox , Vlastimil Babka , John Hubbard , Jason Gunthorpe Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm still reading through this, but STOP DOING THIS On Mon, Aug 8, 2022 at 12:32 AM David Hildenbrand wrote: > > + VM_BUG_ON(!is_cow_mapping(vma->vm_flags)); Using BUG_ON() for debugging is simply not ok. And saying "but it's just a VM_BUG_ON()" does not change *anything*. At least Fedora enables that unconditionally for normal people, it is not some kind of "only VM people do this". Really. BUG_ON() IS NOT FOR DEBUGGING. Stop it. Now. If you have a condition that must not happen, you either write that condition into the code, or - if you are convinced it cannot happen - you make it a WARN_ON_ONCE() so that people can report it to you. The BUG_ON() will just make the machine die. And for the facebooks and googles of the world, the WARN_ON() will be sufficient. Linus