From: Kees Cook <keescook@chromium.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Brian Foster <bfoster@redhat.com>,
linux-bcachefs@vger.kernel.org, kernel test robot <lkp@intel.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] bcachefs: Refactor bkey_i to use a flexible array
Date: Wed, 18 Oct 2023 15:36:00 -0700 [thread overview]
Message-ID: <202310181534.54934E68@keescook> (raw)
In-Reply-To: <20231018220407.b5dvm2ehibcqvhzq@moria.home.lan>
On Wed, Oct 18, 2023 at 06:04:07PM -0400, Kent Overstreet wrote:
> On Fri, Oct 13, 2023 at 04:44:21PM -0700, Kees Cook wrote:
> > On Fri, Oct 13, 2023 at 07:26:11AM -0400, Brian Foster wrote:
> > > Hi Kees,
> > >
> > > I'm curious if this is something that could be buried in bch_val given
> > > it's already kind of a fake structure..? If not, my only nitty comment
> >
> > I was thinking it would be best to keep the flexible array has "high" in
> > the struct as possible, as in the future more refactoring will be needed
> > to avoid having flex arrays overlap with other members in composite
> > structures. So instead of pushing into bch_val, I left it at the highest
> > level possible, bch_i, as that's the struct being used by the memcpy().
>
> I agree with Brian here - I'd like this buried in bch_val, if possible.
>
> I also went with unsafe_memcpy() for now - that's now in my for-next
> tree. I'm not seeing any advantage of DECLARE_FLEX_ARRAY over that -
> perhaps later if we could use __counted_by that would make more sense.
This won't help here because of the combination of -fstrict-flex-arrays=3
and -Wstringop-overflow (the latter is in W=1 builds). The builtin memcpy
still complains about the 0-sized destination. I'll send a v3 with this
in bch_val.
--
Kees Cook
next prev parent reply other threads:[~2023-10-18 22:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 23:56 [PATCH] bcachefs: Refactor bkey_i to use a flexible array Kees Cook
2023-10-13 11:26 ` Brian Foster
2023-10-13 23:44 ` Kees Cook
2023-10-16 12:41 ` Brian Foster
2023-10-16 21:18 ` Kees Cook
2023-10-17 14:12 ` Brian Foster
2023-10-18 22:04 ` Kent Overstreet
2023-10-18 22:36 ` Kees Cook [this message]
2023-10-18 23:08 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202310181534.54934E68@keescook \
--to=keescook@chromium.org \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox