Subject: Re: RelCache (aka ELF prebinding) news
To: None <tech-kern@netbsd.org, tech-userlevel@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 12/03/2002 13:31:43
On Tue, Dec 03, 2002 at 10:19:06AM -0800, Jason R Thorpe wrote:
> On Tue, Dec 03, 2002 at 12:14:19PM -0500, Thor Lancelot Simon wrote:
> 
>  > You should use the length and the filename, no matter what.  I'd call
>  > that "metadata", but maybe you wouldn't. :-)  You don't need to include
>  > them in the checksum, just use them as separate data to match the cache
>  > entry against.  That is basically without cost and makes a collision
>  > even less likely, as collisions against data of different lengths are
>  > excluded.  And you can still move the file around and not rebind so
>  > long as you move it back.
> 
> Actually, checksumming a library feels ... Wrong to me.
> 
> I mean, you're going to have to read in the entire shlib, polluting
> the page cache with data you might not even use.

This is only done as part of the prebinding step.  The checksum is used
only to compute a hopefully-unique serial number for the library that
actually depends on the library's contents.

I do agree that libraries do not move around much and that using the
metadata to validate (or invalidate -- if they mismatch, you clearly want
to shoot down the old entry) cache entries is a good idea.

Thor