mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
Kernel: Use Userspace<T> for the getrandom syscall
This commit is contained in:
parent
c8ae244ab8
commit
b5a2a215f6
Notes:
sideshowbarker
2024-07-19 04:04:45 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/b5a2a215f62 Pull-request: https://github.com/SerenityOS/serenity/pull/3062 Reviewed-by: https://github.com/awesomekling
@ -323,7 +323,7 @@ public:
|
||||
int sys$reboot();
|
||||
int sys$set_process_icon(int icon_id);
|
||||
int sys$realpath(Userspace<const Syscall::SC_realpath_params*>);
|
||||
ssize_t sys$getrandom(void*, size_t, unsigned int);
|
||||
ssize_t sys$getrandom(Userspace<void*>, size_t, unsigned int);
|
||||
int sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*>);
|
||||
int sys$module_load(const char* path, size_t path_length);
|
||||
int sys$module_unload(const char* name, size_t name_length);
|
||||
|
@ -32,7 +32,7 @@ namespace Kernel {
|
||||
// We don't use the flag yet, but we could use it for distinguishing
|
||||
// random source like Linux, unlike the OpenBSD equivalent. However, if we
|
||||
// do, we should be able of the caveats that Linux has dealt with.
|
||||
ssize_t Process::sys$getrandom(void* buffer, size_t buffer_size, [[maybe_unused]] unsigned flags)
|
||||
ssize_t Process::sys$getrandom(Userspace<void*> buffer, size_t buffer_size, [[maybe_unused]] unsigned flags)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
if (buffer_size <= 0)
|
||||
@ -42,7 +42,8 @@ ssize_t Process::sys$getrandom(void* buffer, size_t buffer_size, [[maybe_unused]
|
||||
return -EFAULT;
|
||||
|
||||
SmapDisabler disabler;
|
||||
get_good_random_bytes((u8*)buffer, buffer_size);
|
||||
// FIXME: We should really push Userspace<T> down through the interface.
|
||||
get_good_random_bytes((u8*)buffer.ptr(), buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user