Skip to content

[compiler-rt] Disable executable stack on aeabi_u{read,write}*.S - #214465

Merged
statham-arm merged 1 commit into
llvm:mainfrom
tgross35:no-exec-stack
Aug 6, 2026
Merged

[compiler-rt] Disable executable stack on aeabi_u{read,write}*.S#214465
statham-arm merged 1 commit into
llvm:mainfrom
tgross35:no-exec-stack

Conversation

@tgross35

@tgross35 tgross35 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

These were missing NO_EXEC_STACK_DIRECTIVE to add .note.GNU-stack; without it, a binary including any of these files will have the stack marked executable. Add the directive here, matching other similar files.

Symtab diff before:

$ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S --target=arm-unknown-linux-gnueabi -c
$ llvm-readelf aeabi_uread4.o -S
There are 5 section headers, starting at offset 0xe4:

Section Headers:
  [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .strtab           STRTAB          00000000 0000a8 000039 00      0   0  1
  [ 2] .text             PROGBITS        00000000 000034 000020 00  AX  0   0  4
  [ 3] .ARM.attributes   ARM_ATTRIBUTES  00000000 000054 000022 00      0   0  1
  [ 4] .symtab           SYMTAB          00000000 000078 000030 10      1   2  4

After:

$ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S --target=arm-unknown-linux-gnueabi -c
$ llvm-readelf aeabi_uread4.o -S
There are 6 section headers, starting at offset 0xf4:

Section Headers:
  [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .strtab           STRTAB          00000000 0000a8 000049 00      0   0  1
  [ 2] .text             PROGBITS        00000000 000034 000020 00  AX  0   0  4
  [ 3] .note.GNU-stack   PROGBITS        00000000 000054 000000 00      0   0  1
  [ 4] .ARM.attributes   ARM_ATTRIBUTES  00000000 000054 000022 00      0   0  1
  [ 5] .symtab           SYMTAB          00000000 000078 000030 10      1   2  4

Fixes: 39413af ("[Compiler-rt] Implement AEABI Unaligned Read/Write
Helpers in compiler-rt (#167913)")

These were missing `NO_EXEC_STACK_DIRECTIVE` to add `.note.GNU-stack`;
without it, a binary including any of these files will have the stack
marked executable. Add the directive here, matching other similar files.

Symtab diff before:

    $ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S --target=arm-unknown-linux-gnueabi -c
    $ llvm-readelf aeabi_uread4.o -S
    There are 5 section headers, starting at offset 0xe4:

    Section Headers:
      [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al
      [ 0]                   NULL            00000000 000000 000000 00      0   0  0
      [ 1] .strtab           STRTAB          00000000 0000a8 000039 00      0   0  1
      [ 2] .text             PROGBITS        00000000 000034 000020 00  AX  0   0  4
      [ 3] .ARM.attributes   ARM_ATTRIBUTES  00000000 000054 000022 00      0   0  1
      [ 4] .symtab           SYMTAB          00000000 000078 000030 10      1   2  4

After:

    $ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S --target=arm-unknown-linux-gnueabi -c
    $ llvm-readelf aeabi_uread4.o -S
    There are 6 section headers, starting at offset 0xf4:

    Section Headers:
      [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al
      [ 0]                   NULL            00000000 000000 000000 00      0   0  0
      [ 1] .strtab           STRTAB          00000000 0000a8 000049 00      0   0  1
      [ 2] .text             PROGBITS        00000000 000034 000020 00  AX  0   0  4
      [ 3] .note.GNU-stack   PROGBITS        00000000 000054 000000 00      0   0  1
      [ 4] .ARM.attributes   ARM_ATTRIBUTES  00000000 000054 000022 00      0   0  1
      [ 5] .symtab           SYMTAB          00000000 000078 000030 10      1   2  4

Fixes: 39413af ("[Compiler-rt] Implement AEABI Unaligned Read/Write
       Helpers in compiler-rt (llvm#167913)")
@tgross35

tgross35 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Picked up in part of rust's CI rust-lang/compiler-builtins#1246 (comment)

@compnerd @simpal01 @statham-arm @vhscampos could you review? (rt maintainer plus reviewer from where this was introduced)

@tgross35

tgross35 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@statham-arm could you please merge this for me?

@statham-arm
statham-arm merged commit 849c51e into llvm:main Aug 6, 2026
17 checks passed
@tgross35
tgross35 deleted the no-exec-stack branch August 6, 2026 13:10
@tgross35

tgross35 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick 849c51e

@tgross35

tgross35 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I think I'll need some help setting the milestone. This should be cherry picked since it was introduced in LLVM23

@llvmbot

llvmbot commented Aug 6, 2026

Copy link
Copy Markdown
Member

/cherry-pick 849c51e

Error: Command failed due to missing milestone.

@statham-arm

Copy link
Copy Markdown
Contributor

/cherry-pick 849c51e

@llvmbot

llvmbot commented Aug 6, 2026

Copy link
Copy Markdown
Member

/pull-request #214489

tgross35 added a commit to rust-lang/compiler-builtins that referenced this pull request Aug 7, 2026
Pull in a patch that landed just recently but hasn't yet been
backported. Without it, symcheck fails.

Link: llvm/llvm-project#214465
tgross35 added a commit to tgross35/compiler-builtins that referenced this pull request Aug 7, 2026
Pull in a patch that landed just recently but hasn't yet been
backported. Without it, symcheck fails.

Link: llvm/llvm-project#214465
dyung pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 7, 2026
…lvm#214465)

These were missing `NO_EXEC_STACK_DIRECTIVE` to add `.note.GNU-stack`;
without it, a binary including any of these files will have the stack
marked executable. Add the directive here, matching other similar files.

Symtab diff before:

$ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S
--target=arm-unknown-linux-gnueabi -c
    $ llvm-readelf aeabi_uread4.o -S
    There are 5 section headers, starting at offset 0xe4:

    Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .strtab STRTAB 00000000 0000a8 000039 00 0 0 1
[ 2] .text PROGBITS 00000000 000034 000020 00 AX 0 0 4
[ 3] .ARM.attributes ARM_ATTRIBUTES 00000000 000054 000022 00 0 0 1
[ 4] .symtab SYMTAB 00000000 000078 000030 10 1 2 4

After:

$ clang compiler-rt/lib/builtins/arm/aeabi_uread4.S
--target=arm-unknown-linux-gnueabi -c
    $ llvm-readelf aeabi_uread4.o -S
    There are 6 section headers, starting at offset 0xf4:

    Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .strtab STRTAB 00000000 0000a8 000049 00 0 0 1
[ 2] .text PROGBITS 00000000 000034 000020 00 AX 0 0 4
[ 3] .note.GNU-stack PROGBITS 00000000 000054 000000 00 0 0 1
[ 4] .ARM.attributes ARM_ATTRIBUTES 00000000 000054 000022 00 0 0 1
[ 5] .symtab SYMTAB 00000000 000078 000030 10 1 2 4

Fixes: 39413af ("[Compiler-rt] Implement AEABI Unaligned Read/Write
       Helpers in compiler-rt (llvm#167913)")
(cherry picked from commit 849c51e)
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 17, 2026
Pull in a patch that landed just recently but hasn't yet been
backported. Without it, symcheck fails.

Link: llvm/llvm-project#214465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants