From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: libc-stable@sourceware.org
Subject: [2.32 COMMITTED 1/5] aarch64: Fix missing BTI protection from dependencies [BZ #26926]
Date: Thu, 21 Jan 2021 10:44:13 +0000 [thread overview]
Message-ID: <20210121104413.21189-1-szabolcs.nagy@arm.com> (raw)
The _dl_open_check and _rtld_main_check hooks are not called on the
dependencies of a loaded module, so BTI protection was missed on
every module other than the main executable and directly dlopened
libraries.
The fix just iterates over dependencies to enable BTI.
Fixes bug 26926.
(cherry picked from commit 72739c79f61989a76b7dd719f34fcfb7b8eadde9)
---
sysdeps/aarch64/dl-bti.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c
index 196e462520..56c097210a 100644
--- a/sysdeps/aarch64/dl-bti.c
+++ b/sysdeps/aarch64/dl-bti.c
@@ -51,11 +51,24 @@ enable_bti (struct link_map *map, const char *program)
return 0;
}
-/* Enable BTI for L if required. */
+/* Enable BTI for L and its dependencies. */
void
_dl_bti_check (struct link_map *l, const char *program)
{
- if (GLRO(dl_aarch64_cpu_features).bti && l->l_mach.bti)
+ if (!GLRO(dl_aarch64_cpu_features).bti)
+ return;
+
+ if (l->l_mach.bti)
enable_bti (l, program);
+
+ unsigned int i = l->l_searchlist.r_nlist;
+ while (i-- > 0)
+ {
+ struct link_map *dep = l->l_initfini[i];
+ if (dep->l_init_called)
+ continue;
+ if (dep->l_mach.bti)
+ enable_bti (dep, program);
+ }
}
--
2.17.1
reply other threads:[~2021-01-21 10:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210121104413.21189-1-szabolcs.nagy@arm.com \
--to=szabolcs.nagy@arm.com \
--cc=libc-stable@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).