Re: Segfault in __c_f_f_c during strace of nptl application.

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

 



> 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.

Unfortunately, this is necessary to canonicalize function pointers.

> 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.

__c_f_f_c would have to be passed both pointers to detect comparisons
with small constants, or the GCC middle-end would have to detect
comparisons with constants and avoid canonicalization in that case.

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

This is simplest fix.

Dave
-- 
J. David Anglin                                  dave.anglin@xxxxxxxxxxxxxx
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
--
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