[PATCH 2/4] score: Add validation that no extensions are null.
Jennifer Averett
Jennifer.Averett at OARcorp.com
Fri Apr 18 19:23:02 UTC 2014
I get it from the following:
Breakpoint 4, _User_extensions_Thread_terminate_visitor (executing=0x2038d78, arg=0x2038d78, callouts=0x202d76c <Configuration_Initial_Extensions>)
at ../../../../../../rtems/c/src/../../cpukit/score/src/userextiterate.c:132
132 {
(gdb) bt
#0 _User_extensions_Thread_terminate_visitor (executing=0x2038d78, arg=0x2038d78, callouts=0x202d76c <Configuration_Initial_Extensions>)
at ../../../../../../rtems/c/src/../../cpukit/score/src/userextiterate.c:132
#1 0x02012ec4 in _User_extensions_Iterate (arg=arg at entry=0x2038d78, visitor=0x2012e5c <_User_extensions_Thread_terminate_visitor>)
at ../../../../../../rtems/c/src/../../cpukit/score/src/userextiterate.c:155
#2 0x020128d8 in _User_extensions_Thread_terminate (executing=0x2038d78) at ../../cpukit/../../../sis/lib/include/rtems/score/userextimpl.h:252
#3 _Thread_Life_action_handler (executing=0x2038d78, action=0x2038ed8, cpu=0x2035500 <_Per_CPU_Information>, level=<optimized out>)
at ../../../../../../rtems/c/src/../../cpukit/score/src/threadrestart.c:171
#4 0x02011a18 in _Thread_Run_post_switch_actions (executing=0x2038d78) at ../../../../../../rtems/c/src/../../cpukit/score/src/threaddispatch.c:54
#5 _Thread_Dispatch () at ../../../../../../rtems/c/src/../../cpukit/score/src/threaddispatch.c:222
#6 0x0200e72c in _Thread_Enable_dispatch () at ../../cpukit/../../../sis/lib/include/rtems/score/threaddispatch.h:237
#7 _Objects_Put (the_object=<optimized out>) at ../../cpukit/../../../sis/lib/include/rtems/score/objectimpl.h:969
#8 rtems_task_delete (id=0) at ../../../../../../rtems/c/src/../../cpukit/rtems/src/taskdelete.c:52
-- Jennifer
> -----Original Message-----
> From: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
> Sent: Friday, April 18, 2014 2:11 PM
> To: Jennifer Averett
> Cc: rtems-devel at rtems.org
> Subject: Re: [PATCH 2/4] score: Add validation that no extensions are null.
>
> On 04/18/2014 08:51 PM, Jennifer Averett wrote:
> >> >-----Original Message-----
> >> >From: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
> >> >Sent: Friday, April 18, 2014 1:49 PM
> >> >To: Jennifer Averett
> >> >Subject: Re: [PATCH 2/4] score: Add validation that no extensions are
> null.
> >> >
> >> >On 04/18/2014 07:45 PM, Jennifer Averett wrote:
> >>> > >I don't have the stack trace, but Joel and I both saw a section
> >>> > >that it looked like a NULL could be called from, I see the section of
> code you are
> >>> > >referring to and that is not where we were at. It was before the zero
> >>> > >of memory was added to the capture engine, so we may have
> tromped
> >>> > >on the code and been somewhere that is not the normal path.
> >>> > >
> >>> > >I can't reproduce what we were seeing.
> >> >
> >> >You have seen a call of a random pointer slipped in through the
> >> >incomplete initialized extensions table on the stack.
> >> >
> >>> > >
> >>> > >I'll remove the patches for the null extensions, but I think the
> >>> > >capture engine patch is still correct, with the exception that
> >>> > >the fatal extension can be NULL instead of an empty method.
> >> >
> >> >Yes, but I would make the extensions table static const. I think
> >> >also that we need a proper thread terminate event, since terminate
> >> >and delete are now different things.
> > I thought about adding a terminate event, but since the terminate is
> > being triggered by a delete of self it seemed the delete event would
> > be the better option. The application user shouldn't have to
> > understand the internals to understand the output from the capture
> engine (imo).
> >
>
> Where do you have this "since the terminate is being triggered by a delete of
> self" from? Please help to improve the documentation.
>
> /**
> * @brief Task termination extension.
> *
> * This extension is invoked by _Thread_Life_action_handler() in case a
> * termination request is recognized.
> *
> * It is invoked in the context of the terminated thread right before the
> * thread dispatch to the heir thread. The POSIX cleanup and key
> destructors
> * execute in this context.
> *
> * Thread dispatching is enabled. The thread is not the holder of the
> * allocator mutex. The thread life is protected. Thread restart and delete
> * requests issued by terminate extensions lead to recursion.
> *
> * @param[in] terminated The terminated thread.
> */
> typedef void( *User_extensions_thread_terminate_extension )(
> Thread_Control *terminated
> );
>
> /**
> * @brief Task delete extension.
> *
> * It corresponds to _Thread_Close() (used by the rtems_task_delete()
> * directive, pthread_exit() and pthread_cancel()).
> *
> * It is invoked before all resources of the thread are deleted. The executing
> * and deleted arguments are never equal.
> *
> * Thread dispatching is enabled. The executing thread locked the allocator
> * mutex.
> *
> * @param[in] executing The executing thread.
> * @param[in] deleted The deleted thread.
> */
> typedef void( *User_extensions_thread_delete_extension )(
> Thread_Control *executing,
> Thread_Control *deleted
> );
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list