[llvm-commits] [compiler-rt] r163301 - /compiler-rt/trunk/lib/interception/mach_override/mach_override.c

Alexander Potapenko glider at google.com
Thu Sep 6 09:42:43 PDT 2012


We don't currently test mach_override, which use is limited to
intercepting functions in ASan on Mac OS.
Because different versions of system libraries even on a certain OS
version may have different prologues, it's quite hard to have an
end-to-end test for ASan that will cover all the cases in
eatKnownInstructions.
On the other hand, this function is basically mapping masked byte
sequences to their lengths without any action depending on them, so it
doesn't make sense to test it separately.

It's still possible to have a synthetic test for mach_override_ptr
that will check we're able to parse certain known prologues. I'll look
into it.

PS. BTW Alexey Samsonov has added the tests for flag parsing you've
asked about last time.

On Thu, Sep 6, 2012 at 7:34 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Thu, Sep 6, 2012 at 2:38 AM, Alexander Potapenko <glider at google.com> wrote:
>> Author: glider
>> Date: Thu Sep  6 04:38:27 2012
>> New Revision: 163301
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=163301&view=rev
>> Log:
>> Add "movsbl %dh, %ecx" and "testb %r8, %r8" to mach_override.
>> This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=105
>
> Test case? (I assume you have some execution tests for ASan &
> hopefully they can be annotated with "run this only on this
> architecture", perhaps?)
>
> - David
>
>>
>>
>> Modified:
>>     compiler-rt/trunk/lib/interception/mach_override/mach_override.c
>>
>> Modified: compiler-rt/trunk/lib/interception/mach_override/mach_override.c
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/mach_override/mach_override.c?rev=163301&r1=163300&r2=163301&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/lib/interception/mach_override/mach_override.c (original)
>> +++ compiler-rt/trunk/lib/interception/mach_override/mach_override.c Thu Sep  6 04:38:27 2012
>> @@ -701,6 +701,7 @@
>>         { 0x3, {0xFB, 0xFF, 0x00}, {0x48, 0x89, 0x00} },                                    // mov %reg, %reg
>>         { 0x3, {0xFB, 0xFF, 0x00}, {0x49, 0x89, 0x00} },                                    // mov %reg, %reg (REX.WB)
>>         { 0x2, {0xFF, 0x00}, {0x41, 0x00} },                                            // push %rXX
>> +       { 0x2, {0xFF, 0x00}, {0x84, 0x00} },                                            // test %rX8,%rX8
>>         { 0x2, {0xFF, 0x00}, {0x85, 0x00} },                                            // test %rX,%rX
>>         { 0x2, {0xFF, 0x00}, {0x77, 0x00} },                                            // ja $i8
>>         { 0x2, {0xFF, 0x00}, {0x74, 0x00} },                                            // je $i8
>> @@ -724,6 +725,7 @@
>>          { 0x2, {0xFF, 0x00}, {0x89, 0x00} },                               // mov r/m32,r32 or r/m16,r16
>>          { 0x3, {0xFF, 0xFF, 0xFF}, {0x49, 0x89, 0xF8} },                   // mov %rdi,%r8
>>          { 0x4, {0xFF, 0xFF, 0xFF, 0xFF}, {0x40, 0x0F, 0xBE, 0xCE} },       // movsbl %sil,%ecx
>> +        { 0x3, {0xFF, 0xFF, 0xFF}, {0x0F, 0xBE, 0xCE} },  // movsbl, %dh, %ecx
>>          { 0x3, {0xFF, 0xFF, 0x00}, {0xFF, 0x77, 0x00} },  // pushq $imm(%rdi)
>>          { 0x2, {0xFF, 0xFF}, {0xDB, 0xE3} }, // fninit
>>          { 0x3, {0xFF, 0xFF, 0xFF}, {0x48, 0x85, 0xD2} },  // test %rdx,%rdx
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list