This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Copy relocations against protected symbols
- From: Alan Modra <amodra at gmail dot com>
- To: "John D. Hendrickson" <johnandsara2 at cox dot net>
- Cc: binutils at sourceware dot org
- Date: Sun, 14 Dec 2014 12:38:50 +1030
- Subject: Re: Copy relocations against protected symbols
- Authentication-results: sourceware.org; auth=none
- References: <Sd5g1p0282qVqVd01d5i0z> <548C80A2 dot 1090602 at cox dot net>
On Sat, Dec 13, 2014 at 01:08:34PM -0500, John D. Hendrickson wrote:
> Alan Modra wrote:
> >Copy relocs are used in a scheme to avoid dynamic text relocations in
> >non-PIC executables that refer to variables defined in shared
> >libraries. The idea is to have the linker define any such variable in
> >the executable, with a copy reloc copying the initial value, then have
> >both the executable and shared library refer to the executable copy.
> >If the shared library defines the variable as protected then we have
>
> i find the statements a cross-testimony, contradictory
>
> if the library has posted a symbol as protected there is a reason
>
> if a program contains a reference to the symbol and writes to it (i'm unsure
> that's possible) then obviously the program is faulty, as it broke a rule,
> and i'd expect a segfault of the largess of the shared lib was in protected
> memory
>
> the program could easily copy the value, or, open the library itself
> (meaning the program could load a private copy of lib if it needed to do so,
> rather than force all other programs to run code that is usually the wrong
> thing to do)
When I said "protected" above, I wasn't meaning anything to do with
memory protection but rather symbol visibility STV_PROTECTED. See
http://www.sco.com/developers/gabi/latest/ch4.symtab.html#symbol_value
--
Alan Modra
Australia Development Lab, IBM