mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 15:55:07 +00:00
Kernel: Remove SmapDisabler in sys$setgroups()
This commit is contained in:
parent
0341ddc5eb
commit
eb7b0c76a8
1 changed files with 7 additions and 3 deletions
|
@ -2618,17 +2618,21 @@ int Process::sys$getgroups(ssize_t count, gid_t* gids)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Process::sys$setgroups(ssize_t count, const gid_t* gids)
|
int Process::sys$setgroups(ssize_t count, const gid_t* user_gids)
|
||||||
{
|
{
|
||||||
REQUIRE_PROMISE(id);
|
REQUIRE_PROMISE(id);
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!is_superuser())
|
if (!is_superuser())
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
if (count && !validate_read(gids, count))
|
if (count && !validate_read(user_gids, count))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
Vector<gid_t> gids;
|
||||||
|
gids.resize(count);
|
||||||
|
copy_from_user(gids.data(), user_gids, sizeof(gid_t) * count);
|
||||||
|
|
||||||
m_extra_gids.clear();
|
m_extra_gids.clear();
|
||||||
SmapDisabler disabler;
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
if (gids[i] == m_gid)
|
if (gids[i] == m_gid)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue