Subject: Re: RelCache (aka ELF prebinding) news
To: None <tls@rek.tjls.com>
From: Havard Eidnes <he@netbsd.org>
List: tech-userlevel
Date: 12/01/2002 21:09:24
> > I don't think the computation of the checksum is done on program load by
> > ld.elf_so, but rather only when setting up a program for prebinding.  I
> > understood that the checksums are saved in the new special sections in
> > the executable and libraries when the prebinding is set up.  I may have
> > misunderstood, though.
>
> How can you know whether the checksum matches or not if you don't compute
> it again?

To quote Bang Jun-Young:

> The next time the same binary is executed, ld.elf_so checks if there are
> modifications in objects by comparing md5 checksum, starting address, etc.,
> and if not, it reads a RelCache file and mmaps (overlays) it on the 
> appropriate memory region.

I.e. if the executable doesn't have the md5 checksum set in the md5
section (newly installed, not yet prebound), the executable has been
modified since it was prebound (again, newly installed), and probably
others ("etc." above), it does not match.

I'm sure it's entirely possible to intentionally shoot yourself in the
foot with this mechanism, but you'd have to go to some length to do
so, and why would you want to? ;-)

I'll admit that I'm just guessing here, though; I've not even read the
code.

Regards,

- Håvard