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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40E5BC6FD20 for ; Fri, 24 Mar 2023 04:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230471AbjCXERQ (ORCPT ); Fri, 24 Mar 2023 00:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjCXERP (ORCPT ); Fri, 24 Mar 2023 00:17:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A302068B for ; Thu, 23 Mar 2023 21:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=D0f7EC45i242IU2wElEiKlEFZRVpKLfFoMkwGqssIHI=; b=cOa4EkPVuDTLmRDau1GlsRoiIl 3hiLJNEF2ZHSExqAHyty/47hfB4iQXXP9Z2XDtT/cV48m4bOA/DmHzQfC6sNrnnad1lhqxCayvJXy ueJDKKuZrg9Fhlj4uYCpQMOXs5EocEP9h6vOWKPrKogkLb1yenilEcTmEcSSOR65/DABEh8K5NvPR B41WKLoIIv3GCug5TMUCZw/DYcIFyUWFD8XYYgyFM5g8dp4tpfoKFkWvtMVil292tYRukMR/uRxno fjc9T+F3dEeWR5ibzly0qlDLneav8djAQtE3tU8n9Eq43ueOXG2+P8e/fgBZThplgXl/QJl46WGr6 mEqApORQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pfYrV-004Z2C-7i; Fri, 24 Mar 2023 04:17:09 +0000 Date: Fri, 24 Mar 2023 04:17:09 +0000 From: Matthew Wilcox To: Shiyang Ruan Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, dan.j.williams@intel.com, jack@suse.cz, djwong@kernel.org Subject: Re: [PATCH] fsdax: unshare: zero destination if srcmap is HOLE or UNWRITTEN Message-ID: References: <1679483469-2-1-git-send-email-ruansy.fnst@fujitsu.com> <20230322160311.89efea3493db4c4ccad40a25@linux-foundation.org> <20230323151112.1cc3cf57b35f2dc704ff1af8@linux-foundation.org> <4aee7cfd-09d6-43a1-3d8c-15fe5274446b@fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4aee7cfd-09d6-43a1-3d8c-15fe5274446b@fujitsu.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Mar 24, 2023 at 11:42:53AM +0800, Shiyang Ruan wrote: > > > 在 2023/3/24 11:33, Matthew Wilcox 写道: > > On Fri, Mar 24, 2023 at 09:50:54AM +0800, Shiyang Ruan wrote: > > > > > > > > > 在 2023/3/24 6:11, Andrew Morton 写道: > > > > On Thu, 23 Mar 2023 14:50:38 +0800 Shiyang Ruan wrote: > > > > > > > > > > > > > > > > > > > 在 2023/3/23 7:03, Andrew Morton 写道: > > > > > > On Wed, 22 Mar 2023 11:11:09 +0000 Shiyang Ruan wrote: > > > > > > > > > > > > > unshare copies data from source to destination. But if the source is > > > > > > > HOLE or UNWRITTEN extents, we should zero the destination, otherwise the > > > > > > > result will be unexpectable. > > > > > > > > > > > > Please provide much more detail on the user-visible effects of the bug. > > > > > > For example, are we leaking kernel memory contents to userspace? > > > > > > > > > > This fixes fail of generic/649. > > > > > > > > OK, but this doesn't really help. I'm trying to determine whether this > > > > fix should be backported into -stable kernels and whether it should be > > > > fast-tracked into Linus's current -rc tree. > > > > > > > > But to determine this I (and others) need to know what effect the bug > > > > has upon our users. > > > > > > I didn't get any bug report form users. I just found this by running > > > xfstests. The phenomenon of this problem is: if we funshare a reflinked > > > file which contains HOLE extents, the result of the HOLE extents should be > > > zero but actually not (unexpectable data). > > > > You still aren't answering the question. If this did happen to a user, > > what would they see in the file? Random data? Something somebody else > > wrote some time ago? A copy of /etc/passwd, perhaps? A copy of your > > credit card number? > > Ok. If this happenned to a user, the HOLE or UNWRITTEN part will be old > data of the new allocated extent because it didn't be cleared. ie it's the data that was in whatever file happened to use that space last, so this is a security bug because it's a data leak, and a backport is needed, and you should have indicated that by putting a cc: stable tag on the patch?