1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/libc
Jonas 'Sortie' Termansen 84c0844f56 Seed kernel entropy with randomness from the previous boot.
The bootloader will now load the /boot/random.seed file if it exists, in
which case the kernel will use it as the initial kernel entropy. The kernel
warns if no random seed was loaded, unless the --no-random-seed option was
given. This option is used for live environments that inherently have no
prior secret state. The kernel initializes its entropy pool from the random
seed as of the first things, so randomness is available very early on.

init(8) will emit a fresh /boot/random.seed file on boot to avoid the same
entropy being used twice. init(8) also writes out /boot/random.seed on
system shutdown where the system has the most entropy. init(8) will warn if
writing the file fails, except if /boot is a real-only filesystem, and
keeping such state is impossible. The system administrator is then
responsible for ensuring the bootloader somehow passes a fresh random seed
on the next boot.

/boot/random.seed must be owned by the root user and root group and must
have file permissions 600 to avoid unprivileged users can read it. The file
is passed to the kernel by the bootloader as a multiboot module with the
command line --random-seed.

If no random seed is loaded, the kernel attempts a poor quality fallback
where it seeds the kernel arc4random(3) continuously with the current time.
The timing variance may provide some effective entropy. There is no real
kernel entropy gathering yet. The read of the CMOS real time clock is moved
to an early point in the kernel boot, so the current time is available as
fallback entropy.

The kernel access of the random seed module is supposed to be infallible
and happens before the kernel log is set up, but there is not yet a failsafe
API for mapping single pages in the early kernel.

sysupgrade(8) creates /boot/random.seed if it's absent as a temporary
compatibility measure for people upgrading from the 1.0 release. The GRUB
port will need to be upgraded with support for /boot/random.seed in the
10_sortix script. Installation with manual bootloader configuration will
need to load the random seed with the --random-seed command line. With GRUB,
this can be done with: module /boot/random.seed --random-seed
2016-10-04 00:34:50 +02:00
..
arpa/inet Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
assert Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
blf Convert libc to C. 2016-03-03 23:02:23 +01:00
c++ Compile libc with -ffreestanding. 2016-05-15 22:43:29 +02:00
ctype Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
dirent Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
dlfcn Make the branding system more neutral. 2016-05-15 22:43:29 +02:00
err Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
errno Clean up errno. 2016-05-15 22:43:29 +02:00
error Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fcntl Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fnmatch Fix shift out of bounds in fnmatch(3). 2016-05-15 19:30:51 +02:00
fsmarshall Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fstab Fix getline(3) and getdelim(3) usage. 2016-05-15 19:32:04 +02:00
getopt Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
grp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
include Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
init Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
inttypes Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
ioleast Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
langinfo Add nl_langinfo(3). 2016-10-03 20:02:12 +02:00
libgen Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
locale Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
malloc Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
msr Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
netdb Fix use after free in getaddrinfo(3) error case. 2016-08-21 00:04:27 +02:00
netinet/in Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
poll Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
psctl Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
pthread Fix pthread stack alignment. 2016-05-15 19:30:51 +02:00
pwd Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
regex Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
sched Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
scram Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
semaphore Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
signal Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
ssp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
stdio Fix execl(3) sentinel undefined behaviour. 2016-09-30 23:36:49 +02:00
stdio_ext Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
stdlib Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
string Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
sys Remove uname -i and -o options. 2016-05-15 22:43:29 +02:00
syslog Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
termios Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
time Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
timespec Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
ubsan Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
unistd Remove getdomainname(2). 2016-05-15 22:43:29 +02:00
utime Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
wchar Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
wctype Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
x64 Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
x86 Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
.gitignore Rename libmaxsi to sortix libc. 2012-12-14 14:13:36 +01:00
Makefile Add nl_langinfo(3). 2016-10-03 20:02:12 +02:00