Skip to content

[PAC][lld] Test warning emitted for non-PAuth-marked files with -z pac-plt #112958

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

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

kovdan01
Copy link
Contributor

b616262 changed semantics of -z pac-plt initially introduced in
e208208, so, the following comment from test/ELF/aarch64-feature-pac.s
is no longer true:

There are no warnings in this case as the choice to use PAC in PLT entries
is orthogonal to the choice of using PAC in relocatable objects. The
presence of the PAC .note.gnu.property is an indication of preference by
the relocatable object.

This patch updates the test so we ensure a warning is emitted for an
input file when -z pac-plt is passed but the file does not have
GNU_PROPERTY_AARCH64_FEATURE_1_PAC set in GNU_PROPERTY_AARCH64_FEATURE_1_AND
property.

@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-elf

Author: Daniil Kovalev (kovdan01)

Changes

b616262 changed semantics of -z pac-plt initially introduced in
e208208, so, the following comment from test/ELF/aarch64-feature-pac.s
is no longer true:

> There are no warnings in this case as the choice to use PAC in PLT entries
> is orthogonal to the choice of using PAC in relocatable objects. The
> presence of the PAC .note.gnu.property is an indication of preference by
> the relocatable object.

This patch updates the test so we ensure a warning is emitted for an
input file when -z pac-plt is passed but the file does not have
GNU_PROPERTY_AARCH64_FEATURE_1_PAC set in GNU_PROPERTY_AARCH64_FEATURE_1_AND
property.


Full diff: https://github.com/llvm/llvm-project/pull/112958.diff

1 Files Affected:

  • (modified) lld/test/ELF/aarch64-feature-pac.s (+7-5)
diff --git a/lld/test/ELF/aarch64-feature-pac.s b/lld/test/ELF/aarch64-feature-pac.s
index beafe58887db3f..b85a33216cb5bd 100644
--- a/lld/test/ELF/aarch64-feature-pac.s
+++ b/lld/test/ELF/aarch64-feature-pac.s
@@ -76,12 +76,14 @@
 # PACDYN-NOT:      0x0000000070000001 (AARCH64_BTI_PLT)
 # PACDYN-NOT:      0x0000000070000003 (AARCH64_PAC_PLT)
 
-## Turn on PAC entries with the -z pac-plt command line option. There are no
-## warnings in this case as the choice to use PAC in PLT entries is orthogonal
-## to the choice of using PAC in relocatable objects. The presence of the PAC
-## .note.gnu.property is an indication of preference by the relocatable object.
+## Turn on PAC entries with the -z pac-plt command line option. For files w/o
+## GNU_PROPERTY_AARCH64_FEATURE_1_PAC set in GNU_PROPERTY_AARCH64_FEATURE_1_AND
+## property, emit a warning.
+
+# RUN: ld.lld %t.o %t2.o -z pac-plt %t.so -o %tpacplt.exe 2>&1 | FileCheck -DFILE=%t2.o --check-prefix WARN %s
+
+# WARN: warning: [[FILE]]: -z pac-plt: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_PAC property
 
-# RUN: ld.lld %t.o %t2.o -z pac-plt %t.so -o %tpacplt.exe
 # RUN: llvm-readelf -n %tpacplt.exe | FileCheck --check-prefix=PACPROP %s
 # RUN: llvm-readelf --dynamic-table %tpacplt.exe | FileCheck --check-prefix PACDYN2 %s
 # RUN: llvm-objdump --no-print-imm-hex -d --mattr=+v8.3a --no-show-raw-insn %tpacplt.exe | FileCheck --check-prefix PACPLT %s

@kovdan01 kovdan01 self-assigned this Oct 25, 2024
@kovdan01
Copy link
Contributor Author

Would be glad to see everyone's feedback on the changes.

Copy link
Member

@DanielKristofKiss DanielKristofKiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor Author

kovdan01 commented Nov 10, 2024

Merge activity

  • Nov 10, 1:05 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Nov 10, 1:10 AM EST: Graphite rebased this pull request as part of a merge.
  • Nov 10, 1:12 AM EST: A user merged this pull request with Graphite.

…ac-plt`

b616262 changed semantics of `-z pac-plt` initially introduced in
e208208, so, the following comment from test/ELF/aarch64-feature-pac.s
is no longer true:

> There are no warnings in this case as the choice to use PAC in PLT entries
> is orthogonal to the choice of using PAC in relocatable objects. The
> presence of the PAC .note.gnu.property is an indication of preference by
> the relocatable object.

This patch updates the test so we ensure a warning is emitted for an
input file when `-z pac-plt` is passed but the file does not have
GNU_PROPERTY_AARCH64_FEATURE_1_PAC set in GNU_PROPERTY_AARCH64_FEATURE_1_AND
property.
@kovdan01 kovdan01 force-pushed the users/kovdan01/lld-pac-plt-warning branch from 51235d7 to ceefe60 Compare November 10, 2024 06:09
@kovdan01 kovdan01 merged commit f344367 into main Nov 10, 2024
6 of 8 checks passed
@kovdan01 kovdan01 deleted the users/kovdan01/lld-pac-plt-warning branch November 10, 2024 06:12
@MaskRay
Copy link
Member

MaskRay commented Nov 10, 2024

LGTM

Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
…ac-plt` (llvm#112958)

b616262 changed semantics of `-z pac-plt` initially introduced in
e208208, so, the following comment from test/ELF/aarch64-feature-pac.s
is no longer true:

> There are no warnings in this case as the choice to use PAC in PLT entries
> is orthogonal to the choice of using PAC in relocatable objects. The
> presence of the PAC .note.gnu.property is an indication of preference by
> the relocatable object.

This patch updates the test so we ensure a warning is emitted for an
input file when `-z pac-plt` is passed but the file does not have
GNU_PROPERTY_AARCH64_FEATURE_1_PAC set in GNU_PROPERTY_AARCH64_FEATURE_1_AND
property.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants