Skip to content
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

Missing support for arm64e #39208

Open
bestbug456 opened this issue May 22, 2020 · 9 comments
Open

Missing support for arm64e #39208

bestbug456 opened this issue May 22, 2020 · 9 comments
Labels
arch-arm64 ExpertNeeded NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bestbug456
Copy link

What version of Go are you using (go version)?

$ go version

go version go1.14.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

I was wondering if arm64e is supported but I didn't see any reference to this architecture after check with go tool dist list and try to build with GOARCH=arm64e I see is not supported yet. Even if is a new architecture, does someone know when or if this arch will be supported by Go?

Kind regards

@martisch
Copy link
Contributor

martisch commented May 22, 2020

Is arm64e differrent than ARMv8.3?

The later should be compatible with Go GC arm64.
If arm64 does not work please report what happens/or is missing to execute a arm64 Go binary on "arm64e" hardware.

Note that Go GC does not usually compile to specific optional architecture extensions with a separate GOARCH but uses runtime dispatch to use newer instructions.

The minimum requirement for arm64 is

Example for ARMv8.1 atomics:
https://go-review.googlesource.com/c/go/+/81877/

@martisch martisch added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 22, 2020
@bestbug456
Copy link
Author

Hi martisch from what I've understand if GO already support ARMv8.3 it should already support the arm64e since in armv8.3 the pointer are authenticated which is the main feature I'm interested on. So you are suggesting I'm doing something wrong with CFLAGS/LDFLAGS when I run the compiling process?

@martisch
Copy link
Contributor

martisch commented May 22, 2020

Im suggesting that for Go GC the right GOARCH to use is arm64. By support I mean that an arm64 compiled go binary should work on ARM8.3.

However I do not think Go GC does anything special about authenticated pointers. Supporting those would be a feature request for that specific arch feature. It would be good to clarify what more precisely is wanted (just assembler instruction support, or do some kernel interfaces need to be called/wrapped differently, should go build compile C code with -msign-return-address using gcc, should Go GC itself sign all return pointers from go functions?...), why this is important in the context of Go and whether there is sufficient hardware available that uses that and would be available for testing and support.

For CFLAGS/LDFLAGS I dont know because I think Go itself would not need those to compile a pure Go binary and there hasnt been anything posted here about the compiling process used and how it fails.

@bestbug456
Copy link
Author

Ok martisch thank you so much for the help, I'll write you back with a description about HWD distribution of chipset which support arm64e and a better description regarding the safe pointer functionality.

Cheers

@martisch
Copy link
Contributor

martisch commented May 22, 2020

I think whats first missing here is what Go should do different from today so "arm64e" is considered to be supported. Does a Go binary compiled for arm64 not work on "arm64e" devices?

@bestbug456
Copy link
Author

As far as I know arm64e permit to sign and authenticate pointers to prevent attackers from
escalating memory corruption bugs. A arm64 binary can run on those chipset (since they are an "extension" of arm64) but they can't use the safe pointer feature.
Linux Security Summit -2017:
https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdf
LLVM Developers' Meeting - 2019:
https://llvm.org/devmtg/2019-10/slides/McCall-Bougacha-arm64e.pdf

@ianlancetaylor
Copy link
Contributor

The arm64e architecture is already supported by Go in the sense that programs built for arm64 will run on arm64e.

The gc compiler does not generate any pointer authentication instructions. As far as I can tell, that shouldn't matter, except that Go programs do not have extra protection against some sorts of stack modification errors.

@golang golang locked and limited conversation to collaborators May 22, 2021
@4ad
Copy link
Member

4ad commented Feb 21, 2022

One situation where this matters is when building with -buildmode=c-shared. A Mach-O arm64e binary (say from a closed source program) can't load an arm64 shared object. Or at least it doesn't seems to be able to in my testing, I can't find any definitive documentation about this.

I don't know if simply tagging the shared object as arm64e would be enough to make this use case work, or if would require more significant ABI changes.

Also I don't if the situation on ELF is different.

There are three separate issues here:

  1. support for generating arm64e files in the linker
  2. support for the arm64e ABI in the cgo shims
  3. full support for the arm64e ABI in the compiler and runtime.

The third one we will be unlikely to ever do, the first one is trivial, the second one doesn't seem too difficult. We should decide whether this is worthy of pursuit for enabling Go plugins in arm64e applications.

+cc @cherrymui

@4ad 4ad reopened this Feb 21, 2022
@4ad
Copy link
Member

4ad commented Feb 21, 2022

Ok, some experiments with doing the first item on the list above. After toolchain is modified to generate arm64e Mach-o binary, I can load arm64e -buildmode=c-shared Go plugins in native arm64e application, but calling into the shared object seems to hang the calling application.

@seankhliao seankhliao added this to the Unplanned milestone Aug 27, 2022
@seankhliao seankhliao added ExpertNeeded NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-arm64 and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. FrozenDueToAge labels Aug 27, 2022
@golang golang unlocked this conversation Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 ExpertNeeded NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants