[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202405020755.0101DBCB@keescook>
Date: Thu, 2 May 2024 07:57:02 -0700
From: Kees Cook <keescook@...omium.org>
To: David Howells <dhowells@...hat.com>
Cc: Mark Rutland <mark.rutland@....com>, Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Jakub Kicinski <kuba@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Uros Bizjak <ubizjak@...il.com>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
netdev@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH 1/4] locking/atomic/x86: Silence intentional wrapping
addition
On Fri, Apr 26, 2024 at 08:40:50AM +0100, David Howells wrote:
> Kees Cook <keescook@...omium.org> wrote:
>
> > - 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
Powered by blists - more mailing lists