-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: compiled binaries set PT_GNU_STACK alignment to 2**3 on amd64 #12013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/cc @ianlancetaylor I don't think this is specific to the cgo binary. I see this for all Go executables on my Ubuntu 14.04 amd64 machine. However, I also see it for about 20% of executables in /usr/bin. What exactly is the consequence of this? I can't find any documented significance to the alignment field of PT_GNU_STACK. Glibc only seems to care about the flags field. |
@mdempsky yea I'm not sure what alignment does 😁 in the dynamic loader, or its significance either, as I can't seem to find any documentation either. My guess is it's "documented" in the source code for the dynamic linker. However, I'm not sure I'd have changed the title, since the issue was specifically about the last program header being bad (unless you think the alignment is the cause of the malformed final header), e.g.:
is not a valid header; not only is the program header name unknown, it's flags are nill, and it has '2a00' after flags, which is probably an artifact of |
Oh, that's the PT_PAX_FLAGS header, and it's working as intended. Just objdump doesn't know its name. |
Ah, apologies, sorry for wasting your time. |
Apologies ahead of time if this issue is raised in the wrong spot; the golang/tools repo is only a mirror, and couldn't raise it there, where I suspect it belongs.
Issue
I was scanning all of my binaries in
/usr/lib
and my program noticed the binary at/usr/lib/go/pkg/tool/linux_amd64/cgo
seems to have an invalid or unknown program header.objdump
verifies this issue as well. Here is its output:If I had to guess, I'd say perhaps the 2nd to last program header, STACK, has an incorrect alignment (2³ instead of 2⁴ which you normally see in programs), and this might be bleeding over into the next program header. It's hard to say though, obviously.
Affected platforms
I've only checked on the following linux systems:
The text was updated successfully, but these errors were encountered: