[PATCH] D114558: [ASan] Shared optimized callbacks implementation.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 11:10:30 PST 2021


morehouse added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_rtl_x86_64.S:37
+CLABEL(reg, op, 1, i): ;\
+        push   %rcx ;\
+        mov    %##reg,%rcx ;\
----------------
Can use r11 instead of rcx to avoid the push/pop.


================
Comment at: compiler-rt/lib/asan/asan_rtl_x86_64.S:42
+        pop    %rcx ;\
+        jl     RLABEL(reg, op, 1, i);\
+        mov    %##reg,%rdi ;\
----------------
kstoimenov wrote:
> morehouse wrote:
> > Maybe I've confused myself, but isn't this condition opposite of what we want?
> > 
> > ```
> > if (last_accessed_byte >= shadow_value) crash()
> > ```
> > would translate to
> > ```
> > cmp %ecx, %r8d
> > ...
> > jl RLABEL(...)
> > ```
> > or 
> > ```
> > cmp %r8d, %ecx
> > ...
> > jg RLABEL(...)
> > ```
> Here is the disassembled version of __asan_load1: 
> 
>         mov    %rdi,%rax
>         shr    $0x3,%rax
>         movsbl 0x7fff8000(%rax),%eax
>         test   %eax,%eax
>         jne    <__asan_load1+0x13>
>         ret    
>         mov    %edi,%ecx
>         and    $0x7,%ecx
>         cmp    %eax,%ecx
>         jl     <__asan_load1+0x12>
>         xor    %esi,%esi
>         mov    $0x1,%edx
>         xor    %ecx,%ecx
>         mov    $0x1,%r8d
>         jmp    <_ZN6__asanL25ReportGenericErrorWrapperEmbiib>
Yep, I confused the cmp operand order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114558



More information about the llvm-commits mailing list