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 7A857C77B73 for ; Mon, 22 May 2023 23:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbjEVXCL (ORCPT ); Mon, 22 May 2023 19:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjEVXCJ (ORCPT ); Mon, 22 May 2023 19:02:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D05BBE0; Mon, 22 May 2023 16:02:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67DCE62C8D; Mon, 22 May 2023 23:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97BD7C433D2; Mon, 22 May 2023 23:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684796527; bh=u8N+OPaghwg762KuxUjVvzRa7zi3LaGglh2Va+BvGUU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o56/0pLv5cr+nA88DjGzAvPh11y4D3P6vBdgS3uHc7g9x9OwUty5xnEVTLyUODRap H3dpY4ea4VS/pfANpVXycVaBrKMeHKutUJardXt9O0qBHPcGkhC3hqDH1OQgGHGYJS kfjquvQE7kAoiDIrpdNDOQ+xhNzJo6yiIRAVqkuE6y3SfTS6X8LG4TRWYic1Yx5PWQ M6VwTL8EVmhJ1kiU2dI5Uv0vLLtD7KmtFgpgK6CyfXpu9AlOt/NVs07qFebkVCGWL8 04qpnyGMTfja8wKQ5LkxJeV2u0sq/ieRcELOkKntTVj+uFDiscUt7f1p21PaeKTVme 4UWINAV8E6mgw== Date: Mon, 22 May 2023 23:02:06 +0000 From: Eric Biggers To: Kees Cook Cc: "Theodore Y. Ts'o" , Jaegeuk Kim , "Gustavo A . R . Silva" , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] fscrypt: Replace 1-element array with flexible array Message-ID: <20230522230206.GA3187780@google.com> References: <20230522213924.never.119-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230522213924.never.119-kees@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org On Mon, May 22, 2023 at 02:39:28PM -0700, Kees Cook wrote: > In the future, we can add annotations for the flexible array member > "encrypted_path" to have a size determined by the "len" member. That seems unlikely, as 'struct fscrypt_symlink_data' is an on-disk data structure. The "len" field does not necessarily use CPU endianness, and before being validated it might be greater than the size of the allocated space. I agree that it should use a flex array (and thanks for catching this one that I had forgotten about...), but the above explanation seems wrong. - Eric