0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-08-15 20:33:10 +00:00
Files
termux-packages/packages/deno/0007-disable-unallowed-syscalls.patch
Komo 6f978e2faf enable,bump(main/deno): 2.2.13 (#22379)
Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com>
Co-authored-by: Jia Yuan Lo <jylo06g@gmail.com>
2025-06-23 23:33:00 +08:00

29 lines
702 B
Diff

`setgroups` are only allowed when user is root, i.e. `getuid() == 0`
https://github.com/denoland/deno/issues/19759#issuecomment-2914426954
--- a/ext/process/lib.rs
+++ b/ext/process/lib.rs
@@ -520,7 +520,9 @@
libc::close(src);
}
}
- libc::setgroups(0, std::ptr::null());
+ if libc::getuid() == 0 {
+ libc::setgroups(0, std::ptr::null());
+ }
Ok(())
});
@@ -1068,7 +1070,9 @@
#[allow(clippy::undocumented_unsafe_blocks)]
unsafe {
c.pre_exec(|| {
- libc::setgroups(0, std::ptr::null());
+ if libc::getuid() == 0 {
+ libc::setgroups(0, std::ptr::null());
+ }
Ok(())
});
}