Re: Recursive SIGSEGV question

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

 



* Xi Ruoyao:

> On 2019-03-25 13:06 +0000, Jonny Grant wrote:
>> 
>> I built & ran with the Sanitizer, it seems it's also stack overflow 
>> within the operator new()
>> 
>> I had thoughts GCC would generate code that monitored the stack size and 
>> aborted with a clear message when the stack size was exceeded. Looked 
>> online, and it doesn't seem to be the case.
>
> Impossible.  We can't distinguish "stack overflow" with other segmentation
> faults.

I think “impossible” is too strong.

It would be possible to annotate implicit probes and explicit probes
generated by -fstack-clash-protection in DWARF, and use that
information to generate a more precise error message.

Or we could set a bit on the guard page that instructs the kernel to
report an additional fault flag somewhere in siginfo_t.  In fact, with
protection keys, we could do this today, without any kernel changes
whatsoever (but protection flags are not widely supported,
unfortunately).

The second approach will have false positives, but as buffer overflows
tend to proceed towards higher addresses and stacks grow downward,
only really bogus pointers would be misreported (and once you have
those, all bets are off anyway).




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux