Project

General

Profile

This project is closed and read-only.

Actions

Bug #4338

closed

random number generator not reseeded after fork in 1.8

Bug #4338: random number generator not reseeded after fork in 1.8

Added by normalperson (Eric Wong) over 15 years ago. Updated over 15 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]
[ruby-core:34944]

Description

=begin
rand should return different values in forked processes like in 1.9.2. This
may have security implications for some programs.

Remembering to call srand after forking will fix the issue, but remembering is
hard especially since 1.9.2 makes it easy :)

The following example prints out 3 identical lines in 1.8.7:

fork { $stdout.syswrite("#{rand}\n") }
fork { $stdout.syswrite("#{rand}\n") }
$stdout.syswrite("#{rand}\n")
Process.waitall
=end

Updated by normalperson (Eric Wong) over 15 years ago Actions #1

=begin
Eric Wong wrote:

Bug #4338: random number generator not reseeded after fork in 1.8
http://redmine.ruby-lang.org/issues/show/4338

Author: Eric Wong
Status: Open, Priority: Normal
Category: core, Target version: Ruby 1.8.7
ruby -v: ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]

I should also add that this was not an issue in Ruby 1.8.6-p114, but
it is in 1.8.6-p399. So a regression slipped in somewhere along the
way.

--
Eric Wong
=end

Updated by normalperson (Eric Wong) over 15 years ago Actions #2

=begin
Eric Wong wrote:

Bug #4338: random number generator not reseeded after fork in 1.8
http://redmine.ruby-lang.org/issues/show/4338

Author: Eric Wong
Status: Open, Priority: Normal
Category: core, Target version: Ruby 1.8.7
ruby -v: ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]

I should also add that this was not an issue in Ruby 1.8.6-p114, but
it is in 1.8.6-p399. So a regression slipped in somewhere along the
way.

--
Eric Wong

=end

Updated by normalperson (Eric Wong) over 15 years ago Actions #3 [ruby-core:35762]

=begin
Hello? Can somebody please look into this? Thanks.
=end

Updated by shyouhei (Shyouhei Urabe) over 15 years ago Actions #4 [ruby-core:35764]

  • Status changed from Open to Assigned
  • Assignee set to shyouhei (Shyouhei Urabe)

=begin
OK, now I consider this is a bug. To be fixed on the next patchlevel. Stay tuned.
=end

Updated by shyouhei (Shyouhei Urabe) over 15 years ago Actions #5 [ruby-core:36450]

  • Status changed from Assigned to Closed

I think I have fixed this.

Actions

Also available in: PDF Atom