mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
Kernel: Properly lock Process protected data in the prctl syscall
This commit is contained in:
parent
727218ff4a
commit
bedd90b1f0
Notes:
sideshowbarker
2024-07-17 05:13:53 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/bedd90b1f0 Pull-request: https://github.com/SerenityOS/serenity/pull/17096 Reviewed-by: https://github.com/linusg
@ -1017,13 +1017,6 @@ bool Process::add_thread(Thread& thread)
|
||||
return is_first;
|
||||
}
|
||||
|
||||
void Process::set_dumpable(bool dumpable)
|
||||
{
|
||||
with_mutable_protected_data([&](auto& protected_data) {
|
||||
protected_data.dumpable = dumpable;
|
||||
});
|
||||
}
|
||||
|
||||
ErrorOr<void> Process::set_coredump_property(NonnullOwnPtr<KString> key, NonnullOwnPtr<KString> value)
|
||||
{
|
||||
return m_coredump_properties.with([&](auto& coredump_properties) -> ErrorOr<void> {
|
||||
|
@ -249,7 +249,6 @@ public:
|
||||
{
|
||||
return with_protected_data([](auto& protected_data) { return protected_data.dumpable; });
|
||||
}
|
||||
void set_dumpable(bool);
|
||||
|
||||
mode_t umask() const
|
||||
{
|
||||
|
@ -12,14 +12,18 @@ namespace Kernel {
|
||||
ErrorOr<FlatPtr> Process::sys$prctl(int option, FlatPtr arg1, [[maybe_unused]] FlatPtr arg2)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
switch (option) {
|
||||
case PR_GET_DUMPABLE:
|
||||
return is_dumpable();
|
||||
case PR_SET_DUMPABLE:
|
||||
set_dumpable(arg1);
|
||||
return 0;
|
||||
}
|
||||
return EINVAL;
|
||||
return with_mutable_protected_data([&](auto& protected_data) -> ErrorOr<FlatPtr> {
|
||||
switch (option) {
|
||||
case PR_GET_DUMPABLE:
|
||||
return protected_data.dumpable;
|
||||
case PR_SET_DUMPABLE:
|
||||
if (arg1 != 0 && arg1 != 1)
|
||||
return EINVAL;
|
||||
protected_data.dumpable = arg1;
|
||||
return 0;
|
||||
}
|
||||
return EINVAL;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user