Skip to content

[BUG REPORT] busybox下运行跟进程相关的程序就会出现Segmentation fault #1165

Closed
@sparkzky

Description

@sparkzky

描述错误
busybox下运行跟进程相关的程序就会出现Segmentation fault,例如waitpid,test-processgroup,test-session

waitpid的内容如下

#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include <sched.h>
#include <sys/wait.h>
#include <assert.h>

int i = 1000;
void test_waitpid(void){
    int cpid, wstatus;
    cpid = fork();
    assert(cpid != -1);
    if(cpid == 0){
	while(i--);
	sched_yield();
	printf("This is child process\n");
        exit(3);
    }else{
	pid_t ret = waitpid(cpid, &wstatus, 0);
	assert(ret != -1);
	if(ret == cpid && WEXITSTATUS(wstatus) == 3)
	    printf("waitpid successfully.\nwstatus: %x\n", WEXITSTATUS(wstatus));
	else
	    printf("waitpid error.\n");

    }
}

int main(void){
    test_waitpid();
    return 0;
}

请填写您的电脑的信息:

重现步骤
重现行为的步骤:

  1. 在busybox下运行进程相关的程序

期望行为

waitpid的正常结果

Image

屏幕截图

Image

其他上下文
waitpid是测例中的部分,参见basic

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-report这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions