]> Zhao Yanbai Git Server - minix.git/log
minix.git
9 years agoVM: align frame buffer 71/3171/1
David van Moolenbroek [Fri, 4 Sep 2015 01:19:59 +0000 (03:19 +0200)]
VM: align frame buffer

Lack of alignment causes minix_stack_fill to produce an incorrect
frame layout, subsequently resulting in a crash of the started
process.  For now, we assume that the other callers of
minix_stack_fill do get an aligned buffer through sbrk(3), but this
may have to be changed later as well.

Change-Id: I1575bd62b050749d1a1aae7417310c91713462c3

9 years agoVM/VFS: align ELF header buffer 70/3170/1
David van Moolenbroek [Thu, 3 Sep 2015 10:09:54 +0000 (12:09 +0200)]
VM/VFS: align ELF header buffer

The libexec ELF parser expects to be given a word-aligned buffer,
but the ASR pass may cause VM and VFS to pass it an arbitrarily
aligned buffer, causing libexec to refuse loading the executable.
This patch aligns the buffers explicitly.

Change-Id: Ic2d5fd3a8f204c3e4f000cffdb7ac71c8339257a

9 years agoASR pass: disable caller padding by default 69/3169/1
David van Moolenbroek [Thu, 3 Sep 2015 04:17:52 +0000 (06:17 +0200)]
ASR pass: disable caller padding by default

The feature is fundamentally broken.  See the comment in the code.

Change-Id: If36b06b0732cc4d18f20240ed96d30a7959b0d21

9 years agoImport ASR pass from llvm-apps 68/3168/1
David van Moolenbroek [Tue, 11 Aug 2015 20:17:23 +0000 (22:17 +0200)]
Import ASR pass from llvm-apps

Change-Id: I106c5faf8d8f1af5d3f5542fe666532895413909

9 years agolibmagic: fail on all state transfer errors 67/3167/1
David van Moolenbroek [Wed, 2 Sep 2015 22:40:39 +0000 (00:40 +0200)]
libmagic: fail on all state transfer errors

Also do not report debugging information by default.

Change-Id: I5d80a3df3c3ecc16a577d88abe6e37a792add747

9 years agolibblockdriver: suspend threads for live update 66/3166/1
David van Moolenbroek [Tue, 25 Aug 2015 06:36:39 +0000 (08:36 +0200)]
libblockdriver: suspend threads for live update

Same as for VFS.

Change-Id: I0f09d43f24c32361af5e5658923140c79244d3d1

9 years agoVFS: suspend threads for live update 65/3165/1
David van Moolenbroek [Mon, 24 Aug 2015 20:44:26 +0000 (22:44 +0200)]
VFS: suspend threads for live update

- do not allow live update for request and protocol free states if
  there are any worker threads that have pending or active work;
- destroy all worker threads before such live updates and recreate
  them afterwards, because transferring (the contents of) the
  thread stacks is not an option at this time;
- recreate worker threads in the new instance only if they were
  shut down before the state transfer, by letting RS provide the
  original preparation state as initialization information.

Change-Id: I846225f5b7281f19e69175485f2c88a4b4891dc2

9 years agoAnnotations and tweaks for live update 64/3164/1
David van Moolenbroek [Mon, 10 Aug 2015 16:06:10 +0000 (18:06 +0200)]
Annotations and tweaks for live update

This change is necessary for instrumentation-aided state transfer.

Change-Id: I24be938009f02e302a15083f9a7a11824975e42b

9 years agoDS: workaround for weak symbol issue 63/3163/1
David van Moolenbroek [Mon, 24 Aug 2015 13:59:23 +0000 (15:59 +0200)]
DS: workaround for weak symbol issue

The bitcode file given to the instrumentation pass does not include
certain weak symbols, in particular regcomp and regfree, which are
required to be visible to the magic pass for state transfer to work
correctly.  This patch forces DS to make the calls using their actual
symbol names (with leading underscore), thus resolving the issue, but
this issue should really be solved in a cleaner and more generic way.

Change-Id: Iebee4341cc30ddabcf7593afb5c49d41c0839863

9 years agomagic pass: register additional compatible types 62/3162/1
David van Moolenbroek [Mon, 24 Aug 2015 06:22:02 +0000 (08:22 +0200)]
magic pass: register additional compatible types

This patch is a first step towards working around the larger problem of
LLVM 3.x's use of bitcasting between structures and their elements to
deal with opaque types, replacing LLVM 2.x's actual unification.  The
patch allows the pass to register a larger number of compatible types,
in particular for structure pointers passed through function calls.
A skeleton is provided for dealing with structure elements as well, but
that part requires much more work.  It remains to be seen whether a
more structural approach to dealing with this problem may be warranted.

For now, this change is necessary to allow instrumented state transfer
of various "minix_timer" structures and pointers in PM and VFS.

Change-Id: Ib717d86ccfced53387e72a92750d22ae980c3466

9 years agolibmagic: supply own ctype macros 61/3161/1
David van Moolenbroek [Mon, 24 Aug 2015 06:30:46 +0000 (08:30 +0200)]
libmagic: supply own ctype macros

Due to the current linker command line ordering, parts of lib(min)c
that are used exclusively by libmagic end up not being instrumented,
which then causes problems transferring pointers such as _ctype_tab_
and _tolower_tab_.  As a temporary workaround, we redefine the macros
that use those pointers.  A better long-term solution should
eventually render this patch obsolete.

Change-Id: Ice1d125ff6fb2f65ac6dcc6cf6eec7cd6176bee1

9 years agolibmagic: ignore kernel pointers on MINIX3 60/3160/1
David van Moolenbroek [Mon, 10 Aug 2015 13:45:35 +0000 (15:45 +0200)]
libmagic: ignore kernel pointers on MINIX3

Change-Id: I8830cab3d6637bae6141dc2b0e209d319703787f

9 years agoMake more services use stateful live update 59/3159/1
David van Moolenbroek [Wed, 2 Sep 2015 02:49:18 +0000 (04:49 +0200)]
Make more services use stateful live update

Change-Id: If2e5b8e56fef633e471ec1cbb6e08ce3496ea755

9 years agotests: extend multicomponent live update test 58/3158/1
David van Moolenbroek [Fri, 17 Jul 2015 02:07:49 +0000 (04:07 +0200)]
tests: extend multicomponent live update test

- test multicomponent live update with and without rs and/or vm;
- retry the update a few times if the failure code suggests it might
  be a transient failure.

Change-Id: I5fce256bb418be257353ed21428f672d851d974d

9 years agotests: improve testrelpol.sh robustness 57/3157/1
David van Moolenbroek [Wed, 15 Jul 2015 11:04:40 +0000 (13:04 +0200)]
tests: improve testrelpol.sh robustness

- fix a TOCTOU bug;
- stop the script on permanent failure.

Change-Id: I570cce3427945ad34d283ded013219c93402ddf9

9 years agotests: remove VM exceptions from testrelpol.sh 56/3156/1
David van Moolenbroek [Wed, 15 Jul 2015 08:47:45 +0000 (10:47 +0200)]
tests: remove VM exceptions from testrelpol.sh

Change-Id: Ied1db7e77d1849ecb5e92fe9694bb395983c6122

9 years agoRS: remove support for unsafe updates 55/3155/1
David van Moolenbroek [Wed, 15 Jul 2015 08:46:04 +0000 (10:46 +0200)]
RS: remove support for unsafe updates

This feature should no longer be necessary.

Change-Id: I9bff628be020cf1741bffaeb3bb97e3660a54aea

9 years agoVM: allocate cache pages in mmap region 54/3154/1
David van Moolenbroek [Sun, 6 Sep 2015 14:56:30 +0000 (16:56 +0200)]
VM: allocate cache pages in mmap region

That way, these pages are transferred during live update, as they
should.  This resolves a mfs crash after a number of live updates.

Change-Id: Ia53bec2692b2114c29b96a453beb0f915f56453a

9 years agoImprove asynsend support for process swapping 53/3153/1
David van Moolenbroek [Sun, 6 Sep 2015 14:54:42 +0000 (16:54 +0200)]
Improve asynsend support for process swapping

This resolves various system stalls while running testrelpol.

Change-Id: Ie70fc2dbcdb0a8c9e3800cc0df564be747e111ec

9 years agoIgnore a new ARM driver entry for instrumentation 52/3152/1
David van Moolenbroek [Tue, 1 Sep 2015 09:50:20 +0000 (11:50 +0200)]
Ignore a new ARM driver entry for instrumentation

Change-Id: I710a7534d2ba41107641252b9f80f197d04ba107

9 years agoDisable malloc instrumentation for VM (#2) 51/3151/1
David van Moolenbroek [Sun, 6 Sep 2015 09:16:12 +0000 (11:16 +0200)]
Disable malloc instrumentation for VM (#2)

When the malloc code is instrumented, the global _brksize variable
should not be transferred.  However, when the malloc code is not
instrumented, failing to transfer _brksize would reset the heap
upon state transfer.  In this patch, the magic pass stores the flag
indicating whether memory function instrumentation is disabled, in
the target process.  This allows libmagic to check this flag during
state transfer, to see whether it should transfer _brksize or not.

Change-Id: Ia004651e21e08b0ed3f5305865c53c6659e18f38

9 years agoDisable malloc instrumentation for VM (#1) 50/3150/1
David van Moolenbroek [Tue, 1 Sep 2015 04:12:47 +0000 (06:12 +0200)]
Disable malloc instrumentation for VM (#1)

This patch changes the VM makefile to specify that the magic pass is
to skip memory function instrumentation, and to transfer the data
variables of the malloc code (thus overriding the exception we made
for all other system services).  We add two magic pass flags to
achieve this.  Since the magic pass is a big bowl of spaghetti code,
ignoring whitespace changes while viewing this patch is recommended.

Change-Id: I5ab83b23d8437b37c44dea99537bc202469c9df6

9 years agoFix mmap leak in malloc code upon state transfer 49/3149/1
David van Moolenbroek [Wed, 26 Aug 2015 05:57:03 +0000 (07:57 +0200)]
Fix mmap leak in malloc code upon state transfer

The NetBSD libc malloc implementation uses a memory-mapped area for
its page directory.  Since the process heap is reconstructed upon
state transfer for live update, this memory-mapped area must not be
transferred to the new process.  However, as the new instance of the
process being updated inherits all memory-mapped areas of the old
instance, it also automatically inherits the malloc implementation's
page directory.  Thus, we must explicitly free this area in order to
avoid a memory leak.

The magic pass already detects (de)allocation functions called from
within other (de)allocation functions, which is why the mmap(2) and
munmap(2) calls of the malloc code are not instrumented as it is.
This patch changes that particular case to allow a different hook
function to be called for such "nested" allocation calls, for a
particular set of nested calls.  In particular, the malloc(3) code's
mmap(2) and munmap(2) calls are replaced with magic_nested_mmap and
magic_nested_munmap calls, respectively.  The magic library then
tracks memory mapping allocations of the malloc code by providing an
implementation for these two wrappers, and frees the allocations upon
state transfer.

This approach was chosen over various alternatives:

- While it appears that nesting could be established by setting a
  flag while the malloc(3) wrapper is active, and testing the flag in
  the mmap(2)/munmap(2) wrappers, this approach would fail to detect
  memory-mapped allocations made from uninstrumented malloc(3) calls,
  and therefore not a viable option.
- It would be possible to obtain the value of the variables that
  store the information about the memory-mapped area in the malloc
  code.  However, this is rather difficult in practice due to the way
  the libc malloc implementation stores the size of the are, and it
  would make the solution more dependent on the specific libc malloc
  implementation.
- It would be possible to use the special "nested" instrumentation
  for allocations made from certain marked sections.  Since we mark
  the data section of the malloc code already, this would not be hard
  to do.  Switching to this alternative would change very little, and
  if for any reason this approach yields more advantages in the
  future, we can still choose to do so.

Change-Id: Id977405da86a72458dd10f18e076d8460fd2fb75

9 years agoDo not instrument malloc implementation variables 48/3148/1
David van Moolenbroek [Wed, 26 Aug 2015 05:33:06 +0000 (07:33 +0200)]
Do not instrument malloc implementation variables

Since the heap is reconstructed upon state transfer, the old malloc
state is discarded.  In order to avoid state transfer errors, we can
and in fact must discard the internal state of the malloc
implementation.  This patch achieves this by using the sectionify
pass to mark the variables in the libminc malloc object as state that
must be skipped during state transfer.

Change-Id: Ie330f582c8bd45f37a878ea41fa0f9d4a18045e1

9 years agoRS/VM: proper preparation for multi-VM live update 47/3147/1
David van Moolenbroek [Tue, 14 Jul 2015 05:42:48 +0000 (07:42 +0200)]
RS/VM: proper preparation for multi-VM live update

Due to changed VM internals, more elaborate preparation is required
before a live update with multiple components including VM can take
place.  This patch adds the essential preparation infrastructure to
VM and adapts RS to make use of it.  As a side effect, it is no
longer necessary to supply RS as the last component (if at all)
during the set-up of a multicomponent live update operation.

Change-Id: If069fd3f93f96f9d5433998e4615f861465ef448

9 years agoVM: undo actions after live-update rollback 46/3146/1
David van Moolenbroek [Tue, 14 Jul 2015 04:44:35 +0000 (06:44 +0200)]
VM: undo actions after live-update rollback

During live update, the new instance of VM may make changes that,
after a rollback, have to be undone by the old instance of VM, in
particular because both instances share (read-write) all dynamically
allocated pages.

Change-Id: I2bcfa8e627ca6084b1991e0af7cccecc683894a2

9 years agolibmagic: free actual dsentry rather than a copy 45/3145/1
David van Moolenbroek [Fri, 17 Jul 2015 19:36:58 +0000 (21:36 +0200)]
libmagic: free actual dsentry rather than a copy

This resolves an infinite loop during boot, in libblockdriver freeing
DMA memory at the end of a partition(3) call.

Change-Id: I0757aa48f769ea79eab7160f23ee4c97cf58e055

9 years agoBreak loose from llvm-apps entirely 44/3144/1
David van Moolenbroek [Sun, 5 Jul 2015 16:01:13 +0000 (18:01 +0200)]
Break loose from llvm-apps entirely

Change-Id: I532f5f44c785c1a72407b504568d54fc6cbabf8f

9 years agoImport magic library from llvm-apps 43/3143/1
David van Moolenbroek [Tue, 30 Jun 2015 16:19:11 +0000 (18:19 +0200)]
Import magic library from llvm-apps

Change-Id: Icfbcfae6afc731a23e71448a7a5d0045b2c219e5

9 years agoImport magic pass from llvm-apps 42/3142/1
David van Moolenbroek [Mon, 29 Jun 2015 23:25:43 +0000 (01:25 +0200)]
Import magic pass from llvm-apps

Change-Id: I19535b913b50f2ff24aeb80ddefc92e305c31fe8

9 years agoImport sectionify pass from llvm-apps 41/3141/1
David van Moolenbroek [Tue, 30 Jun 2015 15:58:12 +0000 (17:58 +0200)]
Import sectionify pass from llvm-apps

Change-Id: I3e3ac102b4898ca22ed1d9c25ec309d77bbe32de

9 years agoLLVM passes: centralize Makefile structure 40/3140/1
David van Moolenbroek [Mon, 31 Aug 2015 14:46:42 +0000 (16:46 +0200)]
LLVM passes: centralize Makefile structure

Make the passes we have so far, hello and WeakAliasModuleOverride,
use settings from a Makefile include file in the parent directory.
This change is in preparation of adding other passes.

Change-Id: Ib195ee7f5c7626f4975368b02c944382e87e3814

9 years agox86_hdimage: increase image size for bitcode build 39/3139/1
Erik van der Kouwe [Wed, 6 Aug 2014 13:11:22 +0000 (15:11 +0200)]
x86_hdimage: increase image size for bitcode build

Make disk image size sufficient for LLVM bitcode build with symbols.

Edited by David van Moolenbroek to do this only when -b is given.

Change-Id: I3bde164756c477b4af5ed9435ca03da3b186cf7e

9 years agoBitCode: Fix Dynamic Binaries 38/3138/1
Lionel Sambuc [Wed, 6 May 2015 14:53:33 +0000 (16:53 +0200)]
BitCode: Fix Dynamic Binaries

Change-Id: I7f3b775426a0c79969c7efc7a9970683b9dd950c

9 years agoSupport BUILDVARS from cmd line in configure.llvm 37/3137/1
Lionel Sambuc [Wed, 28 Jan 2015 14:04:27 +0000 (15:04 +0100)]
Support BUILDVARS from cmd line in configure.llvm

Change-Id: I59527c60cb34c12fd2bed449b37bb812a83c4e42

9 years agollvm: Never rebuild gold in configure.llvm. 36/3136/1
Cristiano Giuffrida [Wed, 28 Jan 2015 13:30:38 +0000 (14:30 +0100)]
llvm: Never rebuild gold in configure.llvm.

Change-Id: I7378ca38a5a9bf018823b6431d1a4ca8fbb10b58

9 years agollvm: Fix OPTFLAGS. 35/3135/1
Cristiano Giuffrida [Wed, 28 Jan 2015 12:40:19 +0000 (13:40 +0100)]
llvm: Fix OPTFLAGS.

Change-Id: Id35ac2821ad69825735c50a32bdd04d8453edb22

9 years agoQEMU default command lines updates 34/3134/1
Lionel Sambuc [Fri, 23 Jan 2015 17:30:39 +0000 (18:30 +0100)]
QEMU default command lines updates

 - Fix a bug in clientctl which tried to test for kvm. This simply
   remove this faulty test  as the kvm command has been deprecated by the
   QEMU project for a couple of years now.

 - Specify by default 256M of RAM as this is the minimal amount required
   for the whole-OS live update test to succeed.

 - Update the default command printed out at the end of the x86_hdimage
   script to be more generic, less focused on one use-case.

Change-Id: Ic555d50a3a1471f7d35cc7fd369f2292add6ac39

9 years agoreleasetools: Fix CREATE_IMAGE_ONLY in x86 hdimage script. 33/3133/1
Cristiano Giuffrida [Mon, 29 Dec 2014 02:07:57 +0000 (03:07 +0100)]
releasetools: Fix CREATE_IMAGE_ONLY in x86 hdimage script.

Change-Id: Ie1c8dbedc16b8edac16f5b76b36df30b3a4eddb1

9 years agollvm: Build scripts improvements. 32/3132/1
Cristiano Giuffrida [Sun, 28 Dec 2014 12:20:47 +0000 (13:20 +0100)]
llvm: Build scripts improvements.

Change-Id: I278cdebccdba18be7e264bfd240ff02d4480b33c

9 years agollvm: Extend clientctl with many features. 31/3131/1
Cristiano Giuffrida [Mon, 22 Sep 2014 06:24:01 +0000 (08:24 +0200)]
llvm: Extend clientctl with many features.

Change-Id: I739eefa46458e956cb79c42a8cbf880428eec794

9 years agollvm: Fix module map generation. 30/3130/1
Cristiano Giuffrida [Mon, 29 Sep 2014 07:36:13 +0000 (09:36 +0200)]
llvm: Fix module map generation.

Change-Id: If9c2bef4c0ef3d002ac65a2c66aabcf0cf99ff95

9 years agollvm: Improve error handling in configure.llvm. 29/3129/1
Cristiano Giuffrida [Wed, 10 Sep 2014 16:17:18 +0000 (18:17 +0200)]
llvm: Improve error handling in configure.llvm.

Change-Id: I9aa8f8a07a512f642447c70dca2e85d40ebe2b2a

9 years agoKernel: IPC filter support for VM memory requests 28/3128/1
David van Moolenbroek [Sun, 12 Jul 2015 05:58:07 +0000 (07:58 +0200)]
Kernel: IPC filter support for VM memory requests

The filtering also exposed the risk that a process be killed or
swapped while on the list of VM memory requests.  These cases are
now handled properly as well.

Change-Id: Ibd3897b34abdf33bce19d37b8e5f65fbd0fd9316

9 years agoVM: set recovery policy to restart 27/3127/1
Lionel Sambuc [Mon, 26 Jan 2015 14:09:05 +0000 (15:09 +0100)]
VM: set recovery policy to restart

 - Update proc to select restart policy for VM
 - Update testrelpol to test the supported modes of recovery for VM
 - Small code cleanups in testrelpol as well.

Change-Id: I6958e100865c2429b9435f3f7cc7d018046378c3

9 years agoVM: fix mmap region transfer range bug 26/3126/1
David van Moolenbroek [Sun, 12 Jul 2015 17:21:38 +0000 (19:21 +0200)]
VM: fix mmap region transfer range bug

A missing check to see whether the range being transferred is sane
(with a starting address lower than an ending address) caused extra
memory to be marked erroneously as copy-on-write for some processes,
ultimately resulting in pagefaults on the stack during live update
rollback.

Change-Id: I1516b509b485379606d8df05b8a0f514896a0f19

9 years agoVM: live update - check for regions above stack 25/3125/1
Dirk Vogt [Mon, 19 Jan 2015 14:20:30 +0000 (15:20 +0100)]
VM: live update - check for regions above stack

If the stack is not mapped at the VM_DATATOP (e.g. booted with
ac_layout = 1), there might be some more regions hiding above
the stack.  We also have to transfer those.

Change-Id: Idf3b94a36fcec8a10ace2f6dffe816faf0a88f60

9 years agoRS: synchronize priv from kernel after swap 24/3124/1
Ben Gras [Fri, 16 Jan 2015 13:24:24 +0000 (14:24 +0100)]
RS: synchronize priv from kernel after swap

. make sure the priv id etc is maintained so
  future privctl talk about the right thing
. solves broken IPC after update

Change-Id: I17ed0212c22d634e6db1e80f8dcb2fb8bffe82c6

9 years agoSEF: query VM about holes during state transfer 23/3123/1
David van Moolenbroek [Sat, 18 Jul 2015 11:04:34 +0000 (13:04 +0200)]
SEF: query VM about holes during state transfer

The 'memory' service has holes in its data section, which causes
problems during state transfer.  Since VM cannot handle page faults
during a multicomponent-with-VM live update, the state transfer must
ensure that no page faults occur during copying.  Therefore, we now
query VM about the regions to copy, thus skipping holes.  While the
solution is not ideal, it is sufficiently generic that it can be used
for the data section state transfer of all processes, and possibly
for state transfer of other regions in the future as well.

Change-Id: I2a71383a18643ebd36956c396fbd22c8fd137202

9 years agovm: restartability improvements (#2) 22/3122/1
Ben Gras [Fri, 16 Jan 2015 15:42:28 +0000 (16:42 +0100)]
vm: restartability improvements (#2)

also allocate vm pagetables dynamic-only.

further improves restart survivability.

Change-Id: Iac44845d9bd434408b23755274fa890a7b851373

9 years agovm: restartability improvements (#1) 21/3121/1
Ben Gras [Thu, 15 Jan 2015 15:47:46 +0000 (16:47 +0100)]
vm: restartability improvements (#1)

Two bugs fixed wrt vm restartability.

. make sure pagetable data is only allocated
  using dynamic data instead of static spare pages
  (bootstrap pages). They are needed for bootstrap
  but now repeat some of the initialization so only
  dynamic data remains. This solves the problem of
  physical addresses changing (as static pages are
  re-allocated for the new instance) after update.
. pt_ptalloc has to be specified in bytes instead of
  pde slot numbers. leaving pt_pt NULL causes mapping
  transfers to fail because NULL happens to be mapped in
  then and updates then happen there.
. added some sanity checks against the above happening.

The new state is that VM can update many times, but the system
isn't fully reliable afterwards yet.

Change-Id: I7313602c740cdae8590589132291116ed921aed7

9 years agoKernel: delivermsg improvements 20/3120/1
Ben Gras [Sun, 28 Jun 2015 22:07:29 +0000 (00:07 +0200)]
Kernel: delivermsg improvements

    . make arch-independent, and local to proc.c, reduce code duplication
    . make vm_suspend public but unduplicated in proc.c
    . ask VM for handling once, 2nd time SIGSEGV process
    . remove debug printfs
    . test case for bogus sendrec() address argument

Change-Id: I3893758910c01de60b8fe3e50edd594296a0b73e

9 years agovm: Allow in-band metadata for cache blocks 19/3119/1
Cristiano Giuffrida [Sat, 3 Jan 2015 01:29:46 +0000 (02:29 +0100)]
vm: Allow in-band metadata for cache blocks

Allow extra space for in-band metadata when allocating cache blocks.

Edited by David van Moolenbroek: since this effectively halves the
potential size of the typical file system cache, do this only when
compiling with instrumentation.

Change-Id: I0840af6420899ede2d5bb7539e79c0a456b5128d

9 years agolibmthread: Fix guard page mapping. 18/3118/1
Cristiano Giuffrida [Fri, 2 Jan 2015 15:51:29 +0000 (16:51 +0100)]
libmthread: Fix guard page mapping.

Edited by David van Moolenbroek to deallocate the guard page as well.
Note that while the new approach is better in theory (previously, the
hole could end up being filled by another allocated page), guard page
protection is now broken in practice, because VM does not support
setting specific page permissions (in this case, PROT_NONE).

Change-Id: I882624f5d152d3ebe82fca649cbad85aa4931780

9 years agotestrelpol: let test specific services 17/3117/1
Lionel Sambuc [Mon, 12 Jan 2015 17:14:43 +0000 (18:14 +0100)]
testrelpol: let test specific services

If arguments are provided, the services list to test is set from those,
instead of initializing it with every currently running service.

If such arguments are present, also skip LiveUpdate tests.

Change-Id: I14f874666a610072a5ff4a60516e59cf04dc9e31

9 years agotests: Expand the reliability test suite. 16/3116/1
Cristiano Giuffrida [Mon, 22 Dec 2014 02:38:50 +0000 (03:38 +0100)]
tests: Expand the reliability test suite.

Change-Id: Ic7f90f2d4edae1f72f98b34bda70891330c27941

9 years agosef: Support for LLVM ltckpt instrumentation. 15/3115/1
Cristiano Giuffrida [Wed, 29 Oct 2014 22:18:38 +0000 (23:18 +0100)]
sef: Support for LLVM ltckpt instrumentation.

Change-Id: I86073bddc3a820ab3d7c5d016ea1348840b0260a

9 years agoservices: Selectively enable stateful restart. 14/3114/1
Cristiano Giuffrida [Sat, 20 Dec 2014 10:45:05 +0000 (11:45 +0100)]
services: Selectively enable stateful restart.

Change-Id: Ibf6afa3041013ca714e28b673abb1329cd72d2d5

9 years agors: Update recovery policies for sched and mfs. 13/3113/1
Cristiano Giuffrida [Mon, 22 Dec 2014 02:34:01 +0000 (03:34 +0100)]
rs: Update recovery policies for sched and mfs.

Edited by David van Moolenbroek.

Change-Id: I7bbe543e2349dca3856a17abddc8366d1f19fe10

9 years agors: Add support for RS_FI. 12/3112/1
Cristiano Giuffrida [Sun, 21 Dec 2014 23:27:14 +0000 (00:27 +0100)]
rs: Add support for RS_FI.

Change-Id: Id8663859accfc4e3587db35dec7000059860fd49

9 years agovm: Fix heap preallocation. 11/3111/1
Cristiano Giuffrida [Sat, 20 Dec 2014 23:33:44 +0000 (00:33 +0100)]
vm: Fix heap preallocation.

Change-Id: I5b7f6473b9bbff69eae6ab26c889ad8ed902ff3a

9 years agovm: Fix vm cloning. 10/3110/1
Cristiano Giuffrida [Sat, 20 Dec 2014 17:14:27 +0000 (18:14 +0100)]
vm: Fix vm cloning.

Change-Id: I996410ab1b9628cde797d9e5dd73ed07f13a884b

9 years agoResolve boot-time VM/RS deadlock 09/3109/1
David van Moolenbroek [Fri, 4 Sep 2015 05:04:17 +0000 (07:04 +0200)]
Resolve boot-time VM/RS deadlock

VM used to call sendrec to send a boot-time RS_INIT reply to RS, but
RS could run into a pagefault at the same time, thus spawning a
message to VM, resulting in a deadlock.  We resolve this situation by
making VM acknowledge RS_INIT asynchronously at boot time, while
retaining the synchronous sendrec for subsequent RS_INIT responses.

Change-Id: I3cb72d7f8d6b9bfdc59a85958ada739c37fa3bde

9 years agoSwitch to stateful restart. 08/3108/1
Cristiano Giuffrida [Sat, 1 Mar 2014 22:52:17 +0000 (23:52 +0100)]
Switch to stateful restart.

The following services have been updated to support stateful restarts:
 - Drivers: tty
 - Filesystems: isofs, mfs, pfs, libvtreefs-based file servers
 - System servers: tty, ds, pm, vfs, vm

Change-Id: Ie84baa3ba1774047b3ae519808fe4116928edabb

9 years agods: Add live update extensions. 07/3107/1
Cristiano Giuffrida [Sat, 18 Jul 2015 10:08:15 +0000 (12:08 +0200)]
ds: Add live update extensions.

Change-Id: I093c462ddad4a5e9b3dc39140f45f0e25e83bb55

9 years agoAdd live update-friendly annotations. 06/3106/1
Cristiano Giuffrida [Tue, 11 Mar 2014 17:01:27 +0000 (18:01 +0100)]
Add live update-friendly annotations.

Change-Id: I7d7d79893836a20799ca548a350f3288e92581f0

9 years agolibsys: mark regions allocated for DMA as special 04/3104/2
Cristiano Giuffrida [Sat, 1 Mar 2014 21:27:07 +0000 (22:27 +0100)]
libsys: mark regions allocated for DMA as special

This ensures that they will not be relocated.

Edited by David van Moolenbroek.

Change-Id: Ic2a97bc65b94dfcf364c06577aa340a9a5299e74

9 years agovm: Let SEF know about special mmapped regions. 03/3103/2
Cristiano Giuffrida [Wed, 29 Oct 2014 14:42:27 +0000 (15:42 +0100)]
vm: Let SEF know about special mmapped regions.

Change-Id: I742529a6747ddd181937aa1a45264b87677c01c8

9 years agoRS: clean up dead services during shutdown 02/3102/2
David van Moolenbroek [Sat, 5 Sep 2015 06:01:33 +0000 (08:01 +0200)]
RS: clean up dead services during shutdown

Previously, RS would clean up dead services only when it is idle.
During shutdown, all services are marked with the 'exiting' flag,
and these flags lead RS to conclude it is not idle.  Therefore, at
shutdown time, no services were cleaned up anymore, leading to
deadlock situations.  For example, VFS could end up waiting for a
service that was already dead, or one driver could end up waiting
for an interrupt on a line shared with another dead driver.

While it may be possible to ignore RS_EXITING when checking idle
status, other flags may have the same ultimate effect.  Therefore,
this patch skips the idle check altogether when in shutdown mode.

Change-Id: I071fa9545da1d43c5e5c2e0bc2b6c173e3bb57c3

9 years agoRS: reset heartbeat status after rollback 01/3101/2
David van Moolenbroek [Thu, 16 Jul 2015 15:12:03 +0000 (17:12 +0200)]
RS: reset heartbeat status after rollback

While in a multicomponent live update that includes RS, the new RS
instance may receive heartbeat replies which, after a rollback, the
old RS instance will then never see.  As a result, the rolled-back
RS instance may end up killing well-behaving services.

Change-Id: I0f0af283c33502d5d55b27e353b62aec2e301285

9 years agoRS: use IPC filters to do a timed receive 00/3100/2
David van Moolenbroek [Thu, 16 Jul 2015 05:59:53 +0000 (07:59 +0200)]
RS: use IPC filters to do a timed receive

Change-Id: I28df9920d8a65b47f3cf974ed9c5eb3174479d8a

9 years agors: New RS. 99/3099/2
Cristiano Giuffrida [Mon, 27 Oct 2014 21:36:25 +0000 (22:36 +0100)]
rs: New RS.

Change-Id: I46e335d5dac49104028d7cb0706b3e85de752bfe

9 years agosef: Extensions for new RS. 98/3098/2
Cristiano Giuffrida [Tue, 30 Sep 2014 05:15:41 +0000 (07:15 +0200)]
sef: Extensions for new RS.

Change-Id: I89b6f8015b1f9c46bf98694450bdaa80b7777940

9 years agosef: New definitions and event loop refactory. 97/3097/2
Cristiano Giuffrida [Mon, 29 Sep 2014 10:28:33 +0000 (12:28 +0200)]
sef: New definitions and event loop refactory.

Change-Id: I0cd0906e513b2b804b94eebc86c76b5c402b572b

9 years agoservice: Extensions for new RS. 96/3096/2
Cristiano Giuffrida [Tue, 11 Mar 2014 15:53:14 +0000 (16:53 +0100)]
service: Extensions for new RS.

Change-Id: Ifb72c7e8c912709edce0fb9ba9efb570901be5fb

9 years agoinclude: Header file changes for new RS. 95/3095/2
Cristiano Giuffrida [Sun, 28 Sep 2014 20:49:23 +0000 (22:49 +0200)]
include: Header file changes for new RS.

Change-Id: I33602adb6a8c42050fc5ee6dbdf6ee6a7aeabaab

9 years agosef: Naming refactory. 94/3094/2
Cristiano Giuffrida [Sun, 28 Sep 2014 16:53:31 +0000 (18:53 +0200)]
sef: Naming refactory.

Change-Id: Id313e73fde577e48a17f2c16c808c9156a1be804

9 years agosef: GCOV cleanup. 93/3093/2
Cristiano Giuffrida [Fri, 26 Sep 2014 14:05:32 +0000 (16:05 +0200)]
sef: GCOV cleanup.

Change-Id: I2e5a6ae10f45108a2c112f78e5a0af4f93e0bed1

9 years agovm: Allow VM to make self calls when needed. 92/3092/2
Cristiano Giuffrida [Tue, 11 Mar 2014 23:23:01 +0000 (00:23 +0100)]
vm: Allow VM to make self calls when needed.

Change-Id: I7aada24adad3dc6bfe5b0bd4a50b5005c79ff887

9 years agovm: Improve live update support. 91/3091/2
Cristiano Giuffrida [Tue, 11 Mar 2014 23:13:37 +0000 (00:13 +0100)]
vm: Improve live update support.

Change-Id: I02da3ea32cd05c4ed84a6e199236e5df6e25cb60

9 years agovm: Separate mmap regions. 90/3090/2
Cristiano Giuffrida [Tue, 11 Mar 2014 23:02:34 +0000 (00:02 +0100)]
vm: Separate mmap regions.

Add support for compact address layout.  This feature can be enabled
through the ac_layout=1 boot option.

Change-Id: Ie20b808fce32b5c54d0a7e7210e0084a540e9613

9 years agovm: Extend the vm_memctl() interface. 89/3089/2
Cristiano Giuffrida [Tue, 11 Mar 2014 22:22:55 +0000 (23:22 +0100)]
vm: Extend the vm_memctl() interface.

Change-Id: I87b7c188bd1fc54a3ec943e7ff1d05c6f4c8a56a

9 years agors: Ditch dead code to munmap zero pages. 88/3088/2
Cristiano Giuffrida [Sat, 1 Mar 2014 23:00:05 +0000 (00:00 +0100)]
rs: Ditch dead code to munmap zero pages.

Change-Id: Ib184839e3b607986716fc48aec5ebd8ee796a065

9 years agolibsys: Increase number of static grants. 87/3087/2
Cristiano Giuffrida [Tue, 11 Mar 2014 20:12:53 +0000 (21:12 +0100)]
libsys: Increase number of static grants.

This is required by the state transfer framework.

Change-Id: I6bc08cee6c70ff406fbd8d45a12721a26c86d45a

9 years agolibsys: Support for senda_reload(). 86/3086/2
Cristiano Giuffrida [Tue, 11 Mar 2014 20:11:32 +0000 (21:11 +0100)]
libsys: Support for senda_reload().

Change-Id: I67f94515d2b89199643195d32d92f1bef9770359

9 years agolibsys: Change SEF Live Update state callback API. 85/3085/2
Cristiano Giuffrida [Sat, 1 Mar 2014 22:48:16 +0000 (23:48 +0100)]
libsys: Change SEF Live Update state callback API.

The following callbacks are concerned:
 - state_save
 - state_isvalid

Change-Id: I75f71fe162ccd8b23b18cae15f844b79b290a8c1

9 years agokernel: Debug printing at live update time. 84/3084/2
Cristiano Giuffrida [Tue, 11 Mar 2014 17:09:02 +0000 (18:09 +0100)]
kernel: Debug printing at live update time.

Change-Id: I0fa896eb248b3b62e1858f76196d3d6862a30f2b

9 years agokernel: Handle IPC properly at live update time. 83/3083/2
Cristiano Giuffrida [Tue, 11 Mar 2014 17:06:45 +0000 (18:06 +0100)]
kernel: Handle IPC properly at live update time.

Change-Id: I2dfc6c6cf4d2bfe198e159d3e4b7c50d0bb499c8

9 years agokernel: Inherit allowed memory, IRQ & I/O ranges 82/3082/2
Cristiano Giuffrida [Tue, 11 Mar 2014 16:56:03 +0000 (17:56 +0100)]
kernel: Inherit allowed memory, IRQ & I/O ranges

Inherit at live update time all the priviledges previously acquired by
the process.

Change-Id: I1fd6ab16680ea85a1f3d8d1c106a7c716bf65e8e

9 years agokernel: Allow kernel calls to return ENOTREADY. 81/3081/2
Cristiano Giuffrida [Tue, 11 Mar 2014 16:47:40 +0000 (17:47 +0100)]
kernel: Allow kernel calls to return ENOTREADY.

This is required to avoid races with safecopy() at live update time.

Change-Id: I1f3e22d40f22d94bd2b850915f9b8163a08b5616

9 years agokernel: Add support for IPC filters. 80/3080/2
Cristiano Giuffrida [Wed, 12 Mar 2014 18:34:52 +0000 (19:34 +0100)]
kernel: Add support for IPC filters.

Edited by David van Moolenbroek.

Change-Id: Ia0052c42a0f218d011dd2da1e3db6c5b2107adc7

9 years agokernel: Add SYS_PRIV_CLEAR_IPC_REFS support. 79/3079/2
Cristiano Giuffrida [Mon, 3 Mar 2014 01:04:02 +0000 (02:04 +0100)]
kernel: Add SYS_PRIV_CLEAR_IPC_REFS support.

Change-Id: Ie5e86191d5040f305a5a42942d83319cd600bfb6

9 years agokernel: Extend the {sys,vm}_update() interfaces. 78/3078/2
Cristiano Giuffrida [Sun, 2 Mar 2014 00:15:08 +0000 (01:15 +0100)]
kernel: Extend the {sys,vm}_update() interfaces.

Change-Id: I9ada3c04c08d219b198e9081f4e1942b11c722f6

9 years agokernel: Extend the sys_whoami() interface. 77/3077/2
Cristiano Giuffrida [Sat, 1 Mar 2014 23:47:43 +0000 (00:47 +0100)]
kernel: Extend the sys_whoami() interface.

Add support for init flags.

Change-Id: Ibb4d7eb9064d2bbee6d51112ad0c56b2750a5f8e

9 years agokernel: Extend the sys_statectl() interface. 76/3076/2
Cristiano Giuffrida [Sat, 1 Mar 2014 23:40:33 +0000 (00:40 +0100)]
kernel: Extend the sys_statectl() interface.

Change-Id: Ica37640f61513db9466dacf861a8148e3fb799d5

9 years agoinclude: Add sys flags definitions. 75/3075/2
Cristiano Giuffrida [Tue, 11 Mar 2014 23:34:54 +0000 (00:34 +0100)]
include: Add sys flags definitions.

Change-Id: I8ecbe636641467efea058a9527416fc25d954daf

9 years agoVFS: fix short select(2) timeouts 05/3105/1
David van Moolenbroek [Wed, 16 Sep 2015 10:41:46 +0000 (10:41 +0000)]
VFS: fix short select(2) timeouts

Some select queries require a response from device drivers.  If a
select call is nonblocking (with a zero timeout), the response to
the caller may have to be deferred until all involved drivers have
responded to the initial query.  This is handled just fine.

However, if the select call has a timeout that is so short that it
triggers before all the involved drivers have responded, the
resulting alarm would be discarded, possibly resulting in the call
blocking forever.  This fix changes the alarm handler such that if
the alarm triggers too early, the select call is further handled
as though it was nonblocking.

This fix resolves a test77 deadlock on really slow systems.

Change-Id: Ib487c8fe436802c3e11c57355ae0c8480721f06e

9 years agoprocfs: do not list init in /proc/services 74/3074/1
David van Moolenbroek [Sat, 5 Sep 2015 16:21:53 +0000 (18:21 +0200)]
procfs: do not list init in /proc/services

It is not a system service.

Change-Id: Ibfbf08aa52095826c19172e517bcbd292e7944a0

9 years agoKernel: improve stacktrace printing 73/3073/1
David van Moolenbroek [Thu, 3 Sep 2015 01:12:33 +0000 (03:12 +0200)]
Kernel: improve stacktrace printing

- corrupt stack traces could trigger a kernel panic;
- output consistency and spelling.

Change-Id: I04c9ac7db77593d6e837a28c83f1734adc8d9da7

9 years agoinet: resolve some compile and runtime warnings 71/3071/1
David van Moolenbroek [Tue, 1 Sep 2015 16:20:18 +0000 (16:20 +0000)]
inet: resolve some compile and runtime warnings

- ping(1) triggers warnings about unimplemented exceptions for select;
  even if there could be a useful implementation (which is doubtful),
  the warnings are not helping anyone right now;
- the clock_t data type has changed.

Change-Id: Ie5b1383e7657e8501f63bb4b9d255c6502567a15