Thread (22 messages) 22 messages, 5 authors, 2024-05-02

Re: [PATCH 1/4] locking/atomic/x86: Silence intentional wrapping addition

From: Kees Cook <hidden>
Date: 2024-05-02 14:57:03
Also in: linux-arch, linux-arm-kernel, linux-hardening, lkml

On Fri, Apr 26, 2024 at 08:40:50AM +0100, David Howells wrote:
Kees Cook [off-list ref] wrote:
quoted
-	return i + xadd(&v->counter, i);
+	return wrapping_add(int, i, xadd(&v->counter, i));
Ewww.  Can't you just mark the variable as wrapping in some way, either by:

	unsigned int __cyclic counter;
Yeah, that's the plan now. Justin is currently working on the "wraps"
attribute for Clang:
https://github.com/llvm/llvm-project/pull/86618

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help