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 A9FFDC433EF for ; Mon, 4 Jul 2022 20:08:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E30A66B0071; Mon, 4 Jul 2022 16:08:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE0356B0073; Mon, 4 Jul 2022 16:08:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCF496B0074; Mon, 4 Jul 2022 16:08:33 -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 BEE5C6B0071 for ; Mon, 4 Jul 2022 16:08:33 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 903E0207D8 for ; Mon, 4 Jul 2022 20:08:33 +0000 (UTC) X-FDA: 79650504906.14.29B0DEF Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 130CF1A0011 for ; Mon, 4 Jul 2022 20:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ox3ejexcnSO2kiSqXPJuX7n+jNsz1cXUFvtntlnSEE0=; b=KPzqGIDnsQbpbNt1Wz0FLR4Yea YTGGUZEI2IkZ47YhlmX7+xh6rCVSFOfOYnClmktO4RMBDRXAUxj3viZFsLa+M+FwuDS5XFriHUZNd pwIf4rbrr5ozbHt95+smAi2y1FG8EZon8fB5o7uI28YWZmkXDGbxnUOYVwtAXw2P+c67wKgA9eQ0G XtA5Z+6oqzemjCMZ7jQ00aqOEVFpQtaCOZXjY8eD1p8MVG374Pd7n/78fePVwK943ag/oUX2890RT y7jzFVZ6dpEEpl1lO3Gp0kIhGZA15MVer+DWorPPva5JQh0TgjuZN3ksg0VqDPW2PGnm3WdLemIc6 CvLSpYfA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8SMB-00HYnF-MF; Mon, 04 Jul 2022 20:07:43 +0000 Date: Mon, 4 Jul 2022 21:07:43 +0100 From: Matthew Wilcox To: Alexander Potapenko Cc: Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 44/45] mm: fs: initialize fsdata passed to write_begin/write_end interface Message-ID: References: <20220701142310.2188015-1-glider@google.com> <20220701142310.2188015-45-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701142310.2188015-45-glider@google.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656965312; 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=ox3ejexcnSO2kiSqXPJuX7n+jNsz1cXUFvtntlnSEE0=; b=qcVLD7zf2Vb+pq5yqHoiISmeXxP2X2yb2FupM2YVQ/rnlcYUFeKrlDoXSWzHqqWVDNYY+t MnXUFF/q5jiQo23FTM1DEI5QOWD4en0gmI6cy9YT5fGzmzwEtkyvD1Fp1vMy6zGJLff0ld edhufyPR/kNbVnou3fdm33Py+MWWWVY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=KPzqGIDn; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656965312; a=rsa-sha256; cv=none; b=yg+lfSdUuJxd9GcE77mJLhTgpW9Db3dOM4Lbmn561bzMCcBEaFUQAH4zWbkcSzo15yAzfd zfb5OkeY75/HLZBcHFI2uL8lHkNaK9wWCKN2bk50S1mXv0lXoSaQD87rAoblqIUNw+oXuI epdbFWRDjhLbibCdT6+R0MUiZRHnxQk= X-Stat-Signature: ysyuuwi46e3e95nq6zo973opuojepbfr X-Rspamd-Queue-Id: 130CF1A0011 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=KPzqGIDn; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1656965309-243082 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: On Fri, Jul 01, 2022 at 04:23:09PM +0200, Alexander Potapenko wrote: > Functions implementing the a_ops->write_end() interface accept the > `void *fsdata` parameter that is supposed to be initialized by the > corresponding a_ops->write_begin() (which accepts `void **fsdata`). > > However not all a_ops->write_begin() implementations initialize `fsdata` > unconditionally, so it may get passed uninitialized to a_ops->write_end(), > resulting in undefined behavior. ... wait, passing an uninitialised variable to a function *which doesn't actually use it* is now UB? What genius came up with that rule? What purpose does it serve?