Open wheelerlaw opened 1 year ago
@wheelerlaw for submitting your patch, see https://go.dev/doc/contribute for how to contribute. Thanks.
@wheelerlaw do you need help with this one? Should I takeover?
@wheelerlaw do you need help with this one? Should I takeover?
Sorry, been a busy few weeks moving apartments, I will get a patch submitted sometime this weekend.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, on macOS Catalina
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Called
unix.SysctlRaw()
to get the args of a process on Catalina (through the use of thegithub.com/elastic/go-sysinfo
package)I have created a small demo test in my fork of
go-sysinfo
that demonstrates the issue. Note: this must be run on macOS Catalina in order to the issue to be reproduced.What did you expect to see?
The
unix.SysctlRaw()
function return the args of a process on Catalina.What did you see instead?
I noticed that using
unix.SysctlRaw()
to call thekern.procargs2
syscall on macOS Catalina does not return the args for a process due to a couple bugs inxnu
:executable_path=
that prefixes name of the executable. This size is then used to allocate a buffer which is where the args are copied into.More details about this issue is documented in the fixed version of
xnu
'skern_sysctl.c
.These bugs are not going to be fixed in Catalina because Apple has discontinued support for the OS. However, Catalina is still technically a supported platform for the latest version of Go, so I went ahead and created a patch in the
x/sys
package that works around thexnu
kernel bug. I'm not sure how to submit it but I am looking for feedback on it.