This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Silent stack-heap collision under GNU/Linux
- From: Florian Weimer <fweimer at redhat dot com>
- To: "Vincent Lefevre" <vincent+gcc at vinc17 dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 21 Jul 2014 11:44:39 +0200
- Subject: Re: Silent stack-heap collision under GNU/Linux
- Authentication-results: sourceware.org; auth=none
- References: <20140720174911 dot GE7776 at xvii dot vinc17 dot org>
On 07/20/2014 07:49 PM, Vincent Lefevre wrote:
It appears that GCC can generate code that yields silent stack-heap
collision under GNU/Linux. I mean, the program doesn't crash (at least
not immediately), the memory just gets corrupted. At the same time,
this overrides the stack-size limit defined at the kernel level
(getrlimit system call / RLIMIT_STACK) because the kernel has no
chance to detect the collision (no page fault); thus this limit
doesn't protect the user, and the problem seems to be on GCC's side.
Why aren't such collisions detected by default?
You can try -fstack-check, but it instruments functions unnecessarily.
--
Florian Weimer / Red Hat Product Security