diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-01 02:20:01 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-01 02:20:01 +0100 |
commit | 4b6a8f8a087121a3aa705bec30ffcc915b9edfd4 (patch) | |
tree | 73c173a64f383b13c7eccc037c27f3fddeed949a /Kernel | |
parent | 683185e4aa148c91c2963712f76f693ff363e9db (diff) | |
download | serenity-4b6a8f8a087121a3aa705bec30ffcc915b9edfd4.zip |
Unbreak ksym loading and make reading /proc/PID/stack not crash.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/KSyms.cpp | 4 | ||||
-rw-r--r-- | Kernel/KSyms.h | 1 | ||||
-rw-r--r-- | Kernel/ProcFileSystem.cpp | 2 | ||||
-rw-r--r-- | Kernel/Process.cpp | 2 | ||||
-rw-r--r-- | Kernel/Process.h | 2 | ||||
-rw-r--r-- | Kernel/_fs_contents.stock | bin | 1024000 -> 4194304 bytes | |||
-rw-r--r-- | Kernel/init.cpp | 6 |
7 files changed, 7 insertions, 10 deletions
diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 405b8abf8a..3d0d014767 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -91,13 +91,13 @@ void dump_backtrace(bool use_ksyms) }; Vector<RecognizedSymbol> recognized_symbols; if (use_ksyms) { - for (dword* stackPtr = (dword*)&use_ksyms; current->isValidAddressForKernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { + for (dword* stackPtr = (dword*)&use_ksyms; current->validate_read_from_kernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { dword retaddr = stackPtr[1]; if (auto* ksym = ksymbolicate(retaddr)) recognized_symbols.append({ retaddr, ksym }); } } else{ - for (dword* stackPtr = (dword*)&use_ksyms; current->isValidAddressForKernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { + for (dword* stackPtr = (dword*)&use_ksyms; current->validate_read_from_kernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { dword retaddr = stackPtr[1]; kprintf("%x (next: %x)\n", retaddr, stackPtr ? (dword*)*stackPtr : 0); } diff --git a/Kernel/KSyms.h b/Kernel/KSyms.h index 45558de201..d0551c5307 100644 --- a/Kernel/KSyms.h +++ b/Kernel/KSyms.h @@ -10,6 +10,7 @@ struct KSym { const KSym* ksymbolicate(dword address) PURE; void load_ksyms(); +void init_ksyms(); extern bool ksyms_ready; extern dword ksym_lowest_address; diff --git a/Kernel/ProcFileSystem.cpp b/Kernel/ProcFileSystem.cpp index d5b41c3db7..c9d995d1f9 100644 --- a/Kernel/ProcFileSystem.cpp +++ b/Kernel/ProcFileSystem.cpp @@ -110,7 +110,7 @@ ByteBuffer procfs$pid_stack(Process& process) Vector<RecognizedSymbol> recognizedSymbols; if (auto* eipKsym = ksymbolicate(process.tss().eip)) recognizedSymbols.append({ process.tss().eip, eipKsym }); - for (dword* stackPtr = (dword*)process.framePtr(); process.isValidAddressForKernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { + for (dword* stackPtr = (dword*)process.framePtr(); process.validate_read_from_kernel(LinearAddress((dword)stackPtr)); stackPtr = (dword*)*stackPtr) { dword retaddr = stackPtr[1]; if (auto* ksym = ksymbolicate(retaddr)) recognizedSymbols.append({ retaddr, ksym }); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 02153fff9d..c13c824b60 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1553,7 +1553,7 @@ void sleep(dword ticks) sched_yield(); } -bool Process::isValidAddressForKernel(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. // This code allows access outside of the known used address ranges to get caught. diff --git a/Kernel/Process.h b/Kernel/Process.h index 10ea1f2347..64770bcdb2 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -201,7 +201,7 @@ public: dword stackPtr() const { return m_tss.esp; } dword stackTop() const { return m_tss.ss == 0x10 ? m_stackTop0 : m_stackTop3; } - bool isValidAddressForKernel(LinearAddress) const; + bool validate_read_from_kernel(LinearAddress) const; bool validate_read(const void*, size_t) const; bool validate_write(void*, size_t) const; diff --git a/Kernel/_fs_contents.stock b/Kernel/_fs_contents.stock Binary files differindex a705e7a43a..3e0ff15aeb 100644 --- a/Kernel/_fs_contents.stock +++ b/Kernel/_fs_contents.stock diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 61a979c5b9..fb09236341 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -111,12 +111,8 @@ void init() { cli(); -#ifdef KSYMS - s_ksyms = nullptr; - s_ksyms_ready = false; -#endif - kmalloc_init(); + init_ksyms(); auto console = make<Console>(); |