提交 4adc15e6 编写于 作者: O openharmony_ci 提交者: Gitee

!446 init进程收到子进程退出信号后,调用fork重新拉起进程,会导致系统卡死

Merge pull request !446 from zhangfanfan2/master
......@@ -105,7 +105,15 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize)
{
VOID *cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
LosTaskCB *task = OsCurrTaskGet();
sig_cb *sigcb = &task->sig;
VOID *cloneStack = NULL;
if (sigcb->sigContext != NULL) {
cloneStack = (VOID *)((UINTPTR)sigcb->sigContext - sizeof(TaskContext));
} else {
cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
}
(VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
((TaskContext *)childStack)->R0 = 0;
......
......@@ -678,6 +678,7 @@ VOID *OsRestorSignalContext(VOID *sp)
LosProcessCB *process = OsCurrProcessGet();
VOID *saveContext = sigcb->sigContext;
sigcb->sigContext = NULL;
sigcb->count--;
process->sigShare = 0;
OsProcessExitCodeSignalClear(process);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册