[PATCH 1/5] refcount: Remove unused __signed_wrap function annotations

0 views
Skip to first unread message

Kees Cook

unread,
Mar 31, 2026, 12:37:28 PM (10 days ago) Mar 31
to Peter Zijlstra, Kees Cook, Will Deacon, Boqun Feng, Mark Rutland, Gary Guo, Nathan Chancellor, Marco Elver, Miguel Ojeda, Przemek Kitszel, Justin Stitt, Linus Torvalds, Jonathan Corbet, Nicolas Schier, Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton, linux-...@vger.kernel.org, kasa...@googlegroups.com, linux-h...@vger.kernel.org, linu...@vger.kernel.org, linux-...@vger.kernel.org, ll...@lists.linux.dev
With CONFIG_UBSAN_INTEGER_WRAP being replaced by Overflow Behavior
Types, remove the __signed_wrap function annotation as it is already
unused, and any future work here will use OBT annotations instead.

Signed-off-by: Kees Cook <ke...@kernel.org>
---
Cc: Will Deacon <wi...@kernel.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Boqun Feng <bo...@kernel.org>
Cc: Mark Rutland <mark.r...@arm.com>
Cc: Gary Guo <ga...@garyguo.net>
Cc: Nathan Chancellor <nat...@kernel.org>
Cc: Marco Elver <el...@google.com>
Cc: Miguel Ojeda <oj...@kernel.org>
Cc: Przemek Kitszel <przemysla...@intel.com>
---
include/linux/compiler_types.h | 9 +--------
include/linux/refcount.h | 10 +++++-----
2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 890076d0974b..e8fd77593b68 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -432,18 +432,11 @@ struct ftrace_likely_data {
#define at_least
#endif

-/* Do not trap wrapping arithmetic within an annotated function. */
-#ifdef CONFIG_UBSAN_INTEGER_WRAP
-# define __signed_wrap __attribute__((no_sanitize("signed-integer-overflow")))
-#else
-# define __signed_wrap
-#endif
-
/* Section for code which can't be instrumented at all */
#define __noinstr_section(section) \
noinline notrace __attribute((__section__(section))) \
__no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage \
- __no_sanitize_memory __signed_wrap
+ __no_sanitize_memory

#define noinstr __noinstr_section(".noinstr.text")

diff --git a/include/linux/refcount.h b/include/linux/refcount.h
index 3da377ffb0c2..ba7657ced281 100644
--- a/include/linux/refcount.h
+++ b/include/linux/refcount.h
@@ -170,7 +170,7 @@ static inline unsigned int refcount_read(const refcount_t *r)
return atomic_read(&r->refs);
}

-static inline __must_check __signed_wrap
+static inline __must_check
bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp)
{
int old = refcount_read(r);
@@ -212,7 +212,7 @@ static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
return __refcount_add_not_zero(i, r, NULL);
}

-static inline __must_check __signed_wrap
+static inline __must_check
bool __refcount_add_not_zero_limited_acquire(int i, refcount_t *r, int *oldp,
int limit)
{
@@ -244,7 +244,7 @@ __refcount_inc_not_zero_limited_acquire(refcount_t *r, int *oldp, int limit)
return __refcount_add_not_zero_limited_acquire(1, r, oldp, limit);
}

-static inline __must_check __signed_wrap
+static inline __must_check
bool __refcount_add_not_zero_acquire(int i, refcount_t *r, int *oldp)
{
return __refcount_add_not_zero_limited_acquire(i, r, oldp, INT_MAX);
@@ -277,7 +277,7 @@ static inline __must_check bool refcount_add_not_zero_acquire(int i, refcount_t
return __refcount_add_not_zero_acquire(i, r, NULL);
}

-static inline __signed_wrap
+static inline
void __refcount_add(int i, refcount_t *r, int *oldp)
{
int old = atomic_fetch_add_relaxed(i, &r->refs);
@@ -383,7 +383,7 @@ static inline void refcount_inc(refcount_t *r)
__refcount_inc(r, NULL);
}

-static inline __must_check __signed_wrap
+static inline __must_check
bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
{
int old = atomic_fetch_sub_release(i, &r->refs);
--
2.34.1

Reply all
Reply to author
Forward
0 new messages