ladybird/Libraries/LibELF
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
..
Arch/i386 LibELF: Re-organize ELFDynamicObject::load and add PLT trampoline 2020-01-01 23:54:06 +01:00
AuxiliaryVector.h Kernel+LibELF: Expose ELF Auxiliary Vector to Userspace 2020-07-07 10:38:54 +02:00
DynamicLoader.cpp Libraries: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
DynamicLoader.h LibELF: Fix uninitialized member variable in DynamicLoader, found by Coverity 2020-08-17 09:17:57 +02:00
DynamicObject.cpp Libraries: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
DynamicObject.h Kernel: Absorb LibBareMetal back into the kernel 2020-05-16 12:00:04 +02:00
exec_elf.h LibELF: Ignore PT_GNU_STACK headers 2020-08-20 10:12:45 +02:00
Image.cpp Libraries: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
Image.h Lagom+LibELF: Add an ELF fuzzer, and tweak the code to survive a few minutes of fuzzing (#3071) 2020-08-10 15:55:17 +02:00
Loader.cpp Kernel: Make copy_to/from_user safe and remove unnecessary checks 2020-09-13 21:19:15 +02:00
Loader.h LibELF: Remove unused cruft in ELF::Loader 2020-08-11 20:29:14 +02:00
Validation.cpp LibELF: Ignore PT_GNU_STACK headers 2020-08-20 10:12:45 +02:00
Validation.h Lagom+LibELF: Add an ELF fuzzer, and tweak the code to survive a few minutes of fuzzing (#3071) 2020-08-10 15:55:17 +02:00