minix/releasetools
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
..
release/cd Rename tools to releasetools 2012-06-18 10:53:37 +00:00
Makefile releasetools/Makefile: updates 2014-08-21 10:59:26 +02:00
arm_sdimage.sh Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
fetch_u-boot.sh Allow u-boot repository URL to be overridden 2015-02-05 14:04:31 +01:00
gen_uEnv.txt.sh Fix OS X crossbuilds for arm 2014-10-10 12:56:41 +02:00
issue.install Rename tools to releasetools 2012-06-18 10:53:37 +00:00
mkboot Remove some legacy support in rc scripts & some cleanup 2014-03-01 09:05:01 +01:00
packages.install set reasonable packages list 2014-09-13 22:23:43 +02:00
release.functions set reasonable packages list 2014-09-13 22:23:43 +02:00
release.sh release.sh: Support preinstalled package selection 2015-03-20 11:17:24 +01:00
sort_set.sh build:add script to sort netbsd sets and sort minix/mi. 2013-04-21 21:35:49 +02:00
x86_hdimage.sh Basic live rerandomization infrastructure 2015-09-17 17:15:03 +00:00