[libc-commits] [PATCH] D78612: [libc] Add sanitizer instrumentation to the SIMD strlen implementation.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Apr 22 11:58:24 PDT 2020


sivachandra added a comment.

In D78612#1997446 <https://reviews.llvm.org/D78612#1997446>, @abrachet wrote:

> In D78612#1997364 <https://reviews.llvm.org/D78612#1997364>, @sivachandra wrote:
>
> > There is an alternate approach we can take here: We can keep the `safe_word_check` function unsanitized without any instrumentation. Since the main function is sanitized, it will catch bad memory reads as it does the reading again anyway. This is probably a nice compromise, but I would like to hear about the spirit of such an approach: we are not sanitizing one function at all.
>
>
> This makes a lot of sense, I am in strong favor of this approach. We keep both the performance of D77949 <https://reviews.llvm.org/D77949> and we achieve the goal of easy sanitization. Theres also a lot of merit in pulling out the unsafe bits of a function and explicitly marking them as such, it documents we understand it is UB and is a good starting point if there are ever any bugs.


For completeness, I would like to point out that it will not catch bad strings. But, I am not sure if it is the job of `strlen` to catch bad strings. If we ensure that the implementation is safe for good strings, we are probably good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78612





More information about the libc-commits mailing list