lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mr6kpl4zyqqalahxc7s574kc3xemlzfvp423z57yzt6j2nddcj@dx75kkxhi4ch>
Date: Sun, 25 Aug 2024 19:15:29 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Thorsten Blum <thorsten.blum@...lux.com>
Cc: Kees Cook <kees@...nel.org>, 
	"Gustavo A. R. Silva" <gustavoars@...nel.org>, linux-bcachefs@...r.kernel.org, 
	LKML <linux-kernel@...r.kernel.org>, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] bcachefs: Annotate bch_replicas_entry_{v0,v1} with
 __counted_by()

On Mon, Aug 26, 2024 at 01:08:29AM GMT, Thorsten Blum wrote:
> On 26. Aug 2024, at 00:56, Kent Overstreet <kent.overstreet@...ux.dev> wrote:
> > On Sun, Aug 25, 2024 at 10:41:55PM GMT, Thorsten Blum wrote:
> >> On 25. Aug 2024, at 20:43, Kent Overstreet <kent.overstreet@...ux.dev> wrote:
> >>> On Sun, Aug 25, 2024 at 03:36:02PM GMT, Thorsten Blum wrote:
> >>>> Add the __counted_by compiler attribute to the flexible array members
> >>>> devs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> >>>> CONFIG_FORTIFY_SOURCE.
> >>>> 
> >>>> Increment nr_devs before adding a new device to the devs array and
> >>>> adjust the array indexes accordingly.
> >>> 
> >>> The nr_devs changes are pretty gross - please add a helper for that
> >> 
> >> How about a macro in replicas_format.h like this:
> >> 
> >> #define replicas_entry_add_dev(e, d) ({
> >> 	(e)->nr_devs++;
> >> 	(e)->devs[(e)->nr_devs - 1] = (d);
> >> })
> > 
> > Does it need to be a macro?
> 
> It could also be two functions, one for each struct.
> 
> Which one do you prefer?

I suppose the macro fits with what we're doing for
replicas_entry_bytes() - that's alright then

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ