From d055495f3dbb62f74809d31a84621d6e86d61d0a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 2 Apr 2021 13:55:25 +0200 Subject: Fixed serious race condition exploits --- libs/libc/alloc.c | 2 +- libs/libc/inc/cpu.h | 2 +- libs/libc/print.c | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'libs') diff --git a/libs/libc/alloc.c b/libs/libc/alloc.c index f45c5af..928a519 100644 --- a/libs/libc/alloc.c +++ b/libs/libc/alloc.c @@ -40,7 +40,7 @@ static int liballoc_free(void *ptr, u32 p) #endif -static u8 locked = 0; +static u32 locked = 0; static int liballoc_lock(void) { diff --git a/libs/libc/inc/cpu.h b/libs/libc/inc/cpu.h index 52e5571..4c6e721 100644 --- a/libs/libc/inc/cpu.h +++ b/libs/libc/inc/cpu.h @@ -14,7 +14,7 @@ void outb(u16 port, u8 data); void outw(u16 port, u16 data); void outl(u16 port, u32 data); -static inline void spinlock(u8 *ptr) +static inline void spinlock(u32 *ptr) { u32 prev; do diff --git a/libs/libc/print.c b/libs/libc/print.c index 7c19628..d990985 100644 --- a/libs/libc/print.c +++ b/libs/libc/print.c @@ -233,8 +233,6 @@ void print_trace(u32 count) __asm__ volatile("movl %%ebp, %0;" : "=r"(stk)); print("EBP\tEIP\n"); for (u32 i = 0; stk && i < count; i++) { - /* u32 eip = memory_valid((void *)stk->eip) ? stk->eip : stk->eip + 64; */ - /* printf("0x%x\t0x%x\n", stk->ebp, eip); */ printf("0x%x\t0x%x\n", stk->ebp, stk->eip); stk = stk->ebp; } -- cgit v1.2.3