From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 4F77D3858034; Wed, 12 Oct 2022 14:17:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F77D3858034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665584231; bh=p4a/PEXDTzHUpn/8JT0v5AMvW/u2Z5BWd4tiCCNBRbg=; h=From:To:Subject:Date:From; b=mrv9/HdfUebYsC33HtvdTR/FHS/kpa5fkEn57RkOgCJbbcTVY5CdKHaGJ7J7IQ5lR TUHf1HVOTSw/Chvgvlvw+9s6mgcROwzPn71299znwDRHXM3vXJARiABGNIun7UkPSO 7/LAB4bB8iFbQitqTMM3fpERMfkrrux1qjMomS6U= 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: 11e0080cd54f35d11ed45ba18a52419608203ad8 X-Git-Newrev: 55ada9157de78b614f56169643942f31d36b0035 Message-Id: <20221012141711.4F77D3858034@sourceware.org> Date: Wed, 12 Oct 2022 14:17:11 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=55ada9157de78b614f56169643942f31d36b0035 commit 55ada9157de78b614f56169643942f31d36b0035 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 6dd8e712c4..e1dca89762 100644 --- a/include/link.h +++ b/include/link.h @@ -257,6 +257,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];