This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SafeStack proposal in GCC
- From: Ian Lance Taylor <iant at google dot com>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Cc: Michael Matz <matz at suse dot de>, Rich Felker <dalias at libc dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 9 May 2016 14:21:59 -0700
- Subject: Re: SafeStack proposal in GCC
- Authentication-results: sourceware.org; auth=none
- References: <CAFA9rWPkb=eV0GhvFeOnd4pRVh=N3fSifYBwZjy9Ndh68BmBww at mail dot gmail dot com> <0d50f0ef01b24c25a79a6f18eaddfd6d at REXA dot intranet dot epfl dot ch> <CANL6WeqEwFYx2H-sv81K8CDFypiJ+ray+xPyRH+7kitTpD8bqw at mail dot gmail dot com> <20160507054212 dot GE21636 at brightrain dot aerifal dot cx> <alpine dot LSU dot 2 dot 20 dot 1605092101000 dot 13156 at wotan dot suse dot de> <20160509193503 dot GF21636 at brightrain dot aerifal dot cx> <alpine dot LSU dot 2 dot 20 dot 1605092147020 dot 13156 at wotan dot suse dot de> <c0dacbbe-dccc-8d99-be0c-7f7f2dde24a4 at oarcorp dot com> <CAKOQZ8xS9xqMsOEGPUN9X0=itu862mLp7g69wVh8cRun3nqmWA at mail dot gmail dot com> <8f0badfc-58fd-1831-6d47-9f6a4be8d9da at oarcorp dot com>
On Mon, May 9, 2016 at 2:03 PM, Joel Sherrill <joel.sherrill@oarcorp.com> wrote:
>
> On 5/9/2016 3:41 PM, Ian Lance Taylor wrote:
>>
>> On Mon, May 9, 2016 at 1:07 PM, Joel Sherrill <joel.sherrill@oarcorp.com>
>> wrote:
>>>
>>>
>>> One complication on RTEMS which is a single process, multi-threaded RTOS
>>> is that we can no longer check the stack bounds. For threads, we know
>>> where the stack memory is and the range for each thread. For ucontext_t,
>>> it seems this knowledge is unknown to the RTOS.
>>>
>>> Thus it would become the responsibility of the run-time using ucontext_t
>>> to put in fence patterns and check those.
>>
>>
>> On RTEMS and similar systems, you could write makecontext to register
>> the stack (whose start and length are known to the function) with the
>> RTOS.
>
>
> Ahh... slow today. swapcontext() would have to work with the stack
> checker.
> Interesting.. the stack usage reporting would have to be taught
> about the ucontext_t's in the system and report those as well.
>
> Am I missing something or is there no way to know when a context
> goes out of existence in the API?
That is correct. Good point.
Ian