cs-education / sysbuild

A system programming learning environment in the browser
https://cs-education.github.io/sys/
Other
36 stars 35 forks source link

VM lacks entropy #160

Open coltonmercurio opened 8 years ago

coltonmercurio commented 8 years ago

Internally, gcc reads bits from /dev/urandom. So on the first compile, a user would see: image

FYI The kernel message is generated whenever the first read from urandom occurs -

http://lxr.free-electrons.com/source/drivers/char/random.c#L1458 1458 urandom_read(struct file _file, char __user buf, size_t nbytes, loff_t ppos) 1459 { 1460 int ret; 1461 1462 if (unlikely(nonblocking_pool.initialized == 0)) 1463 printkonce(KERN_NOTICE "random: %s urandom read " 1464 "with %d bits of entropy available\n", 1465 current->comm, nonblocking_pool.entropy_total); 1466 1467 nbytes = min_t(size_t, nbytes, INT_MAX >> (ENTROPY_SHIFT + 3)); 1468 ret = extract_entropy_user(&nonblocking_pool, buf, nbytes); 1469 1470 trace_urandom_read(8 \ nbytes, ENTROPY_BITS(&nonblocking_pool), 1471 ENTROPY_BITS(&input_pool)); 1472 return ret; 1473 }

Suggestion for an upstream future a Jor1K Feature: Provide an interface to be able to add entropy from the outside i.e. the browser @angrave PR https://github.com/cs-education/sysbuild/pull/152