Commit eaf63d31 authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Better initialization of random generator

Use full time precision to initialize random generator. The old
code was prone to initialize it to the same values in specific
circumstances (boot without RTC, multiple VMs starting at once).
parent 70fab178
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2144,7 +2144,9 @@ io_init(void)
  // XXX init_times();
  // XXX update_times();
  boot_time = current_time();
  srandom((uint) (current_real_time() TO_S));

  u64 now = (u64) current_real_time();
  srandom((uint) (now ^ (now >> 32)));
}

static int short_loops = 0;