[pve-devel] [PATCH v2] Tools: add setresuid syscall

Stoiko Ivanov s.ivanov at proxmox.com
Wed Apr 17 10:51:36 CEST 2019


Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Changes v1 -> v2:
* incorporated Thomas' feedback
* learned (again) that `git log -p -- $filename` does not show the complete
  picture

 src/PVE/Syscall.pm | 1 +
 src/PVE/Tools.pm   | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/src/PVE/Syscall.pm b/src/PVE/Syscall.pm
index 0f50c63..a2903b7 100644
--- a/src/PVE/Syscall.pm
+++ b/src/PVE/Syscall.pm
@@ -13,6 +13,7 @@ BEGIN {
 	close => &SYS_close,
 	mkdirat => &SYS_mkdirat,
 	faccessat => &SYS_faccessat,
+	setresuid => &SYS_setresuid,
     );
 };
 
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 189b552..4dd073f 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1384,6 +1384,11 @@ sub parse_host_and_port {
     return; # nothing
 }
 
+sub setresuid($$$) {
+    my ($ruid, $euid, $suid) = @_;
+    return 0 == syscall(PVE::Syscall::setresuid, $ruid, $euid, $suid);
+}
+
 sub unshare($) {
     my ($flags) = @_;
     return 0 == syscall(PVE::Syscall::unshare, $flags);
-- 
2.11.0





More information about the pve-devel mailing list