Re: Segfault in __c_f_f_c during strace of nptl application.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 21, 2009 at 11:20 AM, John David
Anglin<dave@xxxxxxxxxxxxxxxxxx> wrote:
> Looking at my email archive, I see the real cause involves kernel memory
> maps:
>
>  > > > On Wed, May 06, 2009 at 01:39:49PM -0400, John David Anglin wrote:
>  > > > > > The tombstone is:
>  > > > > >
>  > > > > > do_page_fault() pid=10205 command='strace' type=15 address=0x407d2f18
>  > > > > > vm_start = 0x4068d000, vm_end = 0x4068f000
>  > > > >
>  > > > > So, the pointer passed to __canonicalize_funcptr_for_compare is outside
>  > > > > the vm range.

The strace problem is a compiler flaw.

This is the problem:
* Strace examines the applications syscall.
* Strace extracts, via PTRACE, application addresses, addresses that
don't exist in the strace address space (and should not exist).
* Strace compares extracted address to a constant SIG_ERR.
* Compiler generates a call to __c_f_f_c, which dereference the
extracted address and strace faults.

Strace and the application have completely different address spaces,
and __c_f_f_c can't assume that an address is in the current address
space.

The solution is to detect that a comparison between two pointers is a
comparison between pointer and small constant, and avoid calling
__c_f_f_c for both.

The workaround is to cast both long. I tested this and it works. I'll
submit this to debian as the fix.

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux