[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0W5jkiXUkpNl4ap@mail.google.com>
Date: Wed, 12 Oct 2022 07:44:30 +1300
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
To: David Teigland <teigland@...hat.com>
Cc: Kees Cook <keescook@...omium.org>,
Christine Caulfield <ccaulfie@...hat.com>,
cluster-devel@...hat.com, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] dlm: Replace one-element array with
flexible-array member
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.
Powered by blists - more mailing lists