1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

Kernel: Implement 'copy_time_from_user' functions to sanitize arguments

This commit is contained in:
Ben Wiederhake 2021-02-21 19:18:55 +01:00 committed by Andreas Kling
parent bd6be910e5
commit 649abc01bc
2 changed files with 32 additions and 0 deletions

View file

@ -28,7 +28,9 @@
#include <AK/Checked.h>
#include <AK/Forward.h>
#include <AK/Time.h>
#include <AK/Userspace.h>
#include <Kernel/UnixTypes.h>
namespace Syscall {
struct StringArgument;
@ -36,6 +38,10 @@ struct StringArgument;
[[nodiscard]] String copy_string_from_user(const char*, size_t);
[[nodiscard]] String copy_string_from_user(Userspace<const char*>, size_t);
[[nodiscard]] Optional<Time> copy_time_from_user(const timespec*);
[[nodiscard]] Optional<Time> copy_time_from_user(const timeval*);
template<typename T>
[[nodiscard]] Optional<Time> copy_time_from_user(Userspace<T*> src);
[[nodiscard]] Optional<u32> user_atomic_fetch_add_relaxed(volatile u32* var, u32 val);
[[nodiscard]] Optional<u32> user_atomic_exchange_relaxed(volatile u32* var, u32 val);