forked from OSchip/llvm-project
[ELF][AArch64] Fix potentially corrupted section content for PAC
D74537 introduced a bug: if `(config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_PAC) != 0` with -z pac-plt unspecified, we incorrectly use AArch64BtiPac, whose writePlt will make out-of-bounds write after the .plt section. This is often benign because the output section after .plt will usually overwrite the content. This is very difficult to test without D131247 (Parallelize writes of different OutputSections).
This commit is contained in:
parent
e89d6d2ac5
commit
d7cbfcf36a
|
@ -884,8 +884,8 @@ void AArch64BtiPac::writePlt(uint8_t *buf, const Symbol &sym,
|
|||
}
|
||||
|
||||
static TargetInfo *getTargetInfo() {
|
||||
if (config->andFeatures & (GNU_PROPERTY_AARCH64_FEATURE_1_BTI |
|
||||
GNU_PROPERTY_AARCH64_FEATURE_1_PAC)) {
|
||||
if ((config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
|
||||
config->zPacPlt) {
|
||||
static AArch64BtiPac t;
|
||||
return &t;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue