Project

General

Profile

Actions

Bug #5806

closed

uuid_generate can leak its cache in edge conditions

Added by Robert Mustacchi over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
2015-04-08
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

uuid_generate_random has a cache for /dev/urandom. This cache is cleared across threads by the use of an atfork handler. Unfortunately, atfork handlers may not fire in two different situations:

  • When fork is called from a signal handler
  • When forkall() as opposed to fork1() is called

These situations, while extremely rare, can lead to problems with the validity of the UUIDs generated. As such, we instead replace the entire cache with uses of calls to the arc4random family of functions. In addition to simplifying the code and fixing the bug noted, we also get a reasonable speed up while still using a similar high-quality random number generator.

Actions #1

Updated by Electric Monk over 6 years ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit 9d12795f87b63c2e39e87bff369182edd34677d3

commit  9d12795f87b63c2e39e87bff369182edd34677d3
Author: Robert Mustacchi <rm@joyent.com>
Date:   2015-04-12T23:04:38.000Z

    5830 want arc4random(3C) suite
    5802 want getentropy(3C)
    5803 want getrandom(2)
    5804 want explicit_bzero(3C)
    5805 want MC_INHERIT_ZERO
    5806 uuid_generate can leak its cache in edge conditions
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
    Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Garrett D'Amore <garrett@damore.org>

Actions

Also available in: Atom PDF