public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/arm/morello/main] cheri: elf: add an RW capability to link_map
Date: Wed, 23 Nov 2022 14:45:12 +0000 (GMT)	[thread overview]
Message-ID: <20221123144513.024173852C4A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f70a0f9a14ebb996d2d914b3067e6fcf4faf5ee0

commit f70a0f9a14ebb996d2d914b3067e6fcf4faf5ee0
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Mon Aug 8 09:22:44 2022 +0100

    cheri: elf: add an RW capability to link_map
    
    For each module keep an RX and an RW root capability.  Use the existing
    l_map_start for RX (covering all load segments) and add l_rw_start for
    RW (covering all writable load segments).
    
    For relocation processing, we also need individual RW ranges to decide
    which objects need to be derived from RW and RX capabilities.  In
    practice most modules have exactly one RW segment and it's unlikely
    that any module needs more than four distinct ranges to tightly cover
    the RW mappings.
    
    Only added on CHERI targets so always has to be used behind ifdef.

Diff:
---
 include/link.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/link.h b/include/link.h
index 7632ae33d3..79c8a57690 100644
--- a/include/link.h
+++ b/include/link.h
@@ -256,6 +256,18 @@ struct link_map
     ElfW(Addr) l_map_end;
     /* End of the executable part of the mapping.  */
     ElfW(Addr) l_text_end;
+#ifdef __CHERI_PURE_CAPABILITY__
+    /* Writable part of the mapping (may have non-writable holes).  */
+    elfptr_t l_rw_start;
+# define DL_MAX_RW_COUNT 4
+    /* Writable ranges: objects are writable in these ranges.  */
+    int l_rw_count;
+    struct rw_range
+    {
+      ElfW(Addr) start;
+      ElfW(Addr) end;
+    } l_rw_range[DL_MAX_RW_COUNT];
+#endif
 
     /* Default array for 'l_scope'.  */
     struct r_scope_elem *l_scope_mem[4];

             reply	other threads:[~2022-11-23 14:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 14:45 Szabolcs Nagy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-27 13:55 Szabolcs Nagy
2022-10-26 15:16 Szabolcs Nagy
2022-10-12 14:17 Szabolcs Nagy

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=20221123144513.024173852C4A@sourceware.org \
    --to=nsz@sourceware.org \
    --cc=glibc-cvs@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).