[PATCH] D149943: [hwasan] support hwasan-match-all-tag flag for hwasan meminstrinsic calls

Mingjie Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 00:24:37 PDT 2023


Enna1 added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:674
+      Int8PtrTy,
+      ArrayRef(&HWAsanMemTransferArgTys[0], HWAsanMemTransferArgSize), false);
+  const size_t HWAsanMemsetArgSize = UseMatchAllCallback ? 4 : 3;
----------------
vitalybuka wrote:
> vitalybuka wrote:
> > Can you make use of this constructor
> > ```
> > template <size_t N>
> >     /*implicit*/ constexpr ArrayRef(const std::array<T, N> &Arr)
> > ```
> > 
> > ```
> > FunctionType *HWAsanMemTransferFnTy = FunctionType::get(
> >       Int8PtrTy,       ArrayRef(HWAsanMemTransferArgTys), false);
> > ```
> > Can you make use of this constructor
> > ```
> > template <size_t N>
> >     /*implicit*/ constexpr ArrayRef(const std::array<T, N> &Arr)
> > ```
> 
> sorry, copied wrong one 
> ```
> template <size_t N>
>     /*implicit*/ constexpr ArrayRef(const T (&Arr)[N]) : Data(Arr), Length(N) {}
> 
> ```
> > 
> > ```
> > FunctionType *HWAsanMemTransferFnTy = FunctionType::get(
> >       Int8PtrTy,       ArrayRef(HWAsanMemTransferArgTys), false);
> > ```
> 
> 
Sorry, I'm not sure if this is exactly what you meant:
```
  FunctionType *HWAsanMemTransferFnTy;
  if (UseMatchAllCallback) {
    HWAsanMemTransferFnTy = FunctionType::get(
      Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy, Int8Ty}, false);
  } else {
    HWAsanMemTransferFnTy = FunctionType::get(
      Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy}, false);
  }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149943



More information about the llvm-commits mailing list