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

Re: [PATCH 2/4] arm64: atomics: lse: Silence intentional wrapping addition

From: Kees Cook <hidden>
Date: 2024-05-02 15:00:46
Also in: linux-arch, linux-arm-kernel, linux-hardening, lkml

On Thu, May 02, 2024 at 12:21:28PM +0100, Will Deacon wrote:
On Wed, Apr 24, 2024 at 12:17:35PM -0700, Kees Cook wrote:
quoted
Annotate atomic_add_return() and atomic_sub_return() to avoid signed
overflow instrumentation. They are expected to wrap around.

Signed-off-by: Kees Cook <redacted>
---
Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boqun Feng <redacted>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm64/include/asm/atomic_lse.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
How come the ll/sc routines (in atomic_ll_sc.h) don't need the same
treatment? If that's just an oversight, then maybe it's better to
instrument the higher-level wrappers in asm/atomic.h?
Those are all written in asm, so there's no open-coded C arithmetic that
the sanitizers will notice. All is well there! :)

-- 
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