Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2772343pxb; Fri, 12 Feb 2021 00:23:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7qiaFXtYhcXHYm68WoCSMsUI4ANS1By04r73RcCKQBs4YMJIIeExvAwEUb6Mslcqk13Dk X-Received: by 2002:a17:907:d25:: with SMTP id gn37mr1890507ejc.303.1613118191027; Fri, 12 Feb 2021 00:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613118191; cv=none; d=google.com; s=arc-20160816; b=Tp8hEQQmc+TjR6XLAn8uERW4pFyDcRxatf/rMQlr+zhm78ftfTG/bIScuXpLHHV4bn lDdYmjylmdxWEzBG0vFZJixEsYdAbwULAJ6SLnsoyIntFKA7M6+XGnJvWKOf5gvkAbu8 yv+R7nNAvhIxgEQvSkomSJGrEjbDbPnqUrSFnMjEAMPL5GrcELZTMUis9d4/UL5DVlPQ DFbY9ZN6OpXJAJLo3blRmfTj62lZmM7kWoAxFrqElc7v4qPG3MRQtTLbDcM8XlkywT97 PL8Eh/azfymb/S0wmjzz+HD+ax9PgCo9IMRiGe0fSFJ0JPuCYSltChlZROFWaXtSuSh9 QxoQ== 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=9eYlj6hQUpTjmYWO1lf/Yhxzwmx2Hj9092MghEwCPMY=; b=tPWrJAKO+OsybdEy89RVUmo5Aslo9jNBCr+05wBGPTT4wvKsx2sSlBc7jzHIkq+YTi ME4ZlOgOY4Wp426PShAneQXR0M1PH0VK0JcMzDrdb0OZfp6fI5WVI6JQeZwBkYTNObSH Qwm2D6kUTfjiJ/NN8wRvTJax0AofAwKIf+ZUHcxe44/uxcSZ936vwGqqGBNfDUtFGWn/ cectbWmQcPEpikUZalBuNXRtl6TrNSzX5LVWz9lq9wGKt+3xa1mfnYxO1Hz7gyhAw0ky w3UKvuRRydemuJb2qVJfjJOQmWVHSv6pX7TERFTQXyiJHOPBLBj59m9CO13sq4uFfHIA tm+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K5xk8xd1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si5420510ejg.296.2021.02.12.00.22.46; Fri, 12 Feb 2021 00:23:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K5xk8xd1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbhBLIVP (ORCPT + 99 others); Fri, 12 Feb 2021 03:21:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbhBLIVK (ORCPT ); Fri, 12 Feb 2021 03:21:10 -0500 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6B6AC061756 for ; Fri, 12 Feb 2021 00:20:29 -0800 (PST) Received: by mail-vs1-xe36.google.com with SMTP id o186so4408174vso.1 for ; Fri, 12 Feb 2021 00:20:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9eYlj6hQUpTjmYWO1lf/Yhxzwmx2Hj9092MghEwCPMY=; b=K5xk8xd16HqUbigXN8BlwaPLjCOqShVd9lxD0yujPtmZqP9Oaku0mPFAZEtFgUeWwN NV1d/6le+5zDnw4HY8TbN2qNaylzKUE5b66s86Jw85ugyYMTFQKEa9+HKcOZFxgbLjth UwwVVRkxJ6Fg5FGUeKSrvdvA9uz2QqY/QdEFo= 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=9eYlj6hQUpTjmYWO1lf/Yhxzwmx2Hj9092MghEwCPMY=; b=Ra6VrFPBHqswxqa3pIEk/vRMx18Tw8CD8iW15aiDdi088rf8L5RIaLbq/56uku6aTt uHCoug/LYdbquUhV5eiAeksrv5Q4BxS4Qj70+CFj8Ef0oMwMZyDOWS0g4UhDOdK4f+yj oKNT4UAA5VzBwwmzsQFsQ7jtut+/CETeRztTZ59Q9vYAGDLTXO125pGuK6rOo94Ou3B3 9jctizBPHHSXlYj7Q/cdOLlUGWA3EVqhzE7g15r/H8hZ1Nti7gczAos/2tC0r8vIs6Re MPi3p3G0duRVJkhJVsAq7L2rfmxPQmbtNxDbESup6nAOOnHcxS2j/3ft/qofqbpse5Vo zTRg== X-Gm-Message-State: AOAM533HI/95QaaIr9oR8QpESf2/Yo2JiHSfQCjxX8wjZRMYX+aIEFrt PR3J9U66jcEtF7HI4YHqcjCr9fa8L3sBbKjLkeML8A== X-Received: by 2002:a05:6102:2327:: with SMTP id b7mr849901vsa.47.1613118028682; Fri, 12 Feb 2021 00:20:28 -0800 (PST) MIME-Version: 1.0 References: <20210212044405.4120619-1-drinkcat@chromium.org> <20210212124354.1.I7084a6235fbcc522b674a6b1db64e4aff8170485@changeid> In-Reply-To: From: Nicolas Boichat Date: Fri, 12 Feb 2021 16:20:17 +0800 Message-ID: Subject: Re: [PATCH 1/6] fs: Add flag to file_system_type to indicate content is generated To: Greg KH Cc: "Darrick J . Wong" , Alexander Viro , Ian Lance Taylor , Luis Lozano , Dave Chinner , linux-fsdevel@vger.kernel.org, lkml Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2021 at 3:46 PM Greg KH wrote: > > On Fri, Feb 12, 2021 at 12:44:00PM +0800, Nicolas Boichat wrote: > > Filesystems such as procfs and sysfs generate their content at > > runtime. This implies the file sizes do not usually match the > > amount of data that can be read from the file, and that seeking > > may not work as intended. > > > > This will be useful to disallow copy_file_range with input files > > from such filesystems. > > > > Signed-off-by: Nicolas Boichat > > --- > > I first thought of adding a new field to struct file_operations, > > but that doesn't quite scale as every single file creation > > operation would need to be modified. > > Even so, you missed a load of filesystems in the kernel with this patch > series, what makes the ones you did mark here different from the > "internal" filesystems that you did not? Which ones did I miss? (apart from configfs, see the conversation on patch 6/6). Anyway, hopefully auditing all filesystems is an order of magnitude easier task, and easier to maintain in the longer run ,-) > This feels wrong, why is userspace suddenly breaking? What changed in > the kernel that caused this? Procfs has been around for a _very_ long > time :) Some of this is covered in the cover letter 0/6. To expand a bit: copy_file_range has only supported cross-filesystem copies since 5.3 [1], before that the kernel would return EXDEV and userspace application would fall back to a read/write based copy. After 5.3, copy_file_range copies no data as it thinks the input file is empty. [1] I think it makes little sense to try to use copy_file_range between 2 files in /proc, but technically, I think that has been broken since copy_file_range fallback to do_splice_direct was introduced (eac70053a141 ("vfs: Add vfs_copy_file_range() support for pagecache copies", ~4.4). > > thanks, > > greg k-h