1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/kernel
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
..
disk Fix drivers not detecting PCI devices without an interrupt line. 2016-08-21 00:03:58 +02:00
fs Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
gpu/bga Add 24-bit graphics support to kernel. 2016-09-28 20:29:18 +02:00
include/sortix Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
kb Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
mouse Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
net Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
x64 Fix undefined stack register after switch into long mode. 2016-07-29 15:20:05 +02:00
x86 Clean up errno. 2016-05-15 22:43:29 +02:00
x86-family Add assertions to Signal::DispatchHandler callers. 2016-03-28 17:37:37 +02:00
.gitignore Allow bootloader bitmap framebuffer modesetting. 2016-01-08 19:56:11 +01:00
addralloc.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
alarm.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
clock.cpp Fix linked list and shadowing bugs in kernel clock and timer code. 2016-08-21 00:04:27 +02:00
com.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
com.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
copy.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
descriptor.cpp Fix non-blocking recv(2) and send(2). 2016-08-22 01:47:31 +02:00
dtable.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
elf.cpp Fix missing validation of program entry points. 2016-07-29 15:20:04 +02:00
end.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fcache.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
fsfunc.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
hostname.cpp Fix kernel not using BRAND_DEFAULT_HOSTNAME. 2016-09-28 20:15:36 +02:00
identity.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
initrd.cpp Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
initrd.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
inode.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
interlock.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
interrupt.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
io.cpp Fix readlinkat(2) return value truncation. 2016-09-28 20:15:36 +02:00
ioctx.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
kernel.cpp Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
kernelinfo.cpp Add tagline. 2016-03-26 23:50:50 +01:00
kthread.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
lfbtextbuffer.cpp Add 24-bit graphics support to kernel. 2016-09-28 20:29:18 +02:00
lfbtextbuffer.h Add 24-bit graphics support to kernel. 2016-09-28 20:29:18 +02:00
libk.cpp Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
linebuffer.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
linebuffer.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
log.cpp Add 24-bit graphics support to kernel. 2016-09-28 20:29:18 +02:00
logterminal.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
logterminal.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
Makefile Modernize carray(1) and fix missing allocation checks. 2016-09-29 00:01:41 +02:00
memorymanagement.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
mtable.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
multiboot.h Upgrade to latest upstream multiboot header. 2014-12-01 22:51:07 +01:00
op-new.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
panic.cpp Make the branding system more neutral. 2016-05-15 22:43:29 +02:00
partition.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
partition.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
pci-mmio.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
pci.cpp Fix drivers not detecting PCI devices without an interrupt line. 2016-08-21 00:03:58 +02:00
pipe.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
poll.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
process.cpp Add protection against sigreturn oriented programming (SROP). 2016-05-15 22:43:29 +02:00
psctl.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
ptable.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
random.cpp Seed kernel entropy with randomness from the previous boot. 2016-10-04 00:34:50 +02:00
refcount.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
registers.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
resource.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
scheduler.cpp Add assertions to Signal::DispatchHandler callers. 2016-03-28 17:37:37 +02:00
segment.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
signal.cpp Add protection against sigreturn oriented programming (SROP). 2016-05-15 22:43:29 +02:00
sockopt.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
string.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
syscall.cpp Fix fchownat(2) system call ABI on x86. 2016-03-26 23:28:36 +01:00
textbuffer.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
textterminal.cpp Fix console scrolling bottleneck. 2016-09-25 22:28:17 +02:00
textterminal.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
thread.cpp Add protection against sigreturn oriented programming (SROP). 2016-05-15 22:43:29 +02:00
time.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
timer.cpp Fix linked list and shadowing bugs in kernel clock and timer code. 2016-08-21 00:04:27 +02:00
uart.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
uart.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
user-timer.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vga.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vga.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vgafont.f16 Allow bootloader bitmap framebuffer modesetting. 2016-01-08 19:56:11 +01:00
vgatextbuffer.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
vgatextbuffer.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
video.cpp Allow detecting fallback video modes. 2016-10-03 21:38:34 +02:00
vnode.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
worker.cpp Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00