This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] riscv: remove DL_RO_DYN_SECTION
- From: Maciej Rozycki <macro at wdc dot com>
- To: Jim Wilson <jimw at sifive dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, David Abdurachmanov <david dot abdurachmanov at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>, Palmer Dabbelt <palmer at sifive dot com>, DJ Delorie <dj at delorie dot com>
- Date: Wed, 29 May 2019 22:03:34 +0000
- Subject: Re: [PATCH] riscv: remove DL_RO_DYN_SECTION
- References: <20190409112529.13930-1-david.abdurachmanov@gmail.com> <87y34jjtgu.fsf@oldenburg2.str.redhat.com> <CAFyWVaYYt16bNwh2EHLCtnpH9DeEuKt9Sgi66ds+EBFTJOM2VA@mail.gmail.com>
- Wdcipoutbound: EOP-TRUE
On Tue, 9 Apr 2019, Jim Wilson wrote:
> I believe this was blindly copied from MIPS, and that no one on the
> RISC-V side will know why it is there, because it was blindly copied
> from MIPS.
>
> Looking at the MIPS SVR4 ABI, I see
> .dynamic This is the same as the generic ABI section of the same type, but
> the MIPS-specific version does not include the SHF_WRITE at-
> tribute.
>
> I don't see any other reason in the spec for this to be read-only, but
> making it read-only probably improves program security. I don't see
> an equivalent statement in the RISC-V ABI.
For the record the MIPS port can get away with a read-only dynamic
segment (which is indeed somewhat advantageous security-wise), because it
does not use the DT_DEBUG entry which requires an update at runtime and
relies on DT_MIPS_RLD_MAP and (more recently for PIE) DT_MIPS_RLD_MAP_REL
instead. For DSOs DT_DEBUG is not used and therefore the dynamic segment
can be read-only regardless I believe.
Maybe we can arrange for a read-only dynamic segment in the RISC-V ABI
after all? At the time DT_MIPS_RLD_MAP_REL was being crafted I advocated
for a generic tag[1], but the idea was rejected. We can make our own
processor-specific tag, such as DT_RISCV_RLD_MAP_REL, or reconsider my
idea of DT_GNU_RLD_MAP (or DT_GNU_RLD_MAP_REL).
References:
[1] "Support shared library debug with MIPS PIE",
<https://sourceware.org/ml/binutils/2015-06/msg00227.html>
HTH,
Maciej