linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Annotate atomics for signed integer wrap-around
@ 2024-04-24 19:17 Kees Cook
  2024-04-24 19:17 ` [PATCH 1/4] locking/atomic/x86: Silence intentional wrapping addition Kees Cook
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Kees Cook @ 2024-04-24 19:17 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Kees Cook, Jakub Kicinski, Will Deacon, Peter Zijlstra,
	Boqun Feng, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Catalin Marinas, Arnd Bergmann,
	Andrew Morton, David S. Miller, David Ahern, Eric Dumazet,
	Paolo Abeni, Paul E. McKenney, Uros Bizjak, linux-kernel, x86,
	linux-arm-kernel, linux-arch, netdev, linux-hardening

Hi,

As part of enabling the signed integer overflow sanitizer for production
use, we have to annotated the atomics which expect to use wrapping signed
values. Do this for x86, arm64, and the fallbacks. Additionally annotate
the first place anyone will trip over signed integer wrap-around: ipv4,
which has traditionally included the comment hint about how to debug
sanitizer issues.

Since this touches 2 architectures and netdev, I think it might be
easiest if I carry this in the hardening tree, or maybe via the netdev
tree. Thoughts?

Thanks!

-Kees

Kees Cook (4):
  locking/atomic/x86: Silence intentional wrapping addition
  arm64: atomics: lse: Silence intentional wrapping addition
  locking/atomic: Annotate generic atomics with wrapping
  ipv4: Silence intentional wrapping addition

 arch/arm64/include/asm/atomic_lse.h          | 10 ++++++----
 arch/x86/include/asm/atomic.h                |  3 ++-
 arch/x86/include/asm/atomic64_32.h           |  2 +-
 arch/x86/include/asm/atomic64_64.h           |  2 +-
 include/asm-generic/atomic.h                 |  6 +++---
 include/asm-generic/atomic64.h               |  6 +++---
 include/linux/atomic/atomic-arch-fallback.h  | 19 ++++++++++---------
 include/linux/atomic/atomic-instrumented.h   |  3 ++-
 include/linux/atomic/atomic-long.h           |  3 ++-
 include/net/ip.h                             |  4 ++--
 lib/atomic64.c                               | 10 +++++-----
 net/ipv4/route.c                             | 10 +++++-----
 scripts/atomic/fallbacks/dec_if_positive     |  2 +-
 scripts/atomic/fallbacks/dec_unless_positive |  2 +-
 scripts/atomic/fallbacks/fetch_add_unless    |  2 +-
 scripts/atomic/fallbacks/inc_unless_negative |  2 +-
 scripts/atomic/gen-atomic-fallback.sh        |  1 +
 scripts/atomic/gen-atomic-instrumented.sh    |  1 +
 scripts/atomic/gen-atomic-long.sh            |  1 +
 19 files changed, 49 insertions(+), 40 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-05-02 15:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 19:17 [PATCH 0/4] Annotate atomics for signed integer wrap-around Kees Cook
2024-04-24 19:17 ` [PATCH 1/4] locking/atomic/x86: Silence intentional wrapping addition Kees Cook
2024-04-24 22:41   ` Peter Zijlstra
2024-04-24 22:45     ` Kees Cook
2024-04-24 22:54       ` Peter Zijlstra
2024-04-24 23:05         ` Peter Zijlstra
2024-04-24 23:30           ` Kees Cook
2024-04-25  9:28             ` Peter Zijlstra
2024-04-25 10:19               ` Mark Rutland
2024-04-24 23:20         ` Kees Cook
2024-04-25  9:17           ` Peter Zijlstra
2024-04-25 17:39             ` Kees Cook
2024-04-25 10:15       ` Mark Rutland
2024-04-25 17:19         ` Kees Cook
2024-04-24 22:51     ` Peter Zijlstra
2024-04-24 19:17 ` [PATCH 2/4] arm64: atomics: lse: " Kees Cook
2024-05-02 11:21   ` Will Deacon
2024-05-02 15:00     ` Kees Cook
2024-04-24 19:17 ` [PATCH 3/4] locking/atomic: Annotate generic atomics with wrapping Kees Cook
2024-04-24 19:17 ` [PATCH 4/4] ipv4: Silence intentional wrapping addition Kees Cook
2024-04-26  7:40 ` [PATCH 1/4] locking/atomic/x86: " David Howells
2024-05-02 14:57   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).