[PATCH] D119816: Fix not working attribute no_sanitize bounds that affects linux kernel

Marco Elver via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 18 04:40:09 PST 2022


melver added a comment.

What about this test then: https://github.com/llvm/llvm-project/blob/b0a0df980927ca54a7840a1b0c9766e98c05039b/clang/test/CodeGen/sanitize-coverage.c#L74

Can you show an independent C reproducer where no_sanitize does not work for you?

Is there an LKML discussion?

I also think sprinkling no_sanitize for UBSAN is again the wrong solution, as it was also for [1]. UBSAN has a tendency to generate too many false positives in the kernel, and we just have to work on finding solutions that tackle the problem wholesale rather than adding more band-aids.

In this case, I think the right solution is to simply make ksize() kill the optimizer's ability to know the object size. By definition ksize() will return the "true" allocation size, and it is fair to assume once that's called, the caller wants to use the full object size for its size-class.

[1] https://lore.kernel.org/all/20211111003519.1050494-1-tadeusz.struk@linaro.org/T/#u


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119816/new/

https://reviews.llvm.org/D119816



More information about the cfe-commits mailing list