DragonFly BSD
DragonFly bugs List (threaded) for 2010-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [issue1924] mmap - add mmap offset randomisation


From: Robin Carey <robin.carey1@xxxxxxxxxxxxxx>
Date: Thu, 25 Nov 2010 17:33:29 +0000

Dear Alex and bugs,
 
I just checked the source tree, and karc4random() does not use read_random_unlimited().
 
Well, it does not use it directly ... I see a call to it elsewhere in:
 
/sys/libkern/arc4random.c
 
I sent a post into bugs@dragonflybsd.org a while back and I think it was Matthew Dillon who replied
stating that there are numerous references to e.g. karc4random() strewn about all over the source tree,
and it would be a good idea to update those references to use the superior CSPRNG in:
 
/sys/kern/kern_nrandom.c
 
But it seems nobody has bothered to do that.
 
I'm just sending this bug report in, because the mmap randomisation is a new commit, i.e. it is new
code, and since it is new code it should be using the best CSPRNG available and not the old references
to karc4random().
 
Here is the relevant source snippet:
 
u_int32_t
116 karc4random(void)
117 {
118         u_int32_t ret;
119         struct timeval tv_now;
121         /* Initialize array if needed. */
122         if (!arc4_initialized)
123                 arc4_init();
125         getmicrotime(&tv_now);
126         if ((++arc4_numruns > ARC4_MAXRUNS) || 
127             (tv_now.tv_sec > arc4_tv_nextreseed.tv_sec))
128         {
129                 arc4_randomstir();
130         }
132         ret = arc4_randbyte();
133         ret |= arc4_randbyte() << 8;
134         ret |= arc4_randbyte() << 16;
135         ret |= arc4_randbyte() << 24;
137         return ret;
138 }


On 25 November 2010 16:32, Alex Hornung (via DragonFly issue tracker) <bugs@crater.dragonflybsd.org> wrote:

Alex Hornung <ahornung@gmail.com> added the comment:

After a short check it uses exactly the same interface to get the 'randomness'
(entropy?), read_random_unlimited().

So what exactly do you mean? And why is karc4random no good?

Cheers,
Alex

_____________________________________________________
DragonFly issue tracker <bugs@lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1924>
_____________________________________________________



--
Sincerely,
Robin Carey


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]