tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

03-asan.patch (2375B)


      1 diff --git a/src/x86/ffi64.c b/src/x86/ffi64.c
      2 index dec331c958c21..b7c7d5218eb14 100644
      3 --- a/src/x86/ffi64.c
      4 +++ b/src/x86/ffi64.c
      5 @@ -549,16 +549,26 @@ ffi_prep_cif_machdep (ffi_cif *cif)
      6     flags |= UNIX64_FLAG_XMM_ARGS;
      7 
      8   cif->flags = flags;
      9   cif->bytes = (unsigned) FFI_ALIGN (bytes, 8);
     10 
     11   return FFI_OK;
     12 }
     13 
     14 +#ifndef __SANITIZE_ADDRESS__
     15 +# ifdef __clang__
     16 +#  if __has_feature(address_sanitizer)
     17 +#   define __SANITIZE_ADDRESS__
     18 +#  endif
     19 +# endif
     20 +#endif
     21 +#ifdef __SANITIZE_ADDRESS__
     22 +__attribute__((noinline,no_sanitize_address))
     23 +#endif
     24 static void
     25 ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
     26 	      void **avalue, void *closure)
     27 {
     28   enum x86_64_reg_class classes[MAX_CLASSES];
     29   char *stack, *argp;
     30   ffi_type **arg_types;
     31   int gprcount, ssecount, ngpr, nsse, i, avn, flags;
     32 diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c
     33 index b68f69ccf68a0..5250e3052df1f 100644
     34 --- a/src/x86/ffiw64.c
     35 +++ b/src/x86/ffiw64.c
     36 @@ -102,16 +102,26 @@ EFI64(ffi_prep_cif_machdep)(ffi_cif *cif)
     37   n += (flags == FFI_TYPE_STRUCT);
     38   if (n < 4)
     39     n = 4;
     40   cif->bytes = n * 8;
     41 
     42   return FFI_OK;
     43 }
     44 
     45 +#ifndef __SANITIZE_ADDRESS__
     46 +# ifdef __clang__
     47 +#  if __has_feature(address_sanitizer)
     48 +#   define __SANITIZE_ADDRESS__
     49 +#  endif
     50 +# endif
     51 +#endif
     52 +#ifdef __SANITIZE_ADDRESS__
     53 +__attribute__((noinline,no_sanitize_address))
     54 +#endif
     55 static void
     56 ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
     57 	      void **avalue, void *closure)
     58 {
     59   int i, j, n, flags;
     60   UINT64 *stack;
     61   size_t rsize;
     62   struct win64_call_frame *frame;
     63 diff --git a/src/x86/ffi.c b/src/x86/ffi.c
     64 --- a/src/x86/ffi.c
     65 +++ b/src/x86/ffi.c
     66 @@ -250,16 +250,26 @@ static const struct abi_params abi_param
     67     #define FFI_DECLARE_FASTCALL __declspec(fastcall)
     68   #endif
     69 #else
     70   #define FFI_DECLARE_FASTCALL
     71 #endif
     72 
     73 extern void FFI_DECLARE_FASTCALL ffi_call_i386(struct call_frame *, char *) FFI_HIDDEN;
     74 
     75 +#ifndef __SANITIZE_ADDRESS__
     76 +# ifdef __clang__
     77 +#  if __has_feature(address_sanitizer)
     78 +#   define __SANITIZE_ADDRESS__
     79 +#  endif
     80 +# endif
     81 +#endif
     82 +#ifdef __SANITIZE_ADDRESS__
     83 +__attribute__((noinline,no_sanitize_address))
     84 +#endif
     85 static void
     86 ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
     87 	      void **avalue, void *closure)
     88 {
     89   size_t rsize, bytes;
     90   struct call_frame *frame;
     91   char *stack, *argp;
     92   ffi_type **arg_types;