From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id A0730384642B; Wed, 26 Oct 2022 15:16:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0730384642B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666797398; bh=FoM7+r/LeUviaoYSLI4QMt7ucOZc7EG/oWp4d0FIjl0=; h=From:To:Subject:Date:From; b=JqvYUTbMj2hQ98ob6u2MJvkqrsB3bqEDFctu3vJvWbBkyyFB3BvrmsGOlVOE8HjXy yLgBFiTxTutRGpOKPI7bQV1ykUQjv/vT1zF8q0UwXheI2SJjjT4qrITZ2Ea2EUgx5f r/aGe9C8f9nBsrQodOosGP9Wv7gjJmaDeHJvn7uw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] cheri: elf: add an RW capability to link_map X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: 6b86cb6bf1a61f52c03f466742ebebcc746853aa X-Git-Newrev: e836294c7947f2c7f3f8b50d518605ae6c487aa2 Message-Id: <20221026151638.A0730384642B@sourceware.org> Date: Wed, 26 Oct 2022 15:16:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e836294c7947f2c7f3f8b50d518605ae6c487aa2 commit e836294c7947f2c7f3f8b50d518605ae6c487aa2 Author: Szabolcs Nagy 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];