<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 21, 2020 at 10:29 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Sep 19, 2020 at 5:41 AM Utkarsh Rai <<a href="mailto:utkarsh.rai60@gmail.com" target="_blank">utkarsh.rai60@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
> When I isolate more than two threads in RTEMS (the implementation can be found here), I get fatal exceptions while context-switching. On stepping into the code, the problem seems to be with the _User_extensions_Thread_*() call just after a context-switch, in particular when the iterators are initialized inside this call. The issue is the fact that we mark the stack space of the switched out thread as 'NO_ACESS' and then try to access iterators(which belong to the stack space of the switched-out thread) from a different thread, which leads to fatal exceptions.<br>
> I am not sure how to handle this issue because I am not very clear on the purpose of the "user extension" functionality or its implementation. Any help would be appreciated, as this may possibly be the last hurdle for a mergeable thread stack isolation feature.<br>
<br>
Are you testing in an SMP configuration? The user extensions in<br>
uniprocessor run before the context switch.</blockquote><div><br></div><div>No, I am running with a simple uniprocessor configuration.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> It would help if you<br>
provide a trace of your debug. </blockquote><div><br></div><div>The backtrace - </div><div><br></div><div>_Chain_Append_unprotected (the_chain=0x2002a0 <_User_extensions_List+12>, <br> the_node=0xfbf4fa0) at ../../../cpukit/include/rtems/score/chainimpl.h:694<br>#1 0x0010d630 in _Chain_Iterator_initialize (<br> the_chain=0x200294 <_User_extensions_List>, <br> the_registry=0x2002a0 <_User_extensions_List+12>, the_iterator=0xfbf4fa0, <br> direction=CHAIN_ITERATOR_FORWARD)<br> at ../../../cpukit/include/rtems/score/chainimpl.h:1065<br>#2 0x0010d92e in _User_extensions_Iterate (<br> arg=0x201df8 <_POSIX_Threads_Objects+2016>, <br> visitor=0x10d7f5 <_User_extensions_Thread_begin_visitor>, <br> direction=CHAIN_ITERATOR_FORWARD)<br> at ../../../cpukit/score/src/userextiterate.c:184<br>#3 0x0010a172 in _User_extensions_Thread_begin (<br> executing=0x201df8 <_POSIX_Threads_Objects+2016>)<br> at ../../../cpukit/include/rtems/score/userextimpl.h:353<br>#4 0x0010a21c in _Thread_Handler ()<br> at ../../../cpukit/score/src/threadhandler.c:140<br>#5 0x0010e1e8 in _CPU_Context_switch_arm ()<br> at ../../../cpukit/score/cpu/arm/cpu_asm.S:121<br></div><div> </div><div>The previous node of the chain was at 0xfbf7a0 which has been </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You might consider using the event<br>
recorder to also help with your debugging.<br>
<a href="https://docs.rtems.org/branches/master/user/tracing/index.html" rel="noreferrer" target="_blank">https://docs.rtems.org/branches/master/user/tracing/index.html</a></blockquote><div><br></div><div>Ok, I will look into it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
<br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>
</div>