Skip to content

cmd/asm: arm64 assembler generates code that is not execute-only compatible #59615

Open

Description

@4a6f656c

The Go assembler for arm64 generates code that is not execute-only compatible, since it stores constants in the text section rather than in rodata, which it then reads during execution.

OpenBSD 7.3 has enabled xonly by default on OpenBSD/arm64 - this means that externally linked Go binaries segfault on execution. This can be worked around in the interim by disabling execute-only when the external linker is invoked.

Longer term, the assembler should store constants in rodata and/or load them via instructions, such that the text section can be marked as execute-only.

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Apr 13, 2023
  2. dr2chase commented on Apr 13, 2023

    @dr2chase
    Contributor

    @golang/compiler

  3. gopherbot commented on Apr 13, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/484555 mentions this issue: cmd/link/internal/ld: disable execute-only for external linking on openbsd/arm64

  4. randall77 commented on Apr 13, 2023

    @randall77
    Contributor

    I know of one place where we read instruction memory, to print instruction bytes after a SIGILL:

    https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/runtime/signal_unix.go;l=747

    Not super critical, but if we're running in execute-only mode it would be good to disable that code.

  5. erifan commented on Apr 14, 2023

    @erifan

    since it stores constants in the text section rather than in rodata, which it then reads during execution.

    Do you mean literal pool ?

  6. 4a6f656c commented on Apr 14, 2023

    @4a6f656c
    ContributorAuthor

    since it stores constants in the text section rather than in rodata, which it then reads during execution.

    Do you mean literal pool ?

    Yes.

  7. added
    FeatureRequestIssues asking for a new feature that does not need a proposal.
    on Apr 19, 2023
  8. added this to the Backlog milestone on Apr 19, 2023
  9. gopherbot commented on Jul 24, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/512538 mentions this issue: cmd/internal/obj/arm64: improve classification of loads and stores

  10. gopherbot commented on Jul 24, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/512540 mentions this issue: cmd/internal/obj/arm64: improve splitting of 24 bit unsigned scaled immediates

  11. gopherbot commented on Jul 24, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/512539 mentions this issue: cmd/internal/obj/arm64: avoid unnecessary literal pool usage for moves

  12. gopherbot commented on Aug 3, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/515617 mentions this issue: cmd/internal/obj/arm64: load large constants into vector registers from rodata

  13. gopherbot commented on Aug 3, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/515615 mentions this issue: cmd/internal/obj/arm64: avoid unnecessary pool literal usage for load/store pairs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-arm64compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions