don't assume reloc_addr passed to elf_machine_rel* is aligned

Alexandre Oliva aoliva@redhat.com
Thu Jun 26 09:04:00 GMT 2003


On Jun 24, 2003, Roland McGrath <roland@redhat.com> wrote:

> Even in a case like i386, I wonder if the use as void * in memcpy for
> R_386_COPY relocs might be a possible source of trouble.

This is exactly how this whole thing started.  mips has to use memcpy
for all its relocations, but since both pointers might carry 32-bit or
64-bit alignment info, we might still get aligned loads and stores.

The patch below renames the reloc_addr argument to reloc_addr_arg,
while changing its type to void*, and re-introduces reloc_addr as a
variable of the original type in functions that still reference the
original type.  This is what the original patch did, except that the
argument is now named reloc_addr_arg, instead of just reloc_addr_.

The patch also renames uses of reloc_addr that seemed to indicate the
alignment assumptions compilers might be tempted to make are
unwarranted into uses of reloc_addr_arg, that (presumably) carries no
alignment information.  I hope I haven't missed any, and that I didn't
introduce any typos in the process.  It's extremely unlikely that
these changes could possibly introduce run-time errors, but there
could always be unwanted interactions with compilers, so...  Wish me
luck :-)

Ok to install?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dynamic-link-dont-assume-aligned-addr.patch
Type: text/x-patch
Size: 37479 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20030626/95aad012/attachment.bin>
-------------- next part --------------


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


More information about the Libc-alpha mailing list