kernel: copy signal dispositions on fork; clear them on exec
This commit is contained in:
parent
54d6d21ca5
commit
a7e6b1eaae
@ -324,6 +324,12 @@ int elf_exec(const char * path, fs_node_t * file, int argc, const char *const ar
|
||||
this_core->current_process->thread.page_directory->directory = mmu_clone(NULL);
|
||||
mmu_set_directory(this_core->current_process->thread.page_directory->directory);
|
||||
process_release_directory(this_directory);
|
||||
for (int i = 0; i < NUMSIGNALS; ++i) {
|
||||
if (this_core->current_process->signals[i].handler != 1) {
|
||||
this_core->current_process->signals[i].handler = 0;
|
||||
this_core->current_process->signals[i].flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < header.e_phnum; ++i) {
|
||||
Elf64_Phdr phdr;
|
||||
|
@ -1299,6 +1299,9 @@ pid_t fork(void) {
|
||||
new_proc->thread.page_directory->directory = directory;
|
||||
spin_init(new_proc->thread.page_directory->lock);
|
||||
|
||||
memcpy(new_proc->signals, parent->signals, sizeof(struct signal_config) * (NUMSIGNALS+1));
|
||||
new_proc->blocked_signals = parent->blocked_signals;
|
||||
|
||||
struct regs r;
|
||||
memcpy(&r, parent->syscall_registers, sizeof(struct regs));
|
||||
sp = new_proc->image.stack;
|
||||
@ -1337,6 +1340,8 @@ pid_t clone(uintptr_t new_stack, uintptr_t thread_func, uintptr_t arg) {
|
||||
spin_lock(new_proc->thread.page_directory->lock);
|
||||
new_proc->thread.page_directory->refcount++;
|
||||
spin_unlock(new_proc->thread.page_directory->lock);
|
||||
memcpy(new_proc->signals, parent->signals, sizeof(struct signal_config) * (NUMSIGNALS+1));
|
||||
new_proc->blocked_signals = parent->blocked_signals;
|
||||
|
||||
struct regs r;
|
||||
memcpy(&r, parent->syscall_registers, sizeof(struct regs));
|
||||
|
Loading…
Reference in New Issue
Block a user