mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:07:35 +00:00
Kernel: Make the purge() syscall superuser-only
I don't think we need to give unprivileged users access to what is essentially a kernel testing mechanism.
This commit is contained in:
parent
907b090ddf
commit
7f843ef3b2
2 changed files with 3 additions and 1 deletions
|
@ -23,6 +23,6 @@ If no options are specified, all possible memory is released.
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ purge
|
# purge
|
||||||
Purged page count: 744
|
Purged page count: 744
|
||||||
```
|
```
|
||||||
|
|
|
@ -463,6 +463,8 @@ int Process::sys$madvise(void* address, size_t size, int advice)
|
||||||
|
|
||||||
int Process::sys$purge(int mode)
|
int Process::sys$purge(int mode)
|
||||||
{
|
{
|
||||||
|
if (!is_superuser())
|
||||||
|
return -EPERM;
|
||||||
int purged_page_count = 0;
|
int purged_page_count = 0;
|
||||||
if (mode & PURGE_ALL_VOLATILE) {
|
if (mode & PURGE_ALL_VOLATILE) {
|
||||||
NonnullRefPtrVector<PurgeableVMObject> vmobjects;
|
NonnullRefPtrVector<PurgeableVMObject> vmobjects;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue