This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] riscv: remove DL_RO_DYN_SECTION


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]