mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:48:11 +00:00
Kernel: Unbreak symbolication yet another time.
This commit is contained in:
parent
6d351bb326
commit
0e73aa36c8
3 changed files with 19 additions and 8 deletions
|
@ -1597,14 +1597,19 @@ void sleep(dword ticks)
|
||||||
sched_yield();
|
sched_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_inside_kernel_code(LinearAddress laddr)
|
||||||
|
{
|
||||||
|
// FIXME: What if we're indexing into the ksym with the highest address though?
|
||||||
|
return laddr.get() >= ksym_lowest_address && laddr.get() <= ksym_highest_address;
|
||||||
|
}
|
||||||
|
|
||||||
bool Process::validate_read_from_kernel(LinearAddress laddr) const
|
bool Process::validate_read_from_kernel(LinearAddress laddr) const
|
||||||
{
|
{
|
||||||
// We check extra carefully here since the first 4MB of the address space is identity-mapped.
|
// We check extra carefully here since the first 4MB of the address space is identity-mapped.
|
||||||
// This code allows access outside of the known used address ranges to get caught.
|
// This code allows access outside of the known used address ranges to get caught.
|
||||||
|
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
// FIXME: What if we're indexing into the ksym with the highest address though?
|
if (is_inside_kernel_code(laddr))
|
||||||
if (laddr.get() >= ksym_lowest_address && laddr.get() <= ksym_highest_address)
|
|
||||||
return true;
|
return true;
|
||||||
if (is_kmalloc_address(laddr.as_ptr()))
|
if (is_kmalloc_address(laddr.as_ptr()))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1613,8 +1618,12 @@ bool Process::validate_read_from_kernel(LinearAddress laddr) const
|
||||||
|
|
||||||
bool Process::validate_read(const void* address, size_t size) const
|
bool Process::validate_read(const void* address, size_t size) const
|
||||||
{
|
{
|
||||||
if (isRing0())
|
if (isRing0()) {
|
||||||
return true;
|
if (is_inside_kernel_code(LinearAddress((dword)address)))
|
||||||
|
return true;
|
||||||
|
if (is_kmalloc_address(address))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
ASSERT(size);
|
ASSERT(size);
|
||||||
if (!size)
|
if (!size)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1629,8 +1638,10 @@ bool Process::validate_read(const void* address, size_t size) const
|
||||||
|
|
||||||
bool Process::validate_write(void* address, size_t size) const
|
bool Process::validate_write(void* address, size_t size) const
|
||||||
{
|
{
|
||||||
if (isRing0())
|
if (isRing0()) {
|
||||||
return true;
|
if (is_kmalloc_address(address))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
ASSERT(size);
|
ASSERT(size);
|
||||||
if (!size)
|
if (!size)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -38,7 +38,7 @@ volatile size_t kmalloc_sum_eternal = 0;
|
||||||
static byte* s_next_eternal_ptr;
|
static byte* s_next_eternal_ptr;
|
||||||
static byte* s_end_of_eternal_range;
|
static byte* s_end_of_eternal_range;
|
||||||
|
|
||||||
bool is_kmalloc_address(void* ptr)
|
bool is_kmalloc_address(const void* ptr)
|
||||||
{
|
{
|
||||||
if (ptr >= (byte*)ETERNAL_BASE_PHYSICAL && ptr < s_next_eternal_ptr)
|
if (ptr >= (byte*)ETERNAL_BASE_PHYSICAL && ptr < s_next_eternal_ptr)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -10,7 +10,7 @@ void* kmalloc_aligned(size_t, size_t alignment) __attribute__ ((malloc));
|
||||||
void kfree(void*);
|
void kfree(void*);
|
||||||
void kfree_aligned(void*);
|
void kfree_aligned(void*);
|
||||||
|
|
||||||
bool is_kmalloc_address(void*);
|
bool is_kmalloc_address(const void*);
|
||||||
|
|
||||||
extern volatile size_t sum_alloc;
|
extern volatile size_t sum_alloc;
|
||||||
extern volatile size_t sum_free;
|
extern volatile size_t sum_free;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue