Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4724794rwb; Tue, 8 Aug 2023 12:48:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiqnQsR9qykNfSPeNgwYN3yRgbs8e3ESPTpiEW8asFSNmK4le1aTbE3fVpBZN+Nl7dcq6M X-Received: by 2002:a2e:7a11:0:b0:2ba:38c4:1624 with SMTP id v17-20020a2e7a11000000b002ba38c41624mr381676ljc.15.1691524101677; Tue, 08 Aug 2023 12:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524101; cv=none; d=google.com; s=arc-20160816; b=ad6hzXihUJv95BZ/et93n54aoJ4FoMMCwxOYgfEb4bMH68XZE/waN8YjZKpP9usMii xpiaTovz5rxFBhUzXgGm4fhBYzUI9LhKMGXtYhuJRXOWytzkOtJh3ce/jjyi3c/URp2k KCdLxBrVj0Y6GCkmDv17rAJhx3LsSwEJx8q7NaAQaSZeX3jrmMomPAiwwXckfZl9UR8o 3FlOC0hJ24XEJJyAft/twWO5vz2lMkASNPf4sfKjYyVrQ7lxPEp5xs6+Y2XkhobvIKNK eziAQpWn9frlWxz4T6NFqN2yYXV0PQWxVv0z+prUAhEgZYVEROGiCkP090/oHUu1NlJw 6JpA== 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=A07tSATk4WyiLzh2AjGN9k9LM0i/q4SHz/ST015SGFQ=; fh=kjUaokrAaqHFXHZmNvVTNe9fnLF4SMrjSmoxPidr7ng=; b=0585sLnWHW4NMaLv3kI6Dy8eaHrxCzitOHr45hy05aSReljaEmdWjlRW9jx+mt/1Mg cBuLzH2tTo86NTEM+kSCqG0Tr0wC9dTUoBdJG0/FLdVFOqJmYfihpwCjemwHaNA7Y9JT O7POLYd0LEArmou+yBXOaxXuHkOs9jc2/5rDfcM7XSTD2dJFil5pmSxiioFkJSISuJ6i q/obcks6+ErYucyAdq5HSPcA92XBQxmiDkqazDlpnk+iwGE60okAxNxpRvcXs9e6G7Wx bClcsUjESOOwKlBFoCwEweGEU1RBQ8JVFxEz+aBWCsJFB9GygPiW3DE4t9uswIAb6LqR 6ZCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SGlKoO5r; 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 lf7-20020a170906ae4700b00992071c984fsi7874742ejb.954.2023.08.08.12.47.57; Tue, 08 Aug 2023 12:48:21 -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=SGlKoO5r; 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 S232130AbjHHTFD (ORCPT + 99 others); Tue, 8 Aug 2023 15:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233951AbjHHTEn (ORCPT ); Tue, 8 Aug 2023 15:04:43 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E413AAFA12 for ; Tue, 8 Aug 2023 10:48:42 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so9663853e87.2 for ; Tue, 08 Aug 2023 10:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1691516920; x=1692121720; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=A07tSATk4WyiLzh2AjGN9k9LM0i/q4SHz/ST015SGFQ=; b=SGlKoO5r9nAf4C5hJj3RUPzzNTKeA4oZ53vVCq01H8QMjVMbFYOFfkczKzt2Gm1G0F zhJq5I0VHXXxz+0ZGoUtFt1G3Nifx46UF3M44ghk8fikFi3a1mfAKmiCP0v8CQODi6nS s2AN60ll0J4XikLis90qC+hEYEzKAojXbCfVo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691516920; x=1692121720; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A07tSATk4WyiLzh2AjGN9k9LM0i/q4SHz/ST015SGFQ=; b=isPjaY6vFSDwg2hOe8FgBfxwkhAxeP+O9fbrrBewGBCzMXgl1GbAS01/hkv3vPEIQT cpU5f+zguIpRUe52D55cvGYIKLJ1RUK62/SbWrpxqXcl/lyEAp3cqbSLZH3EXlE9IcCU 25sSOn2rpiBMROaPXr8T24aRmhI20OINs9CYSJwAB/zYhTyBoqvILRV94lnyWLXtJam5 sALeG9/NssYP8wsqTyZ0lhdeOT8Q32M/NhsajLWO8OS30tsKF7hDec1bRLFhz8ls0ADE LnQPZle2AoUArwCkZsUS1q3vfFbORE/RrNie5Y04NFmOcLKQdEEtuGfmVvZEgYHyYm7b /pFw== X-Gm-Message-State: AOJu0YwkP5JGZK63XkgEVpAULM/7n49/+GuspwgN+oImLagx8itHrg1x uKXky9Qs2g0PYflofa9B4maNeoSJf7/BwZZJR9MZXSEy X-Received: by 2002:a05:6512:2208:b0:4fd:fabf:b6ee with SMTP id h8-20020a056512220800b004fdfabfb6eemr188751lfu.9.1691516920477; Tue, 08 Aug 2023 10:48:40 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id p18-20020a19f012000000b004fe10276bbfsm1929473lfc.296.2023.08.08.10.48.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Aug 2023 10:48:37 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so9663754e87.2 for ; Tue, 08 Aug 2023 10:48:37 -0700 (PDT) X-Received: by 2002:a05:6512:159c:b0:4fd:f77d:5051 with SMTP id bp28-20020a056512159c00b004fdf77d5051mr149456lfb.26.1691516917321; Tue, 08 Aug 2023 10:48:37 -0700 (PDT) MIME-Version: 1.0 References: <20230806230627.1394689-1-mjguzik@gmail.com> <87o7jidqlg.fsf@email.froward.int.ebiederm.org> <20230808-divers-verehren-02abcc37fe60@brauner> In-Reply-To: <20230808-divers-verehren-02abcc37fe60@brauner> From: Linus Torvalds Date: Tue, 8 Aug 2023 10:48:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] fs: use __fput_sync in close(2) To: Christian Brauner Cc: Mateusz Guzik , "Eric W. Biederman" , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, oleg@redhat.com, Matthew Wilcox Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 On Tue, 8 Aug 2023 at 10:36, Christian Brauner wrote: > > @Linus, you ok with the appended thing? Yes. I do think that the CHECK_DATA_CORRUPTION() case (used to be in filp_close, now in filp_flush) is now very questionable since we'll end up doing an "fput()" on it anyway. But I think that's actually not a new thing - it was always in the wrong place, and only caught the "filp_close()" cases. Which - considering that it would only happen with people using 'fput()' incorrectly - was always quite suspicious. The actual "CHECK_DATA_CORRUPTION()" part of the check is new, but the check itself predates not just the git tree, but the BK history too. Google does find that we had it trigger back in 1998, apparently. I think we should probably remove it entirely - and just depend on all our modern use-after-free infrastructure. Or we could move it into __fput() itself - the ordering wrt any flushing is immaterial, because it's no different from using read or write or whatever on a stale file descriptor - and at least get much better coverage of the situation where it would happen. But that is, I think, a completely separate issue - this is all just made more obvious by the reorganization. Linus