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: <ZyK-typQQqk0KKPf@kbusch-mbp.dhcp.thefacebook.com>
Date: Wed, 30 Oct 2024 17:18:15 -0600
From: Keith Busch <kbusch@...nel.org>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] PCI/sysfs: Use __free() in reset_method_store()

On Mon, Oct 28, 2024 at 08:18:39PM +0200, Ilpo Järvinen wrote:
> I went to archives and found out it had already made itself into 
> include/linux/cleanup.h which now says this:
> 
> "
>  * Now, when a function uses both __free() and guard(), or multiple
>  * instances of __free(), the LIFO order of variable definition order
>  * matters. GCC documentation says:
>  *
>  * "When multiple variables in the same scope have cleanup attributes,
>  * at exit from the scope their associated cleanup functions are run in
>  * reverse order of definition (last defined, first cleanup)."
>  *
>  * When the unwind order matters it requires that variables be defined
>  * mid-function scope rather than at the top of the file.
> 
> [...snip examples...]
> 
>  * Given that the "__free(...) = NULL" pattern for variables defined at
>  * the top of the function poses this potential interdependency problem
>  * the recommendation is to always define and assign variables in one
>  * statement and not group variable definitions at the top of the
>  * function when __free() is used.
> "
> 
> After reading the documentation for real now myself :-), I realized it's
> not just about maintainer preferences but about order of releasing things, 
> so it's a BAD PATTERN to put those declarations into the usual place when
> using __free().

Okay, I can't argue against that... It still looks unpleasant. :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ