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

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 12:25:25 PDT 2023


vitalybuka accepted this revision.
vitalybuka added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:674
+      Int8PtrTy,
+      ArrayRef(&HWAsanMemTransferArgTys[0], HWAsanMemTransferArgSize), false);
+  const size_t HWAsanMemsetArgSize = UseMatchAllCallback ? 4 : 3;
----------------
Enna1 wrote:
> 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);
>   }
> ```
yes, this also looks good 

```
if (UseMatchAllCallback) {
     HWAsanMemTransferFnTy = FunctionType::get(
        Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy, Int8Ty}, false);
     HWAsanMemsetFnTy = FunctionType::get(
        Int8PtrTy, {Int8PtrTy, Int32Ty, IntptrTy, Int8Ty}, false);
  } else {

  }
```


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