[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240207152317.do.560-kees@kernel.org>
Date: Wed, 7 Feb 2024 07:24:17 -0800
From: Kees Cook <keescook@...omium.org>
To: Andy Shevchenko <andy@...nel.org>
Cc: Kees Cook <keescook@...omium.org>,
Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Marco Elver <elver@...gle.com>,
Eric Biggers <ebiggers@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: [PATCH v5 0/3] overflow: Introduce wrapping helpers
v5: drop redundant checks (gustavo)
v4: https://lore.kernel.org/linux-hardening/20240206102354.make.081-kees@kernel.org/
v3: https://lore.kernel.org/all/20240205090854.make.507-kees@kernel.org/
v2: https://lore.kernel.org/all/20240130220218.it.154-kees@kernel.org/
v1: https://lore.kernel.org/lkml/20240129182845.work.694-kees@kernel.org/
Hi,
In preparation for gaining instrumentation for signed[1], unsigned[2], and
pointer[3] wrap-around, expand the overflow header to include wrap-around
helpers that can be used to annotate arithmetic where wrapped calculations
are expected (e.g. atomics).
After spending time getting the unsigned integer wrap-around sanitizer
running warning-free on a basic x86_64 boot[4], I think the add/sub/mul
helpers first argument being the output type makes the most sense (as
suggested by Rasmus).
-Kees
Kees Cook (3):
overflow: Adjust check_*_overflow() kern-doc to reflect results
overflow: Introduce wrapping_add(), wrapping_sub(), and wrapping_mul()
overflow: Introduce wrapping_inc() and wrapping_dec()
include/linux/overflow.h | 98 +++++++++++++++++++++++++++++++++++-----
lib/overflow_kunit.c | 67 +++++++++++++++++++++++++--
2 files changed, 149 insertions(+), 16 deletions(-)
--
2.34.1
Powered by blists - more mailing lists