Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2692098rwi; Tue, 11 Oct 2022 12:01:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zN52jF3NKFtq+Jw9CdlBhMdf+fxhiwlEa8GC6vSrqqI3wbBvcSguyOD0JYF6PqdfHIu1P X-Received: by 2002:a05:6a00:230f:b0:53e:2c2c:5c03 with SMTP id h15-20020a056a00230f00b0053e2c2c5c03mr26917545pfh.11.1665514894719; Tue, 11 Oct 2022 12:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665514894; cv=none; d=google.com; s=arc-20160816; b=KHfH9xzDlIfVVpxbK7Qmr5VVhIWGMIkBBbxqgqmYOJwyYkn9V/7B3ejxxi7MJInGq/ Et0r5pXaJ0znjRLzMhMCWERwCJzK1+UnaZsCG+XN0MPWNNU15KOb1vGQkuLbdDSJT19h R/ZJtfhO8rOMTIk9K98U9tkrXMxtiImV00xV2PjZbQ+2UU0Mmy4MtMFHKqfuaD4vgL8v 57XVPw632Xl0G7BVVHhbq44FQS3rOmBDtUrY2PX6bB/RDLQxnMPwdJk4z5IyLvn+LFlg fa7l8HScuagSgUbBzsTfblHKAXJb3JrPUMJjpaSgk5CCdYEIBa5PVlVkZCI0MmX6R5D3 GdWw== 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=So4abhNWYFcv274xdP8VWRO69sa0lbWIaXDw4c76tcc=; b=e5utwFkGfDX+aUTbX7fcQgIXqO81ZhTXljJtnzt9ByQ2dVdy+pMUoXApOwTj4TfbIe 1FbA/sMVTgk5LTqmYGLN2gXutvjS8tF0yLo31opW7wOzLayvTyEqSwkqnr6VvMJFsWYv jQCxH9p3DieMIuP4PYDGX/28rVmi97QiZKQiTf44jJxvgE2oeq7hEASoo1S0PDBE1pOj ppVxFIJrSKaed1pSTUCBnwJ+1EtWM5oL7gFfeFDbuCVeUZLC7qmNEChqLlU+9XN40dP9 bNYos8EfOgc6y9RsNQ+/X8MkBgIaUambgBcKiEJvB71n5B6guMLjQek9msLh3FnbXJM8 2XHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QwMCFkGm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me2-20020a17090b17c200b00205eafb9fdbsi5712175pjb.37.2022.10.11.12.01.18; Tue, 11 Oct 2022 12:01:34 -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=@gmail.com header.s=20210112 header.b=QwMCFkGm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbiJKSot (ORCPT + 99 others); Tue, 11 Oct 2022 14:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbiJKSoo (ORCPT ); Tue, 11 Oct 2022 14:44:44 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26511CE29; Tue, 11 Oct 2022 11:44:41 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id q9so13534423pgq.8; Tue, 11 Oct 2022 11:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=So4abhNWYFcv274xdP8VWRO69sa0lbWIaXDw4c76tcc=; b=QwMCFkGmf5as4oMRr2s+37sf65O2IYJ2UP3HAVQXmkkXH4nasGoL7TRCxhS1z7gbl+ 2mu+JxE54CWqTnCGlzT/AvSduYAsygWPUNwQihLuyVA/0hnTQOk1psxC7Jytj+93KYNw IacvgWz4SrBwzG2Ty4dSeA2/5eop9yFreMk+0sJviXQriX/9ytGH0QT5QvCO34ADyS4u cBqZ2I4KcNKpxPJbHIr4+DCveLOAkbscD5Xn9yLxs+MaeUiudE4pRexfcwYrWA6Ye9Hn j+rACATg8O30iyyuK4Pbd7msDZrcEVEiVzy31Datxlc77hyeImOJmay1tCvcKtE50Hg7 PANg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=So4abhNWYFcv274xdP8VWRO69sa0lbWIaXDw4c76tcc=; b=cfe78BFPr8sS13dldq/Hb490opaiwOGi+o85eRXUwc1l5tCS+EjvCnHTbzZaVMbL4G nmfYdH/J7p7hhywCvxNZZpfQrX2Z3o3rQPKVnHCYY9GPmsCePxhxGr7XiJ0Bpp9QasCY Kl3CmI2zENvqKFT+nXtK2vV7gk/sa16dMyPnseFTEsQUuRA45vV7vC7DuPzdMAkCmPpf P8ULNyrjRaDFm+Cysw2rTybyru6o9wOY3PusLj0SS1stK19jHhP3SvdjuOslGlLNAdUI nBHwIJ92eZy8Syi6Z3XTNvMwjbU3j5f+fVqTqDXVjSJKCI0zYkaCaYazB+7dr42E6PZf q97Q== X-Gm-Message-State: ACrzQf2XjYal7no/Dhwl5smJBGc0OKk2c/3KEtEvHK8GLIlo4n8XXcpc NAVhGit4bTd8VkIyTCSq6V4= X-Received: by 2002:a63:4753:0:b0:462:b3f0:a984 with SMTP id w19-20020a634753000000b00462b3f0a984mr9116030pgk.501.1665513879789; Tue, 11 Oct 2022 11:44:39 -0700 (PDT) Received: from mail.google.com (122-58-209-93-fibre.sparkbb.co.nz. [122.58.209.93]) by smtp.gmail.com with ESMTPSA id t4-20020a17090abc4400b0020d352dc81fsm4565078pjv.54.2022.10.11.11.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:44:38 -0700 (PDT) Date: Wed, 12 Oct 2022 07:44:30 +1300 From: Paulo Miguel Almeida To: David Teigland Cc: Kees Cook , 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: References: <378C6BDE-0A68-4938-86CD-495BD5F35BE6@chromium.org> <202210082044.51106145BD@keescook> <20221010210039.GA30273@redhat.com> <202210101534.BA51029@keescook> <20221011152031.GA11089@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221011152031.GA11089@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Tue, Oct 11, 2022 at 10:20:31AM -0500, David Teigland wrote: > 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 > Thanks for the reply Dave; Thanks for the suggestion Kees; I'll send a new patch for it :) Paulo A.