diff options
author | Jakob Unterwurzacher | 2025-02-06 21:54:33 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-02-06 21:59:45 +0100 |
commit | cd47ab015e5d4a7ecaee747796fb89b7597b4fc1 (patch) | |
tree | 1e4440f38ffd4181cfc2caa8ca908d064e3fcb32 /internal/syscallcompat/thread_credentials_368_arm.go | |
parent | 3ad8759d55419df51e3435bd40ea9cc62e3d4c87 (diff) |
syscallcompat: add thread_credentials.go & friends
Private copies of per-thread Setreuid/Setegid/Setgroups.
https://github.com/rfjakob/gocryptfs/issues/893
https://github.com/rfjakob/gocryptfs/issues/892
Diffstat (limited to 'internal/syscallcompat/thread_credentials_368_arm.go')
-rw-r--r-- | internal/syscallcompat/thread_credentials_368_arm.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/syscallcompat/thread_credentials_368_arm.go b/internal/syscallcompat/thread_credentials_368_arm.go new file mode 100644 index 0000000..1244160 --- /dev/null +++ b/internal/syscallcompat/thread_credentials_368_arm.go @@ -0,0 +1,35 @@ +//go:build (linux && 386) || (linux && arm) + +package syscallcompat + +import ( + "unsafe" + + "golang.org/x/sys/unix" +) + +// See thread_credentials.go for docs + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := unix.RawSyscall(unix.SYS_SETREUID32, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = e1 + } + return +} + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := unix.RawSyscall(unix.SYS_SETREGID32, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = e1 + } + return +} + +func setgroups(n int, list *uint32) (err error) { + _, _, e1 := unix.RawSyscall(unix.SYS_SETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = e1 + } + return +} |