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

Tong Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 18 10:24:42 PST 2022


ztong0001 added a comment.

In D119816#3332441 <https://reviews.llvm.org/D119816#3332441>, @nlopes wrote:

> The main issue is that the kernel is wrong. It has a bug. The sanitizer's error is not a false-positive!
> So what you are proposing is a band-aid. It's not a real solution and it's just masking a wider problem. LLVM knows that kmalloc(x) allocates x bytes because someone placed an `__attribute__ ((alloc_size (1)))` on kmalloc. That attribute is just wrong and should be removed. It allows LLVM to mark all accesses beyond `kmalloc(x) + x - 1` as undefined behavior.

But isn't this something the author intended to do in order to catch an error? 
`ksize()` case makes some exceptions out of this.

> TL;DR: this patch is not the solution for your problems.




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