minix/minix/commands
David van Moolenbroek e4d99eb9b0 Basic live rerandomization infrastructure
This commits adds a basic infrastructure to support Address Space
Randomization (ASR).  In a nutshell, using the already imported ASR
LLVM pass, multiple versions can be generated for the same system
service, each with a randomized, different address space layout.
Combined with the magic instrumentation for state transfer, a system
service can be live updated into another ASR-randomized version at
runtime, thus providing live rerandomization.

Since MINIX3 is not yet capable of running LLVM linker passes, the
ASR-randomized service binaries have to be pregenerated during
crosscompilation.  These pregenerated binaries can then be cycled
through at runtime.  This patch provides the basic proof-of-concept
infrastructure for both these parts.

In order to support pregeneration, the clientctl host script has
been extended with a "buildasr" command.  It is to be used after
building the entire system with bitcode and magic support, and will
produce a given number of ASR-randomized versions of all system
services.  These services are placed in /usr/service/asr in the
image that is generated as final step by the "buildasr" command.

In order to support runtime updating, a new update_asr(8) command
has been added to MINIX3.  This command attempts to live-update the
running system services into their next ASR-randomized versions.
For now, this command is not run automatically, and thus must be
invoked manually.

Technical notes:

- For various reasons, magic instrumentation is x86-only for now,
  and ASR functionality is therefore to be used on x86 only as well.
- The ASR-randomized binaries are placed in numbered subdirectories
  so as not to have to change their actual program names, which are
  assumed to be static in various places (system.conf, procfs).
- The root partition is typically too small to contain all the
  produced binaries, which is why we introduce /usr/service.  There
  is a symlink from /service/asr to /usr/service/asr for no other
  reason than to let userland continue to assume that all services
  are reachable through /service.
- The ASR count field (r_asr_count/ASRcount) maintained by RS is not
  used within RS in any way; it is only passed through procfs to
  userland in order to allow update_asr(8) to keep track of which
  version is currently loaded without having to maintain own state.
- Ideally, pre-instrumentation linking of a service would remove all
  its randomized versions.  Currently, the user is assumed not to
  perform ASR instrumentation and then recompile system services
  without performing ASR instrumentation again, as the randomized
  binaries included in the image would then be stale.  This aspect
  has to be improved later.
- Various other issues are flagged in the comments of the various
  parts of this patch.

Change-Id: I093ad57f31c18305591f64b2d491272288aa0937
2015-09-17 17:15:03 +00:00
..
add_route remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
arp remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
at New sources layout 2014-07-31 16:00:30 +02:00
atnormalize Import a few manpages 2014-11-25 11:04:20 +01:00
autopart commands/autopart: Fix dead code block 2015-03-13 18:53:05 +01:00
backup New sources layout 2014-07-31 16:00:30 +02:00
btrace New sources layout 2014-07-31 16:00:30 +02:00
cawf cawf: Update K&R function declarations 2015-05-18 15:20:39 +02:00
cdprobe New sources layout 2014-07-31 16:00:30 +02:00
ci New sources layout 2014-07-31 16:00:30 +02:00
cleantmp New sources layout 2014-07-31 16:00:30 +02:00
cmp New sources layout 2014-07-31 16:00:30 +02:00
co New sources layout 2014-07-31 16:00:30 +02:00
compress New sources layout 2014-07-31 16:00:30 +02:00
crc New sources layout 2014-07-31 16:00:30 +02:00
cron New sources layout 2014-07-31 16:00:30 +02:00
crontab New sources layout 2014-07-31 16:00:30 +02:00
decomp16 Import a few manpages 2014-11-25 11:04:20 +01:00
DESCRIBE Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
devmand devmand: properly prevent overflow 2015-04-15 08:28:59 +02:00
devsize Import a few manpages 2014-11-25 11:04:20 +01:00
dhcpd dhcpd: don't crash so easily 2014-11-17 20:17:43 +00:00
dhrystone New sources layout 2014-07-31 16:00:30 +02:00
diff New sources layout 2014-07-31 16:00:30 +02:00
diskctl New sources layout 2014-07-31 16:00:30 +02:00
dosread New sources layout 2014-07-31 16:00:30 +02:00
eject New sources layout 2014-07-31 16:00:30 +02:00
fbdctl New sources layout 2014-07-31 16:00:30 +02:00
fdisk New sources layout 2014-07-31 16:00:30 +02:00
fetch New sources layout 2014-07-31 16:00:30 +02:00
find New sources layout 2014-07-31 16:00:30 +02:00
fix commands/fix: create manpage for fix(8) 2015-03-24 08:21:14 +01:00
format New sources layout 2014-07-31 16:00:30 +02:00
fsck.mfs MFS: use libfsdriver 2014-09-18 12:46:27 +00:00
gcov-pull New sources layout 2014-07-31 16:00:30 +02:00
host New sources layout 2014-07-31 16:00:30 +02:00
hostaddr remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
ifconfig New sources layout 2014-07-31 16:00:30 +02:00
ifdef New sources layout 2014-07-31 16:00:30 +02:00
intr New sources layout 2014-07-31 16:00:30 +02:00
ipcrm New sources layout 2014-07-31 16:00:30 +02:00
ipcs New sources layout 2014-07-31 16:00:30 +02:00
irdpd remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
isoread Close #83 with fix suggested 2015-07-28 09:58:12 +00:00
loadfont New sources layout 2014-07-31 16:00:30 +02:00
loadkeys New sources layout 2014-07-31 16:00:30 +02:00
loadramdisk New sources layout 2014-07-31 16:00:30 +02:00
logger New sources layout 2014-07-31 16:00:30 +02:00
look New sources layout 2014-07-31 16:00:30 +02:00
lp New sources layout 2014-07-31 16:00:30 +02:00
lpd New sources layout 2014-07-31 16:00:30 +02:00
lspci New sources layout 2014-07-31 16:00:30 +02:00
mail New sources layout 2014-07-31 16:00:30 +02:00
MAKEDEV Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
mount New sources layout 2014-07-31 16:00:30 +02:00
mt New sources layout 2014-07-31 16:00:30 +02:00
netconf dp8390: update, allow default port and IRQ 2014-12-04 12:10:46 +00:00
nonamed remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
part New sources layout 2014-07-31 16:00:30 +02:00
partition New sources layout 2014-07-31 16:00:30 +02:00
pkgin_all New sources layout 2014-07-31 16:00:30 +02:00
pkgin_cd New sources layout 2014-07-31 16:00:30 +02:00
pkgin_sets pkgin_sets: Fix python package name 2014-09-12 11:10:30 +02:00
playwave New sources layout 2014-07-31 16:00:30 +02:00
postinstall New sources layout 2014-07-31 16:00:30 +02:00
pr_routes remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
prep New sources layout 2014-07-31 16:00:30 +02:00
printroot New sources layout 2014-07-31 16:00:30 +02:00
profile Remove support for call profiling 2014-09-30 12:39:03 +00:00
progressbar New sources layout 2014-07-31 16:00:30 +02:00
ps ps: fix reported run time 2014-08-24 09:22:36 +00:00
pwdauth New sources layout 2014-07-31 16:00:30 +02:00
ramdisk New sources layout 2014-07-31 16:00:30 +02:00
rarpd remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
rawspeed Import a few manpages 2014-11-25 11:04:20 +01:00
rcp remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
readclock New sources layout 2014-07-31 16:00:30 +02:00
recwave Get rid of K&R functions in recwave 2015-03-18 08:21:31 +01:00
remsync New sources layout 2014-07-31 16:00:30 +02:00
repartition New sources layout 2014-07-31 16:00:30 +02:00
rget remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
rlogin remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
rotate Make rotate manpage more detailed 2015-03-23 11:06:37 +01:00
rsh remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
rshd remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
screendump New sources layout 2014-07-31 16:00:30 +02:00
service Basic live rerandomization infrastructure 2015-09-17 17:15:03 +00:00
setup Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
slip New sources layout 2014-07-31 16:00:30 +02:00
spell New sources layout 2014-07-31 16:00:30 +02:00
sprofalyze sprofalyze: Fix minor typo 2015-05-18 13:54:19 +02:00
sprofdiff Add manpage for sprofdiff 2015-05-18 13:52:13 +02:00
srccrc New sources layout 2014-07-31 16:00:30 +02:00
svclog New sources layout 2014-07-31 16:00:30 +02:00
svrctl svrctl(2) update 2014-09-29 16:15:21 +00:00
swifi swifi: Fix incorrect memset 2015-03-23 14:56:59 +01:00
synctree New sources layout 2014-07-31 16:00:30 +02:00
sysenv New sources layout 2014-07-31 16:00:30 +02:00
tcpd remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
tcpdp remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
tcpstat svrctl(2) update 2014-09-29 16:15:21 +00:00
telnet remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
telnetd remove libcompat_minix as library 2014-08-28 18:49:13 +02:00
term New sources layout 2014-07-31 16:00:30 +02:00
termcap New sources layout 2014-07-31 16:00:30 +02:00
tget New sources layout 2014-07-31 16:00:30 +02:00
time New sources layout 2014-07-31 16:00:30 +02:00
truncate New sources layout 2014-07-31 16:00:30 +02:00
udpstat svrctl(2) update 2014-09-29 16:15:21 +00:00
umount New sources layout 2014-07-31 16:00:30 +02:00
update New sources layout 2014-07-31 16:00:30 +02:00
update_asr Basic live rerandomization infrastructure 2015-09-17 17:15:03 +00:00
update_bootcfg update_bootcfg(8): Add actually useful information 2015-07-28 10:03:50 +00:00
updateboot Import a few manpages 2014-11-25 11:04:20 +01:00
version New sources layout 2014-07-31 16:00:30 +02:00
vol New sources layout 2014-07-31 16:00:30 +02:00
worldstone New sources layout 2014-07-31 16:00:30 +02:00
writeisofs writeisofs: set file struct version field to one 2014-09-18 12:46:29 +00:00
zdump New sources layout 2014-07-31 16:00:30 +02:00
zmodem New sources layout 2014-07-31 16:00:30 +02:00
Makefile Basic live rerandomization infrastructure 2015-09-17 17:15:03 +00:00
Makefile.inc merge libminlib with libc 2014-08-28 18:49:19 +02:00