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: <62qt435bsvvhstxhn2utpio7owmk6ddjuyzkjv3tvbnh2f5xoz@56kd22dgyjqg>
Date: Tue, 27 May 2025 14:20:03 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Bharadwaj Raju <bharadwaj.raju777@...il.com>
Cc: linux-bcachefs@...r.kernel.org, shuah@...nel.org, 
	linux-kernel@...r.kernel.org, linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH bcachefs-testing] bcachefs: fix goto jumping over guard
 initializers

On Tue, May 27, 2025 at 11:09:00PM +0530, Bharadwaj Raju wrote:
> Now I'm actually not sure this is the best solution -- the comments in
> include/linux/cleanup.h say that gotos and cleanup helpers should never be
> mixed in the same function in the first place. So ideally we should not use
> these guard helpers until we develop helpers for everything that
> we want to clean up using gotos, like printbuf_exit, bch2_trans_put,
> and so on, and then switch over everything at once.

I believe that's too strict; a goto that jumps after a CLASS()
initialized object in the same scope clearly doesn't work, and probably
the same is true for a goto that jumps backwards over a CLASS()
initialization in the same scope (doesn't come up as much, haven't
checked).

But a goto that works like a break statement - jumping forwards out of a
scope with a CLASS() object should be fine, and likewise for gotos that
stay in the same scope and don't jump over CLASS() object initializers.

(gotos that jump backwards out of scopes, or forwards into scopes, are
really problematic for compilers to model; 'break' style gotos are much
easier for them).

So we should be ok with those rare cases fixed, and I'm running the full
test suite on this series with lockdep/kasan/leak checking enabled.

Agreed that it would be good to get everything converted. I've already
done printbufs and btree_trans objects, but we still need darrays,
wrappers for various device/filesystem refcounts (and the
for_aach_device() macros might be tricky to convert, but worthwhile),
and btree iterators.

Btree iterators have an exit function that takes a pointer to
btree_trans as well, and it didn't look like DEFINE_CLASS() could handle
that directly - will have to look at how the lock/unlock guards work.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ