Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2484537rwi; Tue, 11 Oct 2022 09:17:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FdGHIYp7Y2xh0qdpn/keXlP2Y0dL3rVBUH5F5DwwuTy4kjDj30BRSglI1Z2PRWKy0f7z4 X-Received: by 2002:a17:907:8a09:b0:78d:b81e:f92f with SMTP id sc9-20020a1709078a0900b0078db81ef92fmr8402291ejc.620.1665505046356; Tue, 11 Oct 2022 09:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665505046; cv=none; d=google.com; s=arc-20160816; b=mvM4vPs1sf8Oa6bEgOV5KXfxpn1rfQHlcB39FBXAFbuWSVeM43a2YUVTbqssgH+Xvm ctLrXWY49QwlNKl8VAMJJYGD4E+//0XQOOWosvk2Z8lm+FVQtJ4u5PKDJ3nBGehMmrvC 6UD7Kj8TqY2vMsglCvGpNiiqJNx6Md/I/ve03kp0EuWBY6NE49IS9d1Gi/7KE0LGqOjz 90QL7EqxO5z/TH+e/ZOtH5mkC3MduoLudSHqKKS4GvIiCGrBgmewxoY3mOeJCtl2qK6u Ng3c5cWBlqT1oD94/S/jngQxTMVGbQHrKSq5hTokL2nZNk7bk/yebjnhVAeqjrgaiQco 5cJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6KCuFp3jrifWyK2sqLjqh/Wy4NtoZKT4LCqwl1/miSQ=; b=1AW8RFwJJE5pa4z/nW5brynCteFDCJ/PPX9Fpiq47hXPdYeJx84PLlPZFSMQQx9PFh p8H0yTIzf1lXKEUCC+MLEyHAtrDaHoxqUM9fsUD2DUVMJCZwnzGo1Es3Zv05un49NT+v jIeZIQlXSR/Kpz8dCn03rPWmMYiLvAIQbhl/8oJtLiWW9MyLskenAP+qQ/cX6/7T8rxr Icdt7OgqyI+Va8chWdaMxv/ARGkxkr2WimYGeWjba4CkDZupio+89HS4vA6V9IQKBD1D TVUsd/X0XoeHS7ljOLMr6oXHGCio7bqH88JK6u4MIZczn510xaYK8oCcjMWU88vKsfIf IE7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AiNvDlkc; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a056402021200b00459b04a18e5si12838037edv.435.2022.10.11.09.16.52; Tue, 11 Oct 2022 09:17:26 -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=@redhat.com header.s=mimecast20190719 header.b=AiNvDlkc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbiJKPdM (ORCPT + 99 others); Tue, 11 Oct 2022 11:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbiJKPce (ORCPT ); Tue, 11 Oct 2022 11:32:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2C910B7B9 for ; Tue, 11 Oct 2022 08:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665501635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6KCuFp3jrifWyK2sqLjqh/Wy4NtoZKT4LCqwl1/miSQ=; b=AiNvDlkcZY60aGtJMvywDSfHSlD565d9Ur6Mrh2bHQBml7lps6awjkpgnkKd61VX3bgUs1 xNpeyUhjoRJtV6RsW9xcZpSGxamnzWXtdjUegfeUT2X56fNRm6il+l1Ytzp4tGJSzYFMQ5 R4K8EvOn/K9i2mNsz08QLhmRzKSYQAM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-DjhkgqcpOHC9gPiA4EyAyA-1; Tue, 11 Oct 2022 11:20:34 -0400 X-MC-Unique: DjhkgqcpOHC9gPiA4EyAyA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88D88101E148; Tue, 11 Oct 2022 15:20:33 +0000 (UTC) Received: from redhat.com (null.msp.redhat.com [10.15.80.136]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3621C4A9256; Tue, 11 Oct 2022 15:20:33 +0000 (UTC) Date: Tue, 11 Oct 2022 10:20:31 -0500 From: David Teigland To: Kees Cook Cc: Paulo Miguel Almeida , Christine Caulfield , cluster-devel@redhat.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2][next] dlm: Replace one-element array with flexible-array member Message-ID: <20221011152031.GA11089@redhat.com> References: <378C6BDE-0A68-4938-86CD-495BD5F35BE6@chromium.org> <202210082044.51106145BD@keescook> <20221010210039.GA30273@redhat.com> <202210101534.BA51029@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202210101534.BA51029@keescook> User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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, Oct 10, 2022 at 03:35:24PM -0700, Kees Cook wrote: > On Mon, Oct 10, 2022 at 04:00:39PM -0500, David Teigland wrote: > > On Sat, Oct 08, 2022 at 09:03:28PM -0700, Kees Cook wrote: > > > On Sun, Oct 09, 2022 at 03:05:17PM +1300, Paulo Miguel Almeida wrote: > > > > On Sat, Oct 08, 2022 at 05:18:35PM -0700, Kees Cook wrote: > > > > > This is allocating 1 more byte than before, since the struct size didn't change. But this has always allocated too much space, due to the struct padding. For a "no binary changes" patch, the above "+ 1" needs to be left off. > > > > > > > > That's true. I agree that leaving "+ 1" would work and produce a > > > > no-binary-changes patch due to the existing padding that the structure > > > > has. OTOH, I thought that relying on that space could bite us in the > > > > future if anyone tweaks the struct again...so my reaction was to ensure > > > > that the NUL-terminator space was always guaranteed to be there. > > > > Hence, the change on c693 (objdump above). > > > > > > > > What do you think? Should we keep or leave the above > > > > "+ 1" after the rationale above? > > > > > > I think it depends on what's expected from this allocation. Christine or > > > David, can you speak to this? > > > > Hi, thanks for picking through that. Most likely the intention was to > > allow up to 64 (DLM_LOCKSPACE_LEN) character names, and then use the > > ls_name[1] for the terminating byte. I'd be happy to take the patch > > Should this just use: > > char ls_name[DLM_LOCKSPACE_LEN + 1]; > > instead, or is the byte savings worth keeping it dynamically sized? Yes, I think that's the best option. Dave