Only the kill syscall should care about user permissions for signals
This commit is contained in:
parent
6e8d92cdd2
commit
de94682728
@ -223,7 +223,7 @@ typedef struct {
|
||||
|
||||
extern void handle_signal(process_t *, signal_t *);
|
||||
|
||||
extern int send_signal(pid_t process, uint32_t signal);
|
||||
extern int send_signal(pid_t process, uint32_t signal, int force);
|
||||
|
||||
#define USER_STACK_BOTTOM 0xAFF00000
|
||||
#define USER_STACK_TOP 0xB0000000
|
||||
|
@ -102,7 +102,7 @@ uint32_t read_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buf
|
||||
|
||||
if (pipe->dead) {
|
||||
debug_print(WARNING, "Pipe is dead?");
|
||||
send_signal(getpid(), SIGPIPE);
|
||||
send_signal(getpid(), SIGPIPE, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ uint32_t write_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *bu
|
||||
|
||||
if (pipe->dead) {
|
||||
debug_print(WARNING, "Pipe is dead?");
|
||||
send_signal(getpid(), SIGPIPE);
|
||||
send_signal(getpid(), SIGPIPE, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ static void input_process(pty_t * pty, uint8_t c) {
|
||||
}
|
||||
clear_input_buffer(pty);
|
||||
if (pty->fg_proc) {
|
||||
send_signal(pty->fg_proc, SIGINT);
|
||||
send_signal(pty->fg_proc, SIGINT, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -126,7 +126,7 @@ static void input_process(pty_t * pty, uint8_t c) {
|
||||
}
|
||||
clear_input_buffer(pty);
|
||||
if (pty->fg_proc) {
|
||||
send_signal(pty->fg_proc, SIGQUIT);
|
||||
send_signal(pty->fg_proc, SIGQUIT, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ static uint32_t write_unixpipe(fs_node_t * node, uint32_t offset, uint32_t size,
|
||||
while (written < size) {
|
||||
if (self->read_closed) {
|
||||
/* SIGPIPE to current process */
|
||||
send_signal(getpid(), SIGPIPE);
|
||||
send_signal(getpid(), SIGPIPE, 1);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ page_fault(
|
||||
|
||||
#endif
|
||||
|
||||
send_signal(current_process->id, SIGSEGV);
|
||||
send_signal(current_process->id, SIGSEGV, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@ void halt_and_catch_fire(char * error_message, const char * file, int line, stru
|
||||
debug_print(ERROR, "User ESP: 0x%x", regs->useresp);
|
||||
debug_print(ERROR, "eip=0x%x", regs->eip);
|
||||
}
|
||||
send_signal(current_process->id, SIGILL);
|
||||
send_signal(current_process->id, SIGILL, 1);
|
||||
}
|
||||
|
||||
char * probable_function_name(uintptr_t ip, uintptr_t * out_addr) {
|
||||
|
@ -183,7 +183,7 @@ void fix_signal_stacks(void) {
|
||||
}
|
||||
}
|
||||
|
||||
int send_signal(pid_t process, uint32_t signal) {
|
||||
int send_signal(pid_t process, uint32_t signal, int force_root) {
|
||||
process_t * receiver = process_from_pid(process);
|
||||
|
||||
if (!receiver) {
|
||||
@ -191,7 +191,7 @@ int send_signal(pid_t process, uint32_t signal) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (receiver->user != current_process->user && current_process->user != USER_ROOT_UID) {
|
||||
if (!force_root && receiver->user != current_process->user && current_process->user != USER_ROOT_UID) {
|
||||
/* No way in hell. */
|
||||
return 1;
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ static int sys_shm_release(char * path) {
|
||||
}
|
||||
|
||||
static int sys_kill(pid_t process, uint32_t signal) {
|
||||
return send_signal(process, signal);
|
||||
return send_signal(process, signal, 0);
|
||||
}
|
||||
|
||||
static int sys_gettimeofday(struct timeval * tv, void * tz) {
|
||||
|
@ -47,7 +47,7 @@ void lfb_set_resolution(uint16_t x, uint16_t y) {
|
||||
if (lfb_resolution_impl) {
|
||||
lfb_resolution_impl(x,y);
|
||||
if (display_change_recipient) {
|
||||
send_signal(display_change_recipient, SIGWINEVENT);
|
||||
send_signal(display_change_recipient, SIGWINEVENT, 1);
|
||||
debug_print(WARNING, "Telling %d to SIGWINEVENT", display_change_recipient);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user