[libc-commits] [PATCH] D106919: [libc][wip] add integration tests for scudo in libc

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 28 15:10:52 PDT 2021


michaelrj added inline comments.


================
Comment at: libc/lib/CMakeLists.txt:7
 
+if(COMPILER_RT_BUILD_GWP_ASAN)
+  list(APPEND SCUDO_DEPS RTGwpAsan.${LIBC_TARGET_ARCHITECTURE} RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE} RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE})
----------------
sivachandra wrote:
> michaelrj wrote:
> > hctim wrote:
> > > sivachandra wrote:
> > > > michaelrj wrote:
> > > > > sivachandra wrote:
> > > > > > hctim wrote:
> > > > > > > `COMPILER_RT_HAS_GWP_ASAN`
> > > > > > Should this be under `if(LLVM_LIBC_INCLUDE_SCUDO)`?
> > > > > I can't make this COMPILER_RT_HAS_GWP_ASAN since that variable won't be defined yet because the llvm libc cmake code runs before the compiler-rt cmake code does.
> > > > > 
> > > > > If this was under `if(LLVM_LIBC_INCLUDE_SCUDO)` then you couldn't include GWP-ASan without also including SCUDO, and I figured it was better to give the user the option.
> > > > Is GWP-ASan useful without something like SCUDO calling into it?
> > > That seems weird that libc's full cmake runs before compiler-rt's config-ix.
> > > 
> > > I think you might run into a problem where you want GWP-ASan, but GWP-ASan isn't supported on your architecture (like mips). In these cases `COMPILER_RT_BUILD_GWP_ASAN == True` but `COMPILER_RT_HAS_GWP_ASAN == False`.
> > > 
> > > > Is GWP-ASan useful without something like SCUDO calling into it?
> > > 
> > > Nope, GWP-ASan needs be called from malloc().
> > based on this I've moved the `if(COMPILER_RT_BUILD_GWP_ASAN)` inside of the `if(LLVM_LIBC_INCLUDE_SCUDO)`. 
> > As for the cmake running order, I'm not actually sure how it ends up working, but I do know that `COMPILER_RT_HAS_GWP_ASAN` wasn't defined when I tried to use it in this case. Could it have something to do with scopes? I'm not very experienced with cmake.
> Try setting `COMPILER_RT_HAS_GWP_ASAN` in the `PARENT_SCOPE`?
I have now tried that, and it didn't seem to work. I'm not sure why though, given that I think the parent scope should be the one above the `compiler-rt` directory. My guess would be that the problem is the execution order, but if you have other things to try feel free to suggest them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106919



More information about the libc-commits mailing list