[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220124232342.3113350-1-keescook@chromium.org>
Date: Mon, 24 Jan 2022 15:23:40 -0800
From: Kees Cook <keescook@...omium.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Jason Gunthorpe <jgg@...pe.ca>,
Leon Romanovsky <leon@...nel.org>,
Keith Busch <kbusch@...nel.org>, Len Baker <len.baker@....com>,
Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: [PATCH v2 0/2] overflow: Implement size_t saturating arithmetic helpers
Hi,
While doing more array_size() scans on the kernel, and reviewing recent[1]
struct_size() work[2], it became clear we needed helpers to perform
composed saturating adds and multiplies. This creates those helpers and
updates the self tests to check them.
v1: https://lore.kernel.org/lkml/20210920180853.1825195-1-keescook@chromium.org/
v2:
- use static inlines instead of macros (Rasmus)
- undef local helpers defs in selftest (Rasmus)
- Make sure to keep saturation for size_sub() arguments
- update selftests for size_sub() behavior
- Add reviews
Thanks,
-Kees
[1] https://lore.kernel.org/linux-hardening/202201241213.82E7D9F598@keescook/
[2] https://lore.kernel.org/lkml/?q=%22open-coded+arithmetic%22
Kees Cook (2):
test_overflow: Regularize test reporting output
overflow: Implement size_t saturating arithmetic helpers
Documentation/process/deprecated.rst | 20 +++-
include/linux/overflow.h | 110 +++++++++++--------
lib/test_overflow.c | 152 ++++++++++++++++++++++-----
3 files changed, 214 insertions(+), 68 deletions(-)
--
2.30.2
Powered by blists - more mailing lists