Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp513026lqp; Wed, 12 Jun 2024 08:11:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU7RYEqEj/GB3nEcHcLtBj3/RBcik722XmK7VsCY4zpy4TnjccrBRgqRXvbq6Scd4kx+QGZ4KLSAw0mi9twtjd3kglJNn62xWlCRMqmsA== X-Google-Smtp-Source: AGHT+IEQU6qs9SimEFIIVO00npZDmJMhz/EknA/O0M9uBxFeLnisQ9lWgVj0dXh8Dpwy5WiADYEl X-Received: by 2002:a50:96c4:0:b0:57c:5f7e:d0f1 with SMTP id 4fb4d7f45d1cf-57caaac72f1mr1768743a12.38.1718205111870; Wed, 12 Jun 2024 08:11:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718205111; cv=pass; d=google.com; s=arc-20160816; b=Foc9pduugSv0wnYIQxVE8r1p+QL5FEFNHw5VrIbj6F4FouCjn21qRT+zswukgUsFbv QCwPiVkBZu3cZAmH5Y5H1e1US4aNrRuqwoh1tYow41U8q5btJLSFexOTEU+x+ik/akHz MbXNz7JrAa+1unKKXfuPW8T2wYqZaEZFAeIZ1HbybEexJ7sDkwhi+DgJa66VxnUb1rgs gx353riExJNLa0Jr8x1ZCdoPxM67rrXZZ3MA7LxO0b4jLWEA1LyMAFUvvK2Uxl4BwGe2 XRzI+yuU0oy+NpZOy7N6a2yzWwXy4DDTPXj6F3lcIwCpIxZjjCmuwpQ5AwUVukp6HGcM Kf+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IllfJQQ9j69Q+COonNVeOvD3MHkoISYff8C8RUMbdBg=; fh=PQZbCzrJCkqRL5AVw8JusWxomqjY6rGhaPIQ6wqI2dA=; b=fUOUA/1Py7oHuOvDa1vNSXvWre1gzcZ0KjsD0e3J4SLGH99KmDGrOOI6BHhFSxa2k2 uID4OzciZgV96nuoETmGTrr5BedilNyaSLwZIqT0QdYVc0A+G3FdECBjwv4vtZsODMQD W+I0J7vRlBruDoqWCMlxrWNvQixQPoiCwHAGfRh3uCQ8gmfhlSHn+C7JA8obJ9ge2BFM sbN7yt/vWn1DZErtFAtG1I71pN9qz2BiJpAlVkYHR0FchqF0effwbX3o2ybxt+FsfiOu yk4l+pgQjU4Dx+iHO5IKOZGmg4uT7fOpA7xSJg0QYlmhAxxtL049yYn3vrRXT3dvJNRu pVIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pX1H+S7C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-211759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c68faf76asi5345165a12.615.2024.06.12.08.11.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 08:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pX1H+S7C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-211759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 935271F22080 for ; Wed, 12 Jun 2024 15:11:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 415C1181BB6; Wed, 12 Jun 2024 15:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pX1H+S7C" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6688E181BA9; Wed, 12 Jun 2024 15:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718204862; cv=none; b=bbohWMmF2kDUsemPkKR9nWS4lK7wVFIhh1ouXc13gem5KNKFW29fFdVucMMEJyN/nqx6yD2mJ+q8AfVzP107iEJaZdfkcPQZ6La9gw8dhs+6V06aXmlNRmsvMZQNeN8vtA5YYKE0pD5Vxn3VS7DHSRNduitHbZx+RnGTgWlVO1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718204862; c=relaxed/simple; bh=9NekqWvmrjHgLmsxHX2G+/ZncWBRGFcroyyNaWCh+FI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qQnaTc+dSfnvqrybmSj9XOuriEp1HE2kf8uvwrwat/nu18FQ7uWkQn2O+skyf/jFXewLw7xsHdg+q8UEvW5mkJcSkUaiYi/aebafucLoy66oILy5cyww1xdwTLgyZEenxYlc6Wdm0TcTgdcYRMw/aaBdngUqy9CQFCaf3vPBtMk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pX1H+S7C; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DDB1C116B1; Wed, 12 Jun 2024 15:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718204861; bh=9NekqWvmrjHgLmsxHX2G+/ZncWBRGFcroyyNaWCh+FI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pX1H+S7CCZQQw1Pv2pz13ykdn5K7Ia4/WPa2o37e8o3GeMV2QQ5j2OFpUdVKHFiKX dYRUpxEqa0H4lEfSqHaPVdCFmb1sGamWDDTGeRG3eBNmBpaKDq+1g2TsoN8FwcttTZ WsPbFJRkcAp96zQbd2OqAS8UufRdoiaYiqQwXLTZBpYa44/HWiis+yFUmfgDbuhz+q DjnxaLZ5qdBVh+2lbLwxBqNh+/lZ/tC6q6SfezgmlJMl1TJ5hk+PVjF/7UZwuBNMIe b7NzBDEM/WUwjuWhEQe3A90bPyoonyTsyvsOtPQToO4rM9pJckInFEu650czyhEEye gIgR8diubxYZA== Date: Wed, 12 Jun 2024 08:07:39 -0700 From: Eric Biggers To: Jan Kara Cc: Hugh Dickins , Yosry Ahmed , syzbot , akpm@linux-foundation.org, chengming.zhou@linux.dev, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nphamcs@gmail.com, syzkaller-bugs@googlegroups.com, linux-ext4@vger.kernel.org Subject: Re: [syzbot] [mm?] KMSAN: uninit-value in zswap_store Message-ID: <20240612150739.GA1170@sol.localdomain> References: <000000000000d0f165061a6754c3@google.com> <02a21a55-8fe3-a9eb-f54b-051d75ae8335@google.com> <20240612075027.5pzkkovaewtx63n5@quack3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240612075027.5pzkkovaewtx63n5@quack3> On Wed, Jun 12, 2024 at 09:50:27AM +0200, Jan Kara wrote: > On Tue 11-06-24 02:13:59, Hugh Dickins wrote: > > On Mon, 10 Jun 2024, Yosry Ahmed wrote: > > > Hugh, do you mind taking a quick look at whether this is a real bug? > > > > > > If this is expected behavior, perhaps there is some annotation we can > > > use in zswap that it is fine to encounter uninitialized data when > > > reading the folio. > > > > I've not been faced with a KMSAN report before, so I might well be > > misunderstanding its language: but this looks like an ext4 "bug" to me. > > > > I think the story that the three KMSAN stacks are telling is this: > > syzbot has an ext4 filesystem on a loop device on a tmpfs file (I do > > exactly that too); ext4 is doing some ext4_xattr_inode_write() business, > > in the course of which it writes back a not-fully-initialized block to > > the loop device; shmem faithfully copies that data into its pagecache, > > then later when under memory pressure that page gets "written" out to > > zswap: where zswap_is_page_same_filled() takes an interest in the data, > > and KMSAN objects because some of it was not originally initialized. > > > > If that's a correct interpretation, then it's probably not a big deal: > > it's probably the uninitialized end of a buffer that's written out, > > not any part of the "disk" which ext4 would ever show to a user; but > > I do agree with KMSAN that ext4 would do better to clear that area, > > rather than accidentally storing someone else's super-secret info. > > Yes, that seems to be accurate. ext4_xattr_inode_write() stores large > extended attribute in the inode and we don't bother to zero out the tail of > the block we use since we never access bytes beyond xattr size. Frankly I > don't consider this a bug since the uninitialized bytes are never exposed > to (unpriviledged) userspace. But I agree that out of pure precaution and > because it doesn't cost much in terms of performance we could zero out the > block tail. Writing uninitialized memory to disk is definitely a bug. - Eric