ladybird/Kernel/Arch/i386
Tom c8d9f1b9c9 Kernel: Make copy_to/from_user safe and remove unnecessary checks
Since the CPU already does almost all necessary validation steps
for us, we don't really need to attempt to do this. Doing it
ourselves doesn't really work very reliably, because we'd have to
account for other processors modifying virtual memory, and we'd
have to account for e.g. pages not being able to be allocated
due to insufficient resources.

So change the copy_to/from_user (and associated helper functions)
to use the new safe_memcpy, which will return whether it succeeded
or not. The only manual validation step needed (which the CPU
can't perform for us) is making sure the pointers provided by user
mode aren't pointing to kernel mappings.

To make it easier to read/write from/to either kernel or user mode
data add the UserOrKernelBuffer helper class, which will internally
either use copy_from/to_user or directly memcpy, or pass the data
through directly using a temporary buffer on the stack.

Last but not least we need to keep syscall params trivial as we
need to copy them from/to user mode using copy_from/to_user.
2020-09-13 21:19:15 +02:00
..
Boot Kernel: Tell the bootloader to put us into graphics mode 2020-08-01 07:57:29 +02:00
CPU.cpp Kernel: Make copy_to/from_user safe and remove unnecessary checks 2020-09-13 21:19:15 +02:00
CPU.h Kernel: Add safe_memcpy, safe_memset and safe_strnlen 2020-09-13 21:19:15 +02:00
Interrupts.h Kernel: Add SMP IPI support 2020-07-06 17:07:44 +02:00
ISRStubs.h Kernel: Add SMP IPI support 2020-07-06 17:07:44 +02:00
ProcessorInfo.cpp Kernel: Remove unneeded #include in ProcessorInfo.cpp (#3211) 2020-08-19 11:25:12 +02:00
ProcessorInfo.h Kernel: Add SMP IPI support 2020-07-06 17:07:44 +02:00