[libattach] misleading error message when checking gid fails
hi at stuartnelson.xyz
Fri Jan 7 11:33:55 UTC 2022
First, apologies if this should be directed to a different mailing list, I didn't find one that seemed correct in the mailing lists (https://mail.openjdk.java.net/mailman/listinfo).
I was building up a syscall filters list for a java process for seccomp, when I encountered this error stack trace:
Caused by: java.io.IOException: well-known file /proc/1974261/root/tmp/.java_pid1974261 is not secure: file's group should be the current group (which is -1) but the group is 1000
at jdk.attach/sun.tools.attach.VirtualMachineImpl.checkPermissions(Native Method)
... 6 more
The error originates from this line:
The value for gid is found on this line:
The reason getegid() returns -1 is because it wasn't in my allowed syscalls list for seccomp, so EPERM (-1) was returned instead.
My question is: -1 is an invalid gid. Should this be checked in the code, and a more helpful error message returned? It could definitely save future developers time.
More information about the jdk-dev