CPU: Prevent leakage of virtual addresses to kernel log
This commit is contained in:
parent
5cbde297ec
commit
9991a36d1a
Notes:
sideshowbarker
2024-07-19 08:52:02 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/9991a36d1ae Pull-request: https://github.com/SerenityOS/serenity/pull/1362
1 changed files with 8 additions and 8 deletions
|
@ -259,7 +259,7 @@ void page_fault_handler(RegisterState regs)
|
|||
return;
|
||||
}
|
||||
|
||||
klog() << "Unrecoverable page fault, "
|
||||
dbg() << "Unrecoverable page fault, "
|
||||
<< (regs.exception_code & PageFaultFlags::ReservedBitViolation ? "reserved bit violation / " : "")
|
||||
<< (regs.exception_code & PageFaultFlags::InstructionFetch ? "instruction fetch / " : "")
|
||||
<< (regs.exception_code & PageFaultFlags::Write ? "write to" : "read from")
|
||||
|
@ -271,19 +271,19 @@ void page_fault_handler(RegisterState regs)
|
|||
u32 slab_alloc_scrub_pattern = explode_byte(SLAB_ALLOC_SCRUB_BYTE);
|
||||
u32 slab_dealloc_scrub_pattern = explode_byte(SLAB_DEALLOC_SCRUB_BYTE);
|
||||
if ((fault_address & 0xffff0000) == (malloc_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized malloc() memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized malloc() memory";
|
||||
} else if ((fault_address & 0xffff0000) == (free_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently free()'d memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently free()'d memory";
|
||||
} else if ((fault_address & 0xffff0000) == (kmalloc_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized kmalloc() memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized kmalloc() memory";
|
||||
} else if ((fault_address & 0xffff0000) == (kfree_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently kfree()'d memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently kfree()'d memory";
|
||||
} else if ((fault_address & 0xffff0000) == (slab_alloc_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized slab_alloc() memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be uninitialized slab_alloc() memory";
|
||||
} else if ((fault_address & 0xffff0000) == (slab_dealloc_scrub_pattern & 0xffff0000)) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently slab_dealloc()'d memory";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like it may be recently slab_dealloc()'d memory";
|
||||
} else if (fault_address < 4096) {
|
||||
klog() << "Note: Address " << VirtualAddress(fault_address) << " looks like a possible nullptr dereference";
|
||||
dbg() << "Note: Address " << VirtualAddress(fault_address) << " looks like a possible nullptr dereference";
|
||||
}
|
||||
|
||||
handle_crash(regs, "Page Fault", SIGSEGV);
|
||||
|
|
Loading…
Add table
Reference in a new issue