Commit Graph

36 Commits

Author SHA1 Message Date
Conrad Pankoff
3aaeff483b Kernel: Add a size argument to validate_read_from_kernel 2019-12-24 01:28:38 +01:00
Andreas Kling
f75a6b9daa Kernel: Demangle kernel C++ symbols correctly again
I broke this while implementing module linking. Also move the actual
demangling work to AK, in AK::demangle(const char*)
2019-11-29 14:59:15 +01:00
Andreas Kling
4ef6be8212 Kernel: Allow modules to link against anything in kernel.map :^)
We now use the symbols from kernel.map to link modules as they are
loaded into the kernel. This is pretty fricken cool!
2019-11-28 21:30:20 +01:00
Andreas Kling
39fcd92210 Kernel: Remove debug spam about dump_backtrace() calling itself
This was too noisy and important-sounding, when it doesn't really
matter that much. It's not the end of the world if symbolication fails
for one reason or another.
2019-11-08 17:36:29 +01:00
Andreas Kling
49635e62fa LibELF: Move AK/ELF/ into Libraries/LibELF/
Let's arrange things like this instead. It didn't feel right for all of
the ELF handling code to live in AK.
2019-11-06 13:42:38 +01:00
Andreas Kling
31beff8afb Kernel: Remove unnecessary init_ksyms() function 2019-11-06 13:36:37 +01:00
Andreas Kling
8f45a259fc ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-30 08:57:01 +02:00
Andreas Kling
308461ca9a Kernel: Disable kmalloc backtraces during backtrace generation
If kmalloc backtraces are enabled during backtracing, things don't go
super well when the backtrace code calls kmalloc()..

With this fixed, it's basically possible to get all kmalloc backtraces
on the debugger by running (as root):

sysctl kmalloc_stacks=1
2019-08-07 20:37:05 +02:00
DrewStratford
608fee9bff Kernel: Add bounds checking to recognized_symbols in dump_backtrace_impl (#372)
This adds a bounds check to the loop that writes to the buffer
'recognized_symbols'. This prevents buffer overflows in the
case when a programs backtrace is particularly large.

Fixes #371.
2019-07-28 20:02:22 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Andreas Kling
c1bbd40b9e Kernel: Rename "descriptor" to "description" where appropriate.
Now that FileDescription is called that, variables of that type should not
be called "descriptor". This is kinda wordy but we'll get used to it.
2019-06-13 22:03:04 +02:00
Andreas Kling
e42c3b4fd7 Kernel: Rename LinearAddress => VirtualAddress. 2019-06-07 12:56:50 +02:00
Andreas Kling
bc951ca565 Kernel: Run clang-format on everything. 2019-06-07 11:43:58 +02:00
Andreas Kling
08cd75ac4b Kernel: Rename FileDescriptor to FileDescription.
After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
2019-06-07 09:36:51 +02:00
Andreas Kling
393851418b FileSystem: Port most of the code over to using custodies.
The current working directory is now stored as a custody. Likewise for a
process executable file. This unbreaks /proc/PID/fd which has not been
working since we made the filesystem bigger.

This still needs a bunch of work, for instance when renaming or removing
a file somewhere, we have to update the relevant custody links.
2019-05-30 18:58:59 +02:00
Robin Burchell
6917c42140 Kernel/AK: Move ELF loader to AK
This is in preparation for eventually using it in userspace.
LinearAddress.h has not been moved for the time being (as it seems to be
only used by a very small part of the code).
2019-05-23 16:57:34 +02:00
Andreas Kling
d2c3749cf3 Kernel: Don't allow dump_backtrace() to call dump_backtrace().
That was not a very graceful looking loop to be stuck in.
2019-05-18 17:33:05 +02:00
Andreas Kling
316fb624f7 Kernel: Fail a bit more gracefully when we don't have userspace symbols. 2019-05-18 14:49:49 +02:00
Andreas Kling
174639b7f0 Kernel: Symbolicate userspace backtraces using ELFLoader.
Stash away the ELFLoader used to load an executable in Process so we can use
it for symbolicating userspace addresses later on. This will make debugging
userspace programs a lot nicer. :^)
2019-05-16 17:18:25 +02:00
Andreas Kling
2f4e7edee5 Kernel: Simplify dump_backtrace() API for clients.
It makes no sense that clients had to worry about whether or not KSyms
were loaded.
2019-05-16 13:41:16 +02:00
Andreas Kling
28244039a5 Kernel: Don't symbolicate symbol+offset for obvious non-kernel addresses. 2019-04-30 14:47:22 +02:00
Andreas Kling
8cbb7f101f Kernel: Have File virtuals take a FileDescriptor& rather than a Process&.
This will allow us to implement different behaviors depending on the role
of the descriptor a File is being accessed through.
2019-04-29 13:58:40 +02:00
Andreas Kling
0a0d739e98 Kernel: Make FIFO inherit from File. 2019-04-29 04:55:54 +02:00
Andreas Kling
fa89446cb6 Kernel: Make symbolication callable from kmalloc().
It wasn't possible to symbolicate from kmalloc(), since symbolication would
call kmalloc(). :^)
2019-04-15 23:50:25 +02:00
Andreas Kling
60d25f0f4a Kernel: Introduce threads, and refactor everything in support of it.
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.

This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
028afabf6b Kernel: Port more code to KResult and KResultOr<T>. 2019-03-06 22:14:31 +01:00
Andreas Kling
9fd4f4862b Kernel: Make dump_backtrace() kinda sorta work. 2019-02-24 14:51:48 +01:00
Andreas Kling
022f7790db Use modern C++ attributes instead of __attribute__ voodoo.
This is quite nice, although I wish [[gnu::always_inline]] implied inline.
Also "gnu::" is kind of a wart, but whatcha gonna do.
2019-02-15 12:30:48 +01:00
Andreas Kling
26f4301521 Kernel: Stop spamming the kernel log buffer when loading ksyms. 2019-02-06 18:52:12 +01:00
Andreas Kling
feed67ede2 Kernel: VFS::open/create should take base Inode& instead of InodeIdentifier. 2019-02-01 15:36:45 +01:00
Andreas Kling
ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling
f83a94ca39 Kernel: Remove outdated FIXME. 2019-01-28 22:53:31 +01:00
Andreas Kling
f70136a324 Kernel: Support open() with O_CREAT.
It's now possible to create zero-length files! :^)
Also hook up the new functionality in /bin/touch.
2019-01-22 00:58:56 +01:00
Andreas Kling
bd3e77cc16 Pass the process to CharacterDevice::read/write.
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-16 00:20:38 +01:00
Andreas Kling
4b6a8f8a08 Unbreak ksym loading and make reading /proc/PID/stack not crash. 2019-01-01 02:20:01 +01:00
Andreas Kling
503e32552c Move kernel symbolication code out of init.cpp and into its own KSym files.
Also use a simple array of { dword, const char* } for the KSyms and put the
whole shebang in kmalloc_eternal() memory. This was a fugly source of
kmalloc perma-frag.
2018-12-24 23:01:09 +01:00