-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants #72713
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
647aa46
[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants
kovdan01 8d7ee46
Address review comments
kovdan01 b0c9a28
Use `#` instead of `//` for lit and FileCheck directives
kovdan01 f9103d5
Process SHT_AARCH64_AUTH_RELR as target-specific section type
kovdan01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-feature-pauth.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# RUN: rm -rf %t && split-file %s %t && cd %t | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag.s -o tag.o | ||
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-short.s -o tag-short.o | ||
# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-long.s -o tag-long.o | ||
|
||
# RUN: llvm-readelf --notes tag.o | FileCheck --check-prefix NORMAL %s | ||
# RUN: llvm-readelf --notes tag-short.o | FileCheck --check-prefix SHORT %s | ||
# RUN: llvm-readelf --notes tag-long.o | FileCheck --check-prefix LONG %s | ||
|
||
# NORMAL: AArch64 PAuth ABI tag: platform 0x2a, version 0x1 | ||
# SHORT: AArch64 PAuth ABI tag: <corrupted size: expected at least 16, got 12> | ||
# LONG: AArch64 PAuth ABI tag: platform 0x2a, version 0x1, additional info 0xEFCDAB8967452301 | ||
|
||
# RUN: llvm-readobj --notes tag.o | FileCheck --check-prefix LLVM-NORMAL %s | ||
# RUN: llvm-readobj --notes tag-short.o | FileCheck --check-prefix LLVM-SHORT %s | ||
# RUN: llvm-readobj --notes tag-long.o | FileCheck --check-prefix LLVM-LONG %s | ||
|
||
// LLVM-SHORT: Notes [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not mix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in b0c9a28, thanks |
||
// LLVM-SHORT-NEXT: NoteSection { | ||
// LLVM-SHORT-NEXT: Name: .note.AARCH64-PAUTH-ABI-tag | ||
// LLVM-SHORT-NEXT: Offset: 0x40 | ||
// LLVM-SHORT-NEXT: Size: 0x1C | ||
// LLVM-SHORT-NEXT: Note { | ||
// LLVM-SHORT-NEXT: Owner: ARM | ||
// LLVM-SHORT-NEXT: Data size: 0xC | ||
// LLVM-SHORT-NEXT: Type: NT_ARM_TYPE_PAUTH_ABI_TAG | ||
// LLVM-SHORT-NEXT: Description data ( | ||
// LLVM-SHORT-NEXT: 0000: 2A000000 00000000 01000000 | ||
// LLVM-SHORT-NEXT: ) | ||
// LLVM-SHORT-NEXT: } | ||
// LLVM-SHORT-NEXT: } | ||
// LLVM-SHORT-NEXT: ] | ||
|
||
// LLVM-NORMAL: Notes [ | ||
// LLVM-NORMAL-NEXT: NoteSection { | ||
// LLVM-NORMAL-NEXT: Name: .note.AARCH64-PAUTH-ABI-tag | ||
// LLVM-NORMAL-NEXT: Offset: 0x40 | ||
// LLVM-NORMAL-NEXT: Size: 0x20 | ||
// LLVM-NORMAL-NEXT: Note { | ||
// LLVM-NORMAL-NEXT: Owner: ARM | ||
// LLVM-NORMAL-NEXT: Data size: 0x10 | ||
// LLVM-NORMAL-NEXT: Type: NT_ARM_TYPE_PAUTH_ABI_TAG | ||
// LLVM-NORMAL-NEXT: Platform: 42 | ||
// LLVM-NORMAL-NEXT: Version: 1 | ||
// LLVM-NORMAL-NEXT: } | ||
// LLVM-NORMAL-NEXT: } | ||
// LLVM-NORMAL-NEXT: ] | ||
|
||
// LLVM-LONG: Notes [ | ||
// LLVM-LONG-NEXT: NoteSection { | ||
// LLVM-LONG-NEXT: Name: .note.AARCH64-PAUTH-ABI-tag | ||
// LLVM-LONG-NEXT: Offset: 0x40 | ||
// LLVM-LONG-NEXT: Size: 0x28 | ||
// LLVM-LONG-NEXT: Note { | ||
// LLVM-LONG-NEXT: Owner: ARM | ||
// LLVM-LONG-NEXT: Data size: 0x18 | ||
// LLVM-LONG-NEXT: Type: NT_ARM_TYPE_PAUTH_ABI_TAG | ||
// LLVM-LONG-NEXT: Platform: 42 | ||
// LLVM-LONG-NEXT: Version: 1 | ||
// LLVM-LONG-NEXT: Additional info: EFCDAB8967452301 | ||
// LLVM-LONG-NEXT: } | ||
// LLVM-LONG-NEXT: } | ||
// LLVM-LONG-NEXT: ] | ||
|
||
#--- abi-tag.s | ||
|
||
.section ".note.AARCH64-PAUTH-ABI-tag", "a" | ||
.long 4 | ||
.long 16 | ||
.long 1 | ||
.asciz "ARM" | ||
|
||
.quad 42 // platform | ||
.quad 1 // version | ||
|
||
#--- abi-tag-short.s | ||
|
||
.section ".note.AARCH64-PAUTH-ABI-tag", "a" | ||
.long 4 | ||
.long 12 | ||
.long 1 | ||
.asciz "ARM" | ||
|
||
.quad 42 | ||
.word 1 | ||
|
||
#--- abi-tag-long.s | ||
|
||
.section ".note.AARCH64-PAUTH-ABI-tag", "a" | ||
.long 4 | ||
.long 24 | ||
.long 1 | ||
.asciz "ARM" | ||
|
||
.quad 42 // platform | ||
.quad 1 // version | ||
.quad 0x0123456789ABCDEF // extra data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't see this value defined in the linked spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see section 14.1 https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#141default-marking-schema: "The type field shall be 1".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have a few (small) concerns with this:
I don't know who is in charge of those docs, but is it possible to update them to specifically name the NT_* value? That would resolve my concern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithp35 Could we provide this constant name
NT_ARM_TYPE_PAUTH_ABI_TAG
(or some other name) and its value1
in the section 14.1 of the spec https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#appendix-alternative-elf-marking-using-gnu-program-properties?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithp35 A kind reminder regarding my question above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I've got this right:
The link above is for GNU program properties:
https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#19appendix-alternative-elf-marking-using-gnu-program-properties
It defines an additional program property on top of the existing .note.GNU.property defined in the Linux ABI extensions https://raw.githubusercontent.com/wiki/hjl-tools/linux-abi/linux-abi-draft.pdf that already has its own
NT_GNU_PROPERTY_TYPE_0
There is a part here which defines .note.AARCH64-PAUTH-ABI-tag which I think is where an additional
NT_ARM_TYPE_PAUTH_ABI_TAG
would make sense.https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#141default-marking-schema
Have I got that right?
In any case please can you raise an issue on the AArch64 ABI for that https://github.com/ARM-software/abi-aa so it can be addressed there. I'll also need to update the document to make it compatible with some forthcoming changes in the ABI to do with ELF marking. It is unfortunate that this will land too late for your timescale.
Essentially these pull-requests:
None have been merged yet, but pending more review comments there is a consensus within Arm that we'll be using build attributes (like 32-bit Arm) for ELF metadata in relocatable objects and for SysvAbi platforms such as Linux we'll be using .note.GNU.properties as our reference ELF marking scheme for executables and shared-libraries.
I expect that when the PAuthABI specification comes out of Alpha it will need to be updated, most likely to make the current Alternative ELF marking will be the reference marking, and the .note.AARCH64-PAUTH-ABI-tag will become the alternative. I've already defined build attibutes for PAuthABI that match the existing implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It looks like I placed link a wrong link but a correct section number above :) I meant 14.1 https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#141default-marking-schema.
Submitted ARM-software/abi-aa#234. Thanks!