public inbox for
help / color / mirror / Atom feed
From: Szabolcs Nagy <>
Subject: [glibc/arm/morello/main] TODO(l_addr): cheri: in static exe initialize l_addr to a zero capability
Date: Fri,  5 Aug 2022 19:34:24 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=d257d001c3f16ccc4e4692201d3c03f67a0a9b18

commit d257d001c3f16ccc4e4692201d3c03f67a0a9b18
Author: Szabolcs Nagy <>
Date:   Thu Jun 24 13:29:19 2021 +0100

    TODO(l_addr): cheri: in static exe initialize l_addr to a zero capability
    The base should be 0, but also a valid capability. Initialize to a zero
    capability instead of relying on AT_BASE.
    TODO: this is a hack. we will need stricter bounds and possibly separate
    l_addr and bounds info.

 elf/dl-support.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/elf/dl-support.c b/elf/dl-support.c
index 4af0b5b2ce..599efb1d08 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -248,6 +248,14 @@ _dl_aux_init (ElfW(auxv_t) *av)
   GL(dl_sysinfo) = DL_SYSINFO_DEFAULT;
+  /* Base is 0 in non-pie static executable, but it needs to be a valid
+     capability. Use the zero capability instead of AT_BASE.  */
+  elfptr_t zerocap;
+  asm volatile ("cvtd %0,xzr" : "=r"(zerocap));
+  _dl_main_map.l_addr = zerocap;
   _dl_auxv = av;
   dl_parse_auxv_t auxv_values;
   /* Use an explicit initialization loop here because memset may not

                 reply	other threads:[~2022-08-05 19:34 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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).