This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Disabling Consistency Checks


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/02/2014 09:26 PM, Carlos O'Donell wrote:
> On 12/02/2014 09:52 AM, Eric Neblock wrote:
>>   Inconsistency detected by ld.so: ../elf/dl-runtime.c: 79: _dl_fixup:
>> Assertion `((reloc->r_info) & 0xffffffff) == 7' failed!
>  
> This means you corrupted memory and the relocation for the PLT
> slot is not a PLT relocation.
>  
>> Now, I'm sure this has to deal with altering another program's code
>> section and there are obvious reasons why we don't want that to happen;
>> however, is there a way that I can disable this check? Or (perhaps even
>> better), what would be the correct way of having Program A stop Program
>> B when a certain line of code is executed that doesn't involve preloading.
> 
> The check is there to tell you that you did something wrong. Disabling
> the check will simply cause the code to fail. You have violated the
> invariant for the code.
> 
> To have program A stop program B you need to attach to it using ptrace,
> and then using the executable A and debug information determine where you
> need to stop and write a breakpoint there. You have to do all of this
> very carefully, like gdb does it.
> 

Thanks a lot for your response!

Regrettably, this is where I'm stuck at and trying to figure out.

I am using ptrace; however, the method I'm using is:

 ptrace(PTRACE_POKETEXT, PID, ADDR_TO_BREAK_AT, (ORIG_INSTRUCTION &
0xFFFFFFFFFFFFFF00) | 0xCC)

on an x86_64 architecture.

I'm getting the ORIG_INSTRUCTION by using a PTRACE_PEEKTEXT at
ADDR_TO_BREAK_AT.

Since that is causing the above error, what would be the better method?

Eric


>> I want to avoid preloading, because right now I want to stop whenever a
>> C program executes a malloc; however, tomorrow I may want to stop at a
>> printf so I'm trying to make things as dynamic as possible.
> 
> You can use preloading to interpose any function an inferior (the program
> being debugged) might call.
> 
> Cheers,
> Carlos.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJUf59HAAoJEKnJ+4MkCuMTAdEH/iW9BJC8P+Ua7fgWjYIXegpq
G+N+VkmmAXSMmBu3BrQjVs5ojf0BVeuIQ4Y+MsGeYXb3QmVDC5zk2qbkhy5oQOGW
F1VLU6fnuzflJwLFfAucCwxGkxrGgliF2/pxi71ODfi8wVSKxz7Puxo37OhLhNDz
tr69jtRMu4akEVjeC3ZiaakQ2Vszt9AW/ca/4XhSsb9oCIktTk/TtsDibK++lJaw
IbxIBz7utgD3+rjAA01utOYc0oMQSsxLF4yJr5lTdjXvoNX9KWq6s+LwhDACLX8m
OSoVMbmXpzhQlBrb0cwMYFrDlEQp20WZwhur1R5uSO6uLGspYrvddL+cYyhKKN8=
=5MdN
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]