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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01D5C27C53 for ; Wed, 12 Jun 2024 07:54:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E98A78D0009; Wed, 12 Jun 2024 03:54:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E48D28D0001; Wed, 12 Jun 2024 03:54:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE92A8D0009; Wed, 12 Jun 2024 03:54:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B0CF68D0001 for ; Wed, 12 Jun 2024 03:54:06 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 56C244072E for ; Wed, 12 Jun 2024 07:54:06 +0000 (UTC) X-FDA: 82221473292.13.DE92D7E Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf29.hostedemail.com (Postfix) with ESMTP id 29D63120003 for ; Wed, 12 Jun 2024 07:54:02 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=OAO4ftX0; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=URvqdu35; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=OAO4ftX0; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=URvqdu35; spf=pass (imf29.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718178843; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0nECO5VH26rvrWqSX/kqsFSBcBZ6QGhFggX3HCcXRKs=; b=ww3jlcGECag7pdSsmEdIFI/2VLKdq69A/A8BWHxeIoRpHQ76DKxJjrL+Ncdoaci5Mecsqe WJR+I755LCzentUOU+ij5SJ6VU1ODMR3Y7MmaZfFz63iPctfHHBHC646G54reewMz8p/EH ychSXyQPtjUAX4ogusmEW2UUXxi65VE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=OAO4ftX0; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=URvqdu35; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=OAO4ftX0; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=URvqdu35; spf=pass (imf29.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718178843; a=rsa-sha256; cv=none; b=aJI8gS8AnCUEegQEXnEEVcmdXeXybh3ren7qa6dcxcAC0RPy43EIPyl2M6hmu0d8GYeyMA fLDQkHDzvf7xu5jkDsFaliIoZ8xL9Qmk08kmbh5IHtjzfwI3qOwumqEAGNhApoJdexohng BaJD55huX12osyu8Kh/Rf/5c3KYCqyI= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 139825BDB3; Wed, 12 Jun 2024 07:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718178841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0nECO5VH26rvrWqSX/kqsFSBcBZ6QGhFggX3HCcXRKs=; b=OAO4ftX0VHhGtesSCWGzzFz8W043mhdf8vCEcy/4gL+H7Hlctf0f68k6zL5FpdDggDKOGT V/5CKx7Dr3GqVr+8BpeYc9nUn50x+N8HiIuqxM0oMorOyCQ7o7kQJ+nsUicUeSWINWyLL3 KoL7Pu9DhiNiHoimCa8mdgNE8hmeo3w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718178841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0nECO5VH26rvrWqSX/kqsFSBcBZ6QGhFggX3HCcXRKs=; b=URvqdu35GXkAcUSbpEvXU208bi5upvmGypa6CtyKaO2nkrb6jpV2J+xiHs887apYXUXiq5 p1apIeCxfrRh5wAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718178841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0nECO5VH26rvrWqSX/kqsFSBcBZ6QGhFggX3HCcXRKs=; b=OAO4ftX0VHhGtesSCWGzzFz8W043mhdf8vCEcy/4gL+H7Hlctf0f68k6zL5FpdDggDKOGT V/5CKx7Dr3GqVr+8BpeYc9nUn50x+N8HiIuqxM0oMorOyCQ7o7kQJ+nsUicUeSWINWyLL3 KoL7Pu9DhiNiHoimCa8mdgNE8hmeo3w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718178841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0nECO5VH26rvrWqSX/kqsFSBcBZ6QGhFggX3HCcXRKs=; b=URvqdu35GXkAcUSbpEvXU208bi5upvmGypa6CtyKaO2nkrb6jpV2J+xiHs887apYXUXiq5 p1apIeCxfrRh5wAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 827B91372E; Wed, 12 Jun 2024 07:53:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OlHOHwRUaWbcUQAAD6G6ig (envelope-from ); Wed, 12 Jun 2024 07:53:40 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 554FCA0873; Wed, 12 Jun 2024 09:50:27 +0200 (CEST) Date: Wed, 12 Jun 2024 09:50:27 +0200 From: Jan Kara To: Hugh Dickins Cc: 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, Jan Kara , linux-ext4@vger.kernel.org Subject: Re: [syzbot] [mm?] KMSAN: uninit-value in zswap_store Message-ID: <20240612075027.5pzkkovaewtx63n5@quack3> References: <000000000000d0f165061a6754c3@google.com> <02a21a55-8fe3-a9eb-f54b-051d75ae8335@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02a21a55-8fe3-a9eb-f54b-051d75ae8335@google.com> X-Rspamd-Queue-Id: 29D63120003 X-Rspam-User: X-Rspamd-Server: rspam09 X-Stat-Signature: 3ekr7pozg57yqfk7a6eq1ucg1w5nqjmz X-HE-Tag: 1718178842-747144 X-HE-Meta: U2Fsd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SHDxf1E1R1UuCRbA1KbEOjQyOmiWIjrcQpVMBnfqz+8xh//5hpKspuuVZb/8196+Z7YvkqMvComjS06u34vpdhyyxrFG7YIabTZG9GJRfXWJ/oAn32DT1iy1cT6vSCOR5FUnYCg2RkIW8e2a3EQJHhcdDi9T5P9PnkAB2ATwACDbqeyrlpUvh4EumhG781gBc7Ll9RXGlYnYM+r35G9JQfQrbnYPPMmihvZry9UehpRtammLVCwbz39ub5dUbmOjc+dPg88CR/LdHMmsYgimSA/QzBbXc1VQeCkIjHRtwheLyvh5d+CX4GR5ZvxxonMyVudaE1NTdNDewTP8vi1CSkpUStQ6uEfZDIwVlIlOjujC2Sh97Q24GoQ8xAYSi/eI2DKoCEVwTOhcg9WNaxydT4Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. Honza -- Jan Kara SUSE Labs, CR