Bug 203493
Summary: | KASAN (sw-tags): add global variables support | ||
---|---|---|---|
Product: | Memory Management | Reporter: | Andrey Konovalov (andreyknvl) |
Component: | Sanitizers | Assignee: | MM/Sanitizers virtual assignee (mm_sanitizers) |
Status: | NEW --- | ||
Severity: | normal | CC: | dvyukov, glider, kasan-dev, melver, ndesaulniers, walter-zh.wu |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | upstream | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
Andrey Konovalov
2019-05-03 15:55:26 UTC
Hi Andrey, We try to reproduce this issue on my environment(Linus 5.3-rc1 + clang 9), but it seem like not to support detection of out-of-bounds accesses for global variables yet. so Does this issue exist? If yes, Should this issue be fixed by compiler or kernel? Hi Walter, Yes, this issues is still valid. This definitely requires changes in Clang and probably in the kernel too. Thanks! Hi Andrey, Sorry to lately respond to you. We recently use tag-based KASAN, it looks like STACK and GLOBAL variable checking are invalid. Because I saw the config has -mllvm -hwasan-instrument-stack=0. We think tag-based KASAN's advantage is exciting, so we want to use KASAN from generic KASAN to tag-based KASAN. Unfortunately, we are not familiar with Clang. Do you know whether any Clang experts have a plan to support it? Walter First we need to remember what's the actual problem with global variables and clang. The root problem is not captured in the report. Potentially the problem is with kernel than clang, because I would assume global variables work in user-space with clang. -hwasan-instrument-stack=0 it related to stack instrumentation, not global variables. Hi Dmitry, Thanks for your reply. I agree with what you said about global variable. We try to get the clang which is work in user-space. but it is sad because it doesn't work in kernel-space. so we stopped. why stack checking is invalid with tag-based KASAN? unit test has something wrong? or? I don't know what was the problem with global variables in generic KASAN, perhaps Alex remembers. For tag-based KASAN, I think there's no support for global variables even in userspace HWASAN implementation. For stack instrumentation in tag-based KASAN there's a separate bug: https://bugzilla.kernel.org/show_bug.cgi?id=203497. The compiler supports it, but it was never implemented in the kernel runtime. (I remember trying to enable it and seeing some false-positive reports, but I've never debugged those.) Globals supported added in: https://github.com/llvm/llvm-project/commit/866ee2353f7d0224644799d0d1faed53c7f3a06d This is fixed for generic mode, but not for sw-tags. |