rizinorg/rizin

Incorrect handling of OpenBSD specific code

cjeker opened this issue · 3 comments

The OpenBSD handling in bsd_debug.c is incorrect. The inspected flags have nothing to do with the execution state of the process. In OpenBSD -current the PS_STOPPED field was removed and so this code no longer compiles.

if (kp->p_psflags & PS_ZOMBIE) {
rdi->status = RZ_DBG_PROC_ZOMBIE;
} else if (kp->p_psflags & PS_STOPPED) {
rdi->status = RZ_DBG_PROC_STOP;
} else if (kp->p_psflags & PS_PPWAIT) {
rdi->status = RZ_DBG_PROC_SLEEP;
} else if ((kp->p_psflags & PS_EXEC) || (kp->p_psflags & PS_INEXEC)) {
rdi->status = RZ_DBG_PROC_RUN;
}

That code should do the same as the FreeBSD and NetBSD code and inspect p_stat. This will return the scheduler state (SSLEEP, SSTOP, SRUN, SONPROC and SDEAD) of the main thread.

I do not use rizin but was notified about the build failure on OpenBSD-current. This is why I open this issue.

See also radareorg/radare2#23158 for the same issue in radare2.

@thestr4ng3r Do you have a working OpenBSD machine? I tried to set up a VM quickly, but it takes forever to get it to a state to compile Rizin.

I created a PR #4579 with the change that was committed to the OpenBSD ports repository to fix this issue.

I guess this can be closed now. Right?