From: Breno Leitao <leitao@debian.org>
To: kees@kernel.org, elver@google.com, andreyknvl@gmail.com,
ryabinin.a.a@gmail.com
Cc: kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org,
axboe@kernel.dk, asml.silence@gmail.com, netdev@vger.kernel.org
Subject: UBSAN: annotation to skip sanitization in variable that will wrap
Date: Wed, 14 Aug 2024 10:10:10 -0700 [thread overview]
Message-ID: <Zrzk8hilADAj+QTg@gmail.com> (raw)
Hello,
I am seeing some signed-integer-overflow in percpu reference counters.
UBSAN: signed-integer-overflow in ./arch/arm64/include/asm/atomic_lse.h:204:1
-9223372036854775808 - 1 cannot be represented in type 's64' (aka 'long long')
Call trace:
handle_overflow
__ubsan_handle_sub_overflow
percpu_ref_put_many
css_put
cgroup_sk_free
__sk_destruct
__sk_free
sk_free
unix_release_sock
unix_release
sock_close
This overflow is probably happening in percpu_ref->percpu_ref_data->count.
Looking at the code documentation, it seems that overflows are fine in
per-cpu values. The lib/percpu-refcount.c code comment says:
* Note that the counter on a particular cpu can (and will) wrap - this
* is fine, when we go to shutdown the percpu counters will all sum to
* the correct value
Is there a way to annotate the code to tell UBSAN that this overflow is
expected and it shouldn't be reported?
Thanks
--breno
next reply other threads:[~2024-08-14 17:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 17:10 Breno Leitao [this message]
2024-08-14 21:05 ` UBSAN: annotation to skip sanitization in variable that will wrap Justin Stitt
2024-08-15 16:20 ` Kees Cook
2024-08-15 17:58 ` Breno Leitao
2024-08-15 18:40 ` Jens Axboe
2024-08-16 19:47 ` 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=Zrzk8hilADAj+QTg@gmail.com \
--to=leitao@debian.org \
--cc=andreyknvl@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=elver@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ryabinin.a.a@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.