Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3646439rwd; Mon, 22 May 2023 18:00:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RfmfKWlXsYW8h+LL1jHtBGU1KwO3uHCPSiH6OPomvr62R1tNf0CT1tPuN5EhS/J7xD14U X-Received: by 2002:a17:903:2303:b0:1af:a03:8d82 with SMTP id d3-20020a170903230300b001af0a038d82mr12222762plh.57.1684803630025; Mon, 22 May 2023 18:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684803630; cv=none; d=google.com; s=arc-20160816; b=jjVWTmJzFgnYnSSdxpvKblIZKeVI3uS99aYV8T4Z+ilUmYnDP20kqil363taLMBc+z NHHvz3fv7+mrqNPVV3J1a9ONDnW4g9Z0OuabhJL6JGP1lPO5rkJNH6Y/ROmUEIevW+AN ALhMG2VgEIUPzuNdu8MzCcBWlKcC6FgCAra3TmsE4X3KjIUgvYuf02TE9nPgyE1jn+M9 fOpQkxq5gBjKwnSBFYEIBXZRATkn5gGruiSPCmPHzcX1I9CcdwTUQxu/5V+0AWpwa8of J2kK4kLP6/v7xn1sCpLMvZv38XJb2KCri/6NAWAy4bovEEChH+SGhO866uq812j1uBwk qq8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3ig89ceIqd5JpRkt22wwkeY4D/hRW/rfh6Jg+po0SjI=; b=gl98xA8Nt/YCvoJVQVMequdowQmJu5+HNQncAB0yGDKTllwwnFIZFcUQS8mn+tk3pd /9XwfFoC+2tuVNDu21ddQowZNhY31UJ82Enen/P5jHHX8MZ5YW6eUy2+9TEPhStvWFKg IkveLeClBLZohDarJOTexMr9ux8kSUcd8OTkP9VPEU1LMHGqB5ctIyNuSpF0rmJgsvhf f8Gb8ft0As2d/SW3WL6xSo84Dq6aYaHI9XVICEh+qNW0xJEWg7wddaKHMqg5GniLaVHK I3dZk+ybDID5g/8OUswNYqCQLvHf2V6xbgYFyIzcp5VCOMEA2Br08aIzeMXI2BwHFaz+ cSiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o56/0pLv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020a170902759600b001ae3e5b31basi2608502pll.540.2023.05.22.18.00.14; Mon, 22 May 2023 18:00:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o56/0pLv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231502AbjEVXCN (ORCPT + 99 others); Mon, 22 May 2023 19:02:13 -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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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