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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACMJSevfxqdwOTAhV9CLautgoEur9G+9HWmQY18h38vNE4Vv3w@mail.gmail.com>
Date: Wed, 19 Feb 2025 15:51:12 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
To: "Martin K. Petersen" <martin.petersen@...cle.com>
Cc: James Bottomley <James.Bottomley@...senpartnership.com>, 
	Dan Carpenter <dan.carpenter@...aro.org>, Christoph Hellwig <hch@...radead.org>, 
	Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, 
	rust-for-linux <rust-for-linux@...r.kernel.org>, 
	Linus Torvalds <torvalds@...ux-foundation.org>, Greg KH <gregkh@...uxfoundation.org>, 
	David Airlie <airlied@...il.com>, linux-kernel@...r.kernel.org, ksummit@...ts.linux.dev
Subject: Re: Rust kernel policy

On Wed, 19 Feb 2025 at 15:47, Martin K. Petersen
<martin.petersen@...cle.com> wrote:
>
>
> James,
>
> > Could we possibly fix a lot of this by adopting the _cleanup_
> > annotations[1]? I've been working in systemd code recently and they
> > seem to make great use of this for error leg simplification.
>
> We already have this:
>
>   include/linux/cleanup.h
>
> I like using cleanup attributes for some error handling. However, I'm
> finding that in many cases I want to do a bit more than a simple
> kfree(). And at that point things get syntactically messy in the
> variable declarations and harder to read than just doing a classic goto
> style unwind.
>

The same header also introduced infrastructure for creating "classes"
which are useful if your "destructor" (or "constructor" and structure
definition for that matter) is more complex.

I find the lock guards from the same include very helpful in
simplifying error paths in critical sections.

Bartosz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ