Subject: Re: RelCache (aka ELF prebinding) news
To: Thor Lancelot Simon <tls@rek.tjls.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-userlevel
Date: 12/02/2002 11:54:20
On Sun, Dec 01, 2002 at 03:23:51PM -0500, Thor Lancelot Simon wrote:
> On Sun, Dec 01, 2002 at 09:09:24PM +0100, Havard Eidnes wrote:
> > > > 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.

Right.

> 
> In that case, what is the point of using an MD5 checksum?  A random number
> of the same length would serve equally well.

Since MD5 checksum is known to have very good distribution (i.e. a lot less
hash collision), it's the safest method to check for validity of the file.

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>