1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:27:44 +00:00
serenity/Libraries
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
..
LibAudio AK: Rename KB, MB, GB to KiB, MiB, GiB 2020-08-16 16:33:28 +02:00
LibC Kernel: Make copy_to/from_user safe and remove unnecessary checks 2020-09-13 21:19:15 +02:00
LibChess LibChess: Shrink Chess::Piece from 8 bytes to 1 byte 2020-08-21 13:46:07 +02:00
LibCompress LibCompress: Move CanonicalCode out of DeflateDecompressor. 2020-09-11 16:07:45 +02:00
LibCore LibCore: Fixed DeferredInvoke debug message (#3456) 2020-09-11 18:41:50 +02:00
LibCrypt Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
LibCrypto LibCrypto: Do not silently ignore key size mismatch 2020-08-28 11:36:57 +02:00
LibDebug Kernel: Fix various forward declarations 2020-09-12 13:46:15 +02:00
LibDesktop FileManager: Allow double-clicking applications again 2020-07-15 00:11:30 +02:00
LibELF Kernel: Make copy_to/from_user safe and remove unnecessary checks 2020-09-13 21:19:15 +02:00
LibGemini AK: Rename KB, MB, GB to KiB, MiB, GiB 2020-08-16 16:33:28 +02:00
LibGfx LibGfx: restructure Bitmap ctor to expect an alloc'd backing store 2020-09-12 20:26:14 +02:00
LibGUI LibGUI: Use new Bitmap::minimum_pitch method 2020-09-12 11:35:41 +02:00
LibHTTP LibHTTP: Fix processing terminating chunk 2020-08-19 15:28:31 +02:00
LibImageDecoderClient ImageDecoder: Add a new service for out-of-process image decoding :^) 2020-06-22 21:47:00 +02:00
LibIPC LibIPC: Remove unused DisconnectedEvent mechanism 2020-09-12 14:49:29 +02:00
LibJS LibJS: Check validity of computed_property_name() result before using it 2020-09-12 11:29:39 +02:00
LibKeyboard Kernel+LibKeyboard: Store the keymap name when setting system keymap 2020-08-06 17:45:06 +02:00
LibLine LibLine: Make ^R search match the input anywhere in a given line 2020-09-07 11:42:56 +02:00
LibM LibM: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
LibMarkdown LibMarkdown: Make warning messages conditional 2020-09-12 13:46:15 +02:00
LibPCIDB LibPCIDB: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
LibProtocol ProtocolServer+LibTLS: Pipe certificate requests from LibTLS to clients 2020-08-02 18:57:51 +02:00
LibPthread Kernel: Make copy_to/from_user safe and remove unnecessary checks 2020-09-13 21:19:15 +02:00
LibTextCodec LibTextCodec: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
LibThread LibThread: Uninitialized member variable in Thread, found by Coverity 2020-08-17 09:17:57 +02:00
LibTLS AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00
LibUnwind LibUnwind: Create UnwindBase.h to capture the EH ABI in code 2020-05-14 08:50:10 +02:00
LibVT Terminal: Make sure empty hrefs set a null string on Attribute 2020-09-13 11:34:49 +02:00
LibWeb LibWeb: cache in-process decoded images in ImageResource 2020-09-12 20:26:14 +02:00
LibX86 LibX86: Remove some allocations from Instruction::to_string 2020-08-16 19:38:55 +02:00
CMakeLists.txt Chess: Refactor game logic into LibChess for use in engines 2020-08-21 12:26:30 +02:00