kernel: fix missing lock during wakeup from signal delivery
This commit is contained in:
parent
f6d9027bc9
commit
35c83a19f1
@ -197,6 +197,7 @@ extern void wakeup_sleepers(unsigned long seconds, unsigned long subseconds);
|
||||
extern void task_exit(int retval);
|
||||
extern __attribute__((noreturn)) void switch_next(void);
|
||||
extern int process_awaken_from_fswait(process_t * process, int index);
|
||||
extern void process_awaken_signal(process_t * process);
|
||||
extern void process_release_directory(page_directory_t * dir);
|
||||
extern process_t * spawn_worker_thread(void (*entrypoint)(void * argp), const char * name, void * argp);
|
||||
extern pid_t fork(void);
|
||||
|
@ -1024,6 +1024,17 @@ int process_awaken_from_fswait(process_t * process, int index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void process_awaken_signal(process_t * process) {
|
||||
spin_lock(process->sched_lock);
|
||||
if (process->node_waits) {
|
||||
spin_lock(sleep_lock);
|
||||
process_awaken_from_fswait(process, -1);
|
||||
spin_unlock(sleep_lock);
|
||||
} else {
|
||||
spin_unlock(process->sched_lock);
|
||||
}
|
||||
}
|
||||
|
||||
int process_alert_node_locked(process_t * process, void * value) {
|
||||
must_have_lock(sleep_lock);
|
||||
|
||||
|
@ -217,12 +217,8 @@ int send_signal(pid_t process, int signal, int force_root) {
|
||||
sig->signum = signal;
|
||||
memset(&sig->registers_before, 0x00, sizeof(struct regs));
|
||||
|
||||
spin_lock(receiver->sched_lock);
|
||||
if (receiver->node_waits) {
|
||||
process_awaken_from_fswait(receiver, -1);
|
||||
} else {
|
||||
spin_unlock(receiver->sched_lock);
|
||||
}
|
||||
process_awaken_signal(receiver);
|
||||
|
||||
if (!process_is_ready(receiver) || receiver == this_core->current_process) {
|
||||
make_process_ready(receiver);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user