Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Issue 10031027: Redirect fopen("/dev/urandom") so that NSS can properly seed it's RNG. (Closed)

Created:
8 years, 8 months ago by Sergey Ulanov
Modified:
8 years, 8 months ago
Reviewers:
wtc, brettw, agl, Ben Chan, Wez
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, Wez
Visibility:
Public.

Description

Redirect fopen("/dev/urandom") so that NSS can properly seed its RNG. BUG=122169 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=131808 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=132106

Patch Set 1 : #

Total comments: 6

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 12

Patch Set 6 : #

Total comments: 4

Patch Set 7 : #

Patch Set 8 : override stat() #

Total comments: 2

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Patch Set 14 : #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -2 lines) Patch
M content/browser/zygote_main_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +135 lines, -2 lines 3 comments Download

Messages

Total messages: 32 (0 generated)
Sergey Ulanov
8 years, 8 months ago (2012-04-10 01:54:30 UTC) #1
Ben Chan
On 2012/04/10 01:54:30, sergeyu wrote: I have a similar fix but use ld -wrap to ...
8 years, 8 months ago (2012-04-10 02:00:52 UTC) #2
Ben Chan
On 2012/04/10 02:00:52, Ben Chan wrote: > On 2012/04/10 01:54:30, sergeyu wrote: > > I ...
8 years, 8 months ago (2012-04-10 02:05:13 UTC) #3
Ben Chan
http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 content/browser/zygote_main_linux.cc:710: if (g_am_zygote_or_renderer && strcmp(path, "/dev/urandom") == 0) { static ...
8 years, 8 months ago (2012-04-10 02:17:15 UTC) #4
Ben Chan
On 2012/04/10 02:17:15, Ben Chan wrote: > http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc > File content/browser/zygote_main_linux.cc (right): > > http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 ...
8 years, 8 months ago (2012-04-10 02:30:26 UTC) #5
Sergey Ulanov
http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 content/browser/zygote_main_linux.cc:710: if (g_am_zygote_or_renderer && strcmp(path, "/dev/urandom") == 0) { On ...
8 years, 8 months ago (2012-04-10 03:02:53 UTC) #6
Ben Chan
http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 content/browser/zygote_main_linux.cc:710: if (g_am_zygote_or_renderer && strcmp(path, "/dev/urandom") == 0) { On ...
8 years, 8 months ago (2012-04-10 03:24:41 UTC) #7
Sergey Ulanov
On Mon, Apr 9, 2012 at 7:30 PM, <benchan@chromium.org> wrote: > On 2012/04/10 02:17:15, Ben ...
8 years, 8 months ago (2012-04-10 03:25:57 UTC) #8
Sergey Ulanov
http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 content/browser/zygote_main_linux.cc:710: if (g_am_zygote_or_renderer && strcmp(path, "/dev/urandom") == 0) { On ...
8 years, 8 months ago (2012-04-10 06:03:37 UTC) #9
agl
lgtm http://chromiumcodereview.appspot.com/10031027/diff/6007/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://chromiumcodereview.appspot.com/10031027/diff/6007/content/browser/zygote_main_linux.cc#newcode69 content/browser/zygote_main_linux.cc:69: static char kUrandomDevPath[] = "/dev/urandom"; const http://chromiumcodereview.appspot.com/10031027/diff/6007/content/browser/zygote_main_linux.cc#newcode700 content/browser/zygote_main_linux.cc:700: ...
8 years, 8 months ago (2012-04-10 15:18:13 UTC) #10
Ben Chan
On 2012/04/10 06:03:37, sergeyu wrote: > http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc > File content/browser/zygote_main_linux.cc (right): > > http://chromiumcodereview.appspot.com/10031027/diff/2001/content/browser/zygote_main_linux.cc#newcode710 > ...
8 years, 8 months ago (2012-04-10 15:39:43 UTC) #11
Sergey Ulanov
http://codereview.chromium.org/10031027/diff/6007/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/6007/content/browser/zygote_main_linux.cc#newcode69 content/browser/zygote_main_linux.cc:69: static char kUrandomDevPath[] = "/dev/urandom"; On 2012/04/10 15:18:13, agl ...
8 years, 8 months ago (2012-04-10 17:21:01 UTC) #12
Sergey Ulanov
+brettw for OWNERS rubber stamp
8 years, 8 months ago (2012-04-10 17:22:08 UTC) #13
Wez
http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc#newcode705 content/browser/zygote_main_linux.cc:705: LOG(ERROR) << "Failed to get fopen() from glibc."; nit: ...
8 years, 8 months ago (2012-04-10 17:34:13 UTC) #14
agl
http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc#newcode730 content/browser/zygote_main_linux.cc:730: return fdopen(fd, mode); On 2012/04/10 17:34:13, Wez wrote: > ...
8 years, 8 months ago (2012-04-10 17:46:02 UTC) #15
Sergey Ulanov
http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc#newcode705 content/browser/zygote_main_linux.cc:705: LOG(ERROR) << "Failed to get fopen() from glibc."; On ...
8 years, 8 months ago (2012-04-10 19:08:44 UTC) #16
Ben Chan
On 2012/04/10 19:08:44, sergeyu wrote: > http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc > File content/browser/zygote_main_linux.cc (right): > > http://codereview.chromium.org/10031027/diff/5008/content/browser/zygote_main_linux.cc#newcode705 > ...
8 years, 8 months ago (2012-04-10 22:26:40 UTC) #17
Ben Chan
On 2012/04/10 22:26:40, Ben Chan wrote: > On 2012/04/10 19:08:44, sergeyu wrote: > > > ...
8 years, 8 months ago (2012-04-10 23:42:10 UTC) #18
Sergey Ulanov
On Tue, Apr 10, 2012 at 4:42 PM, <benchan@chromium.org> wrote: > On 2012/04/10 22:26:40, Ben ...
8 years, 8 months ago (2012-04-11 00:12:11 UTC) #19
Sergey Ulanov
Ok, Please try the latest version now. It overrides stat() too. On 2012/04/10 23:42:10, Ben ...
8 years, 8 months ago (2012-04-11 01:31:34 UTC) #20
Ben Chan
I verified the latest patch on x86-generic and amd64-generic trybots. NSS was able to call ...
8 years, 8 months ago (2012-04-11 05:13:46 UTC) #21
Sergey Ulanov
http://chromiumcodereview.appspot.com/10031027/diff/14001/content/browser/zygote_main_linux.cc File content/browser/zygote_main_linux.cc (right): http://chromiumcodereview.appspot.com/10031027/diff/14001/content/browser/zygote_main_linux.cc#newcode781 content/browser/zygote_main_linux.cc:781: struct stat *buf) __asm__ ("__xstat"); On 2012/04/11 05:13:47, Ben ...
8 years, 8 months ago (2012-04-11 06:36:54 UTC) #22
Ben Chan
On 2012/04/11 06:36:54, sergeyu wrote: > http://chromiumcodereview.appspot.com/10031027/diff/14001/content/browser/zygote_main_linux.cc > File content/browser/zygote_main_linux.cc (right): > > http://chromiumcodereview.appspot.com/10031027/diff/14001/content/browser/zygote_main_linux.cc#newcode781 > ...
8 years, 8 months ago (2012-04-11 16:56:05 UTC) #23
Sergey Ulanov
yes On Wed, Apr 11, 2012 at 9:56 AM, <benchan@chromium.org> wrote: > On 2012/04/11 06:36:54, ...
8 years, 8 months ago (2012-04-11 17:19:03 UTC) #24
brettw
Owners rubberstamp LGTM
8 years, 8 months ago (2012-04-11 17:26:39 UTC) #25
agl
LGTM. I would recommend patching NSS so that it aborts if it fails to open ...
8 years, 8 months ago (2012-04-11 17:32:26 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sergeyu@chromium.org/10031027/20002
8 years, 8 months ago (2012-04-11 17:39:59 UTC) #27
Ben Chan
On 2012/04/11 17:32:26, agl wrote: > LGTM. I would recommend patching NSS so that it ...
8 years, 8 months ago (2012-04-11 17:40:42 UTC) #28
Sergey Ulanov
8 years, 8 months ago (2012-04-11 18:52:15 UTC) #29
Sergey Ulanov
Reverted because it was causing content_unittests fail on ASAN bots: http://build.chromium.org/p/chromium.memory/builders/ASAN%20Tests%20%281%29/builds/8653/steps/content_unittests
8 years, 8 months ago (2012-04-11 19:35:25 UTC) #30
Sergey Ulanov
Uploaded new version of the patch that fixes problem with ASAN builds.
8 years, 8 months ago (2012-04-12 17:30:08 UTC) #31
wtc
8 years, 8 months ago (2012-04-17 22:02:47 UTC) #32
http://chromiumcodereview.appspot.com/10031027/diff/24005/content/browser/zyg...
File content/browser/zygote_main_linux.cc (right):

http://chromiumcodereview.appspot.com/10031027/diff/24005/content/browser/zyg...
content/browser/zygote_main_linux.cc:740: // remoting in the sendbox.

Typo: sendbox => sandbox

http://chromiumcodereview.appspot.com/10031027/diff/24005/content/browser/zyg...
content/browser/zygote_main_linux.cc:745: // the code below defines
fopen_override() function with asm name

Typo: remove "the"

I suggest you just move "the" to the front of "fopen_override() function".

http://chromiumcodereview.appspot.com/10031027/diff/24005/content/browser/zyg...
content/browser/zygote_main_linux.cc:784: // the same trick to override it.

You should explain why you need to intercept stat().

Which functions we need to intercept depends on what functions
NSS calls on "/dev/urandom".  So this CL may be broken
by a future change to the NSS code in its unix_rand.c
file.

I agree with agl that we should also patch NSS to fail (or
even call abort()) if it cannot use /dev/urandom on
platforms that are known to have /dev/urandom:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/security/nss/lib/freebl/u...

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/security/nss/lib/freebl/u...

Powered by Google App Engine
This is Rietveld 408576698