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 36322C7EE29 for ; Tue, 23 May 2023 01:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234169AbjEWBXR (ORCPT ); Mon, 22 May 2023 21:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234264AbjEWBXQ (ORCPT ); Mon, 22 May 2023 21:23:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8817B7; Mon, 22 May 2023 18:23:10 -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 D872C61990; Tue, 23 May 2023 01:23:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C954C433D2; Tue, 23 May 2023 01:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684804989; bh=vjk5rZMZaeZfGz8DvSil6k+A6PfapIMUVus7AmNsfMU=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=FSvm9ect3zqer7zjI3xf1P8L/M6O4vv49bjcpdYLXBJ46m6SmJeLkujNgmgla6Gmr 36iyyOEYcsoeeKOZIts+NiGmPIg4VGcZYt/URe2+cIyJuzgq50iaKrFk5hbrcFyuzj DFwO6buNlp3cYxGr1L3GjPFJuT+uBnauX/X++RHH1rixz1z+PGQN1sXM4bI15ANPT3 rsOBLWQOOcz0OfxHENqLtAu/FzuPyYaWO7ON6uZB8aEIZq9bz//xmjBFn9+YK4zIjI A3gorKcrIttkE5d9r1M5Pv+jx1Sp/auQ2wXCHlE5cj/T9RV2DUfkyzvDwNzjfCXWvq Crdt6aOYxm7aQ== Date: Mon, 22 May 2023 18:23:06 -0700 From: Kees Cook To: Eric Biggers , 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 User-Agent: K-9 Mail for Android In-Reply-To: <20230522230206.GA3187780@google.com> References: <20230522213924.never.119-kees@kernel.org> <20230522230206.GA3187780@google.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On May 22, 2023 4:02:06 PM PDT, Eric Biggers wrote: >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=2E > >That seems unlikely, as 'struct fscrypt_symlink_data' is an on-disk data >structure=2E The "len" field does not necessarily use CPU endianness, an= d before >being validated it might be greater than the size of the allocated space= =2E Oh yes, good point=2E >I agree that it should use a flex array (and thanks for catching this one= that I >had forgotten about=2E=2E=2E), but the above explanation seems wrong=2E Shall I spin a v2? --=20 Kees Cook