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: <65c133751a7_4e7f52946@dwillia2-xfh.jf.intel.com.notmuch>
Date: Mon, 5 Feb 2024 11:13:57 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: "Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>, "Peter
 Zijlstra" <peterz@...radead.org>, Dan Williams <dan.j.williams@...el.com>,
	<linux-kernel@...r.kernel.org>
CC: Ingo Molnar <mingo@...nel.org>, <linux-cxl@...r.kernel.org>, "Fabio M. De
 Francesco" <fabio.maria.de.francesco@...ux.intel.com>, Ira Weiny
	<ira.weiny@...el.com>
Subject: RE: [PATCH 1/2] cleanup: Add cond_guard() to conditional guards

Fabio M. De Francesco wrote:
> Add cond_guard() macro to conditional guards.
> 
> cond_guard() is a guard to be used with the conditional variants of locks,
> like down_read_trylock() or mutex_lock_interruptible().
> 
> It takes a statement (or more statements in a block) that is passed to its

s/or more statements in a block/or statement-expression)/

s/to its/as its/

> second argument. That statement (or block) is executed if waiting for a
> lock is interrupted or if a _trylock() fails in case of contention.
> 
> Usage example:
> 
> 	cond_guard(rwsem_read_try, { printk(...); return 0; }, &semaphore);

Missed commenting on this in the last posting, but multi-statement fail
cases that print and return 0 are unlikely to ever be the common case. I
think the most simple to understand example is an interruptible lock
that returns -EINTR on failure:

	cond_guard(mutex_intr, return -EINTR, &mutex);

..and then maybe mention that _fail can be a statement-expression if
needed.

> Consistenly with the other guards, locks are unlocked at the exit of the

s/Consistenly with the other guards/Consistent with other usage of guard()/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ