Skip to content

Commit f66925e

Browse files
committed
syscall: check correct group in Faccessat
The Faccessat call checks the user, group, or other permission bits of a file to see if the calling process can access it. The test to see if the group permissions should be used was made with the wrong group id, using the process's group id rather than the file's group id. Fix this to use the correct group id. No test since we cannot easily change file permissions when not running as root and the test is meaningless if running as root. For #52313 Change-Id: I4e2c84754b0af7830b40fd15dedcbc58374d75ee Reviewed-on: https://go-review.googlesource.com/c/go/+/399539 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 4569fe6 commit f66925e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/syscall/syscall_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
109109
gid = Getgid()
110110
}
111111

112-
if uint32(gid) == st.Gid || isGroupMember(gid) {
112+
if uint32(gid) == st.Gid || isGroupMember(int(st.Gid)) {
113113
fmode = (st.Mode >> 3) & 7
114114
} else {
115115
fmode = st.Mode & 7

0 commit comments

Comments
 (0)