public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: linux-hardening@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Marco Elver <elver@google.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 0/3] overflow: Introduce wrapping helpers
Date: Mon,  5 Feb 2024 01:12:28 -0800	[thread overview]
Message-ID: <20240205090854.make.507-kees@kernel.org> (raw)

Hi,

v3:
 - reduce patches to just docs and new helpers; we don't need pointer fixes yet.
v2: https://lore.kernel.org/all/20240130220218.it.154-kees@kernel.org/
v1: https://lore.kernel.org/lkml/20240129182845.work.694-kees@kernel.org/

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 *_wrap()
helpers first argument being the output type makes the most sense (as
suggested by Rasmus).

-Kees

Link: https://github.com/KSPP/linux/issues/26 [1]
Link: https://github.com/KSPP/linux/issues/27 [2]
Link: https://github.com/KSPP/linux/issues/344 [3]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=devel/overflow/enable-unsigned-sanitizer [4]

Kees Cook (3):
  overflow: Adjust check_*_overflow() kern-doc to reflect results
  overflow: Introduce add_wrap(), sub_wrap(), and mul_wrap()
  overflow: Introduce inc_wrap() and dec_wrap()

 include/linux/overflow.h | 100 ++++++++++++++++++++++++++++++++++-----
 lib/overflow_kunit.c     |  65 +++++++++++++++++++++++--
 2 files changed, 149 insertions(+), 16 deletions(-)

-- 
2.34.1


             reply	other threads:[~2024-02-05  9:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  9:12 Kees Cook [this message]
2024-02-05  9:12 ` [PATCH v3 1/3] overflow: Adjust check_*_overflow() kern-doc to reflect results Kees Cook
2024-02-05 20:00   ` Gustavo A. R. Silva
2024-02-05  9:12 ` [PATCH v3 2/3] overflow: Introduce add_wrap(), sub_wrap(), and mul_wrap() Kees Cook
2024-02-05 13:31   ` Marco Elver
2024-02-05 19:53     ` Gustavo A. R. Silva
2024-02-06 10:05     ` Kees Cook
2024-02-05 20:21   ` Eric Biggers
2024-02-05 22:44     ` Kees Cook
2024-02-05 23:17       ` Eric Biggers
2024-02-05 23:21         ` Kees Cook
2024-02-06  8:42           ` Rasmus Villemoes
2024-02-06 10:01             ` Kees Cook
2024-02-05  9:12 ` [PATCH v3 3/3] overflow: Introduce inc_wrap() and dec_wrap() Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240205090854.make.507-kees@kernel.org \
    --to=keescook@chromium.org \
    --cc=elver@google.com \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rasmus.villemoes@prevas.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox