This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] ld: Add random filling for unspecified section contents


Hi Andrew,

> I'd like to propose the following feature, the ability for the linker
> to randomise the fill data within a section (right now we can only
> provide a fixed fill pattern).
> 
> One use case for such a feature would be to pad out a data section
> while making it slightly harder for someone else examining the object
> file to determine which parts of the section are actual content, and
> which parts are padding.

I have to say that I do not think there will be much real gain from this 
feature.  Surely an attacker can examine the symbol table to determine
the last addressed point in a padded data section and use that as a guide
to what is real data and what is padding.

But anyway...

> At the moment I'm using jrand48, this isn't thread-safe, but does take
> it's seed as an argument for each call.

What about using jrand48_r instead ?

> The problem is that I'm pretty sure this function is not available on
> every platform we target, and I'm not sure what the right thing to use
> instead is.

Write a configure check for the function and only use it if available ?

> I'm wondering if the right thing to do is to add a reentrant random
> number API to libiberty and use that.  However, I'm open to any
> suggestions for what the right thing to do might be.

How about using random(), setstate() and initstate() - all provided by 
libiberty ?   That should provide wider availability, although not thread
safety.

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]