[Bug 215759] New: KASAN: more OPTIMIZER_HIDE_VAR annotations in tests

3 views
Skip to first unread message

bugzill...@kernel.org

unread,
Mar 27, 2022, 12:09:49 PM3/27/22
to kasa...@googlegroups.com
https://bugzilla.kernel.org/show_bug.cgi?id=215759

Bug ID: 215759
Summary: KASAN: more OPTIMIZER_HIDE_VAR annotations in tests
Product: Memory Management
Version: 2.5
Kernel Version: upstream
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Sanitizers
Assignee: mm_san...@kernel-bugs.kernel.org
Reporter: andre...@gmail.com
CC: kasa...@googlegroups.com
Regression: No

UBSAN, -Wstringop-overflow=, and other compiler features detect the issues
deliberately present in KASAN tests. We need more OPTIMIZER_HIDE_VAR()
annotations.

For example, as reported-by Gustavo A. R. Silva [1]:

lib/test_kasan.c:274:49: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
lib/test_kasan.c:194:63: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
lib/test_kasan.c:139:57: warning: writing 1 byte into a region of size 0
lib/test_kasan.c:145:53: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
lib/test_kasan.c:760:19: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]

Peter and Kees also encountered similar issues and sent patches [2, 3], but
looks like those have not been picked up.

[1] https://twitter.com/embeddedgus/status/1507546690160664579
[2]
https://patchwork.kernel.org/project/linux-hardening/patch/20220213183232.4...@chromium.org/
[3]
https://patchwork.kernel.org/project/linux-mm/patch/2022022400202...@google.com/

--
You may reply to this email to add a comment.

You are receiving this mail because:
You are on the CC list for the bug.

bugzill...@kernel.org

unread,
Sep 24, 2022, 4:30:20 PM9/24/22
to kasa...@googlegroups.com
https://bugzilla.kernel.org/show_bug.cgi?id=215759

--- Comment #1 from Andrey Konovalov (andre...@gmail.com) ---
All of the mentioned warnings has been already fixed.

I just mailed a patch to fix the remaining warnings produced by -Warray-bounds
[1].

[1]
https://lore.kernel.org/linux-mm/9c0210393a8da6fb6887a111a986eb50d...@google.com/

bugzill...@kernel.org

unread,
Oct 18, 2022, 2:58:04 PM10/18/22
to kasa...@googlegroups.com
https://bugzilla.kernel.org/show_bug.cgi?id=215759

Andrey Konovalov (andre...@gmail.com) changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |CODE_FIX

--- Comment #2 from Andrey Konovalov (andre...@gmail.com) ---
The patch has been merged, this issue is now resolved.
Reply all
Reply to author
Forward
0 new messages