Jump to content

Recommended Posts

Posted

Hi all,

 

In the context of a SystemC simulation with many SC_THREAD processes (> 32000), I am facing the following error on an Intel X86 platform running Ubuntu 15.04:

 

sc_cor_qt.cpp:114: virtual void sc_core::sc_cor_qt::stack_protect(bool) Assertion `ret == 0' failed

 

I looked into the implementation of the kernel, and here is my current understanding.

 

The default implementation of the SystemC kernel uses user-level threads (also called coroutines) to implement the SystemC processes. The static processes (SC_THREAD and SC_CTHREAD) are initialized in the sc_simcontext.cpp line 759 thread_p->prepare_for_simulation() This function will create the user-level thread object and then enable stack protection.

 

The stack of the user-level thread is allocated in the heap of the SystemC simulation process by the following line

 

cor->m_stack = new char[cor->m_stack_size]

 

The issue I am facing happens in the stack protection function after the creation, that uses an mprotect system call to make the page just after the stack of the user-level thread (again, being in the heap of the Linux process) non accessible at all (PROT_NONE). The error (ENOMEM) I have from mprotect says that this page we want to protect has never been mapped into the process or that the kernel was not able allocate some internal structures while running the mprotect call. Unfortunately I am not able to know which of these two errors happens and how to fix it. Moreover, I can't see where this extra page is allocated in the heap of the Linux process before the mprotect call is made.

 

Does anyone know what is going and/or what can I do know to further debug this issue ?

 

Thank you very much for any help you cna provide on this issue ?

 

----

Manu

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...