Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp613699lqp; Fri, 5 Apr 2024 04:00:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBz7D3WAle4B0UQ6NiOuip9XfuwIE9e8TlNi8Y6P3b7PIiGT7Bhu+Wclnd64gWkY8wZeTccdIJCU/afMPH8XNWXJfBDLUkabIUpFL/CQ== X-Google-Smtp-Source: AGHT+IECA+rS5ovMGncUW24fRZYITnllYVovUD5mHfV8uNqpWDMbFOt66gosmUUsKCxMmuW99+Ch X-Received: by 2002:a05:6102:370c:b0:476:e1f5:43b8 with SMTP id s12-20020a056102370c00b00476e1f543b8mr1014403vst.25.1712314839810; Fri, 05 Apr 2024 04:00:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712314839; cv=pass; d=google.com; s=arc-20160816; b=h1HKLP9asUryU7d9s4LDZaJz91q+cworDZCbS61Yvj0Zg3LvXdTGh86rmAyNi1M/bY mQ0qdDs6kNXUhLEivYrkdWhBKGFcHUpLA/oaU3PoVxZ17hbFK8l/uNcokIrsVIo8Tn8+ wRE1/YZBZtoRyudzuR4Pu/+/j49eD0ATUsdy5IC91sk4vAml7ClpP5WWbhcuXi5aRnnm iImgV99nVXiGTJY3A79vVWsqnGrI+BgsiB1315O9DHEuSqr/Osq0AfjqoBUNrmCLxlJs /tJXjmae8o5OmoTFEVo3AJHKm5zDP0Ar/ma9rDmJ/WZ1AkKry6TDI5VZ33/3bKYSKYtP REAw== 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=UblM0Li0P6UsmcVwbLGZBJrGMhjHR0kqGKu6iJzjUxo=; fh=zRG4chGDRgp2crFnemrDV73QepUvWgKMnRKucopNF/w=; b=I2XywRftd9lND27LXt0aFgfND0XmzIdkRS+5dvMhkNx1o+ijuGpYVKufMAs0AxbRHn nXvnTIqu4GeOTlMXYBTjr0EiJ7ll7EXi2NOXoi3ERB4iOyIKQ13sctO1DbWnYr4fmg9i c7pNMw/b7INRYuaRltaQyRNQXjd1Lki4nCiLVMrOWg6Wh0TU/dG5PAUjkuCMfSIyh9F8 38pLlWzSoR6C5U/R7MOKJPd60Fi+QenmeQSJcxBa1M9QGmzjHK1Yr9efhN9sYuhNuaC0 m8pIu/1oedyiC4zlLynrmwecBukog8cHDpSJzytvKMmRYi2fehUrdX/89f8hKReEn9GU IIuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwFAuCt+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-2663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2663-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m12-20020a056102052c00b0047845b916dcsi127813vsa.605.2024.04.05.04.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwFAuCt+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-2663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2663-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 716D01C22610 for ; Fri, 5 Apr 2024 11:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9C1F16ABE2; Fri, 5 Apr 2024 11:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DwFAuCt+" X-Original-To: linux-nfs@vger.kernel.org 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 AEC7114F9D3; Fri, 5 Apr 2024 11:00:34 +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=1712314834; cv=none; b=qoc86RboIDKXOHzuFMIf7FC7JXN0zJOVsL54pl0mNBKGmSiphjMl2JK+njYUkDnHqSi7JeJ36MiHOaJ/U0Vb4HmgjCJv0cexJ+64/6Xvkxn2+3Mvw7jkLjq8VJ6m//ujADzD73t1j0uhbcXfcJFSqy3+jucU2Kziy0o2pKsNQtA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314834; c=relaxed/simple; bh=eF7jpAy9GZ0Ge1VvTyCGRDBc6FYW1+QuIeeIvyaf4oo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HoMgxKArEek+15Bid30pHDTG0ip49O8NjVM8vqwCM+hWQ7q/MD5QSoNPDQ4cP9noUcNfZlrhh/TGEV8cWlfQMgPBMreDFagEtexqfJ7UVtxTk/ULPOF26IfMnK1T/pEgJfPM+4sDLOsSS5PAWQNvuoEU/gOkLa7xU9VuFVQO3uE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DwFAuCt+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7F99C433F1; Fri, 5 Apr 2024 11:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314834; bh=eF7jpAy9GZ0Ge1VvTyCGRDBc6FYW1+QuIeeIvyaf4oo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DwFAuCt+iEP71XmRAgqy8ngUebB6TZI9aukv4b/AnfdWB6M3YV1ahHS9wjayIl5Bm 8SUgIxb/xxItUN0/XfTc+ZzgjJmtG9Hg8bn4kSThQwaHfcBouhX6SzCqRIF2Vw10S8 EB18K2uXGKECrTF1DSM680aLqiI1mdNDKz/LzR1vYaAQY34aS9smMTAZm5yAZlgLb4 TZ+lQOatJYIkWHwhIlXnM2y4P3Y7Ke5sMhwM8hLXGOoLomSsWUQOiJ0z8ZER09uHe8 PnYvwEwORJ/tyhKCyutAhvSzPSHMXBDirMW2h/nBKkj9l2gBYIXpWc3sSJr5AqNHba t6ZU5pNHlrUsw== Date: Fri, 5 Apr 2024 13:00:27 +0200 From: Christian Brauner To: Jan Kara Cc: Kees Cook , "Gustavo A. R. Silva" , Alexander Viro , Chuck Lever , Jeff Layton , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs: Set file_handle::handle_bytes before referencing file_handle::f_handle Message-ID: <20240405-imponieren-scheppern-5e6b6842ccbf@brauner> References: <20240403215358.work.365-kees@kernel.org> <20240404091900.woh6y2a52o7uo5vx@quack3> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240404091900.woh6y2a52o7uo5vx@quack3> On Thu, Apr 04, 2024 at 11:19:00AM +0200, Jan Kara wrote: > On Wed 03-04-24 14:54:03, Kees Cook wrote: > > With adding __counted_by(handle_bytes) to struct file_handle, we need > > to explicitly set it in the one place it wasn't yet happening prior to > > accessing the flex array "f_handle". > > > > Fixes: 1b43c4629756 ("fs: Annotate struct file_handle with __counted_by() and use struct_size()") > > Signed-off-by: Kees Cook > > OK, so this isn't really a functional bug AFAIU but the compiler will > wrongly complain we are accessing handle->f_handle beyond claimed array > size (because handle->handle_bytes == 0 at that point). Am I right? If And really, this also needs to please be mentioned in the commit message because from reading the commit message I'm not even sure what this patch is trying to fix.