kernel: fixup ptrace signal delivery, again

This commit is contained in:
K. Lange 2022-08-18 19:42:17 +09:00
parent 40c36d3290
commit d2f3644430
2 changed files with 3 additions and 3 deletions

View File

@ -1030,7 +1030,7 @@ int waitpid(int pid, int * status, int options) {
if (status) {
*status = candidate->status;
}
candidate->status = 0;
candidate->status &= ~0xFF;
int pid = candidate->id;
if (is_parent && (candidate->flags & PROC_FLAG_FINISHED)) {
while (*((volatile int *)&candidate->flags) & PROC_FLAG_RUNNING);

View File

@ -164,7 +164,7 @@ long ptrace_signal(int signal, int reason) {
switch_task(0);
int signum = (this_core->current_process->status >> 8);
this_core->current_process->status = 0x7F;
this_core->current_process->status = 0;
return signum;
}
@ -184,7 +184,7 @@ static void signal_and_continue(pid_t pid, process_t * tracee, int sig) {
__sync_and_and_fetch(&tracee->flags, ~(PROC_FLAG_SUSPENDED));
/* Does the process have a pending signal? */
if ((tracee->status >> 8) & 0xFF && !(tracee->status >> 16)) {
if ((tracee->status >> 8) & 0xFF && (!(tracee->status >> 16) || ((tracee->status >> 16) == 0xFF))) {
tracee->status = (sig << 8);
make_process_ready(tracee);
} else if (sig) {