]> Zhao Yanbai Git Server - minix.git/log
minix.git
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

9 years agoVFS: workaround to allow TIOCSCTTY on PTYs 70/3070/1
David van Moolenbroek [Tue, 1 Sep 2015 11:42:03 +0000 (11:42 +0000)]
VFS: workaround to allow TIOCSCTTY on PTYs

Fix /dev/tty-related issues in tmux(1) by hardcoding the PTY major
in VFS in addition to the TTY major.  Even though this is exactly
what we did NOT want to have to do, the actual fix for this issue
is going to take a little longer.

Change-Id: I24c75eaf688b9ebd28e931f2e445b8442cfdac78

9 years agoVFS: make message pointer management more robust 69/3069/1
David van Moolenbroek [Mon, 10 Aug 2015 16:07:31 +0000 (18:07 +0200)]
VFS: make message pointer management more robust

The previous approach of storing pointers to messages structures for
thread-blocking sendrec operations relied on several assumptions,
which if violated could lead to odd cases of memory corruption.
With this patch, VFS resets pointers right after use, avoiding that
any dangling pointers are accidentally dereferenced later.  This
approach was already used in some cases, but not all of them.

Change-Id: I752d994ea847b46228bd2ccf4e537deceb78fbaf

9 years agoVFS: check X bit, not R bit, opening executables 68/3068/1
David van Moolenbroek [Mon, 31 Aug 2015 12:12:28 +0000 (12:12 +0000)]
VFS: check X bit, not R bit, opening executables

For dynamically linked executables, the interpreter is passed a
file descriptor of the binary being executed.  To this end, VFS
opens the target executable, but opening the file fails if it is
not readable, even when it is executable.  With this patch, when
opening the executable, it verifies the X bit rather than the R
bit on the file, thus allowing the execution of dynamically
linked binaries that are executable but not readable.

Add test86 to verify correctness.

Change-Id: If3514add6a33b33d52c05a0a627d757bff118d77

9 years agoVFS: tweak coredump wrapper code 67/3067/1
David van Moolenbroek [Mon, 31 Aug 2015 12:01:26 +0000 (12:01 +0000)]
VFS: tweak coredump wrapper code

Change-Id: I6c1f50910d906b25f6df2b48f2cbfb899850924e

9 years agoVFS: resolve noassert warning 66/3066/1
David van Moolenbroek [Mon, 31 Aug 2015 11:24:21 +0000 (11:24 +0000)]
VFS: resolve noassert warning

Change-Id: I647f5a7b3c2935be3df032873705be83de9aaffb

9 years agosched: simplify 65/3065/1
David van Moolenbroek [Mon, 24 Aug 2015 07:20:26 +0000 (09:20 +0200)]
sched: simplify

- do not use timers when there is only ever one timer;
- do not include kernel header files for no reason;
- do not reply to notifications ever.

Change-Id: I5817e22c1b46c4e30e5135069df318af0b4f87fd

9 years agoDS: fix regex memory leaks 64/3064/1
David van Moolenbroek [Mon, 24 Aug 2015 10:18:40 +0000 (12:18 +0200)]
DS: fix regex memory leaks

The regcomp(3) calls had no matching regfree(3) calls.

Change-Id: I5250d62e6ab22821aff18bcdc336cb485df6868e

9 years agolibminixfs: rework prefetch API 63/3063/2
David van Moolenbroek [Sat, 4 Apr 2015 15:55:48 +0000 (15:55 +0000)]
libminixfs: rework prefetch API

This patch changes the prefetch API so that file systems must now
provide a set of block numbers, rather than a set of buffers.  The
result is a leaner and more well-defined API; linear computation of
the range of blocks to prefetch; duplicates no longer interfering
with the prefetch process; guaranteed inclusion of the block needed
next into the prefetch range; and, limits and policy decisions better
established by libminixfs now actually being moved into libminixfs.

Change-Id: I7e44daf2d2d164bc5e2f1473ad717f3ff0f0a77f

9 years agolibminixfs: better support for read errors and EOF 62/3062/2
David van Moolenbroek [Sun, 29 Mar 2015 16:57:53 +0000 (16:57 +0000)]
libminixfs: better support for read errors and EOF

- The lmfs_get_block*(3) API calls may now return an error.  The idea
  is to encourage a next generation of file system services to do a
  better job at dealing with block read errors than the MFS-derived
  implementations do.  These existing file systems have been changed
  to panic immediately upon getting a block read error, in order to
  let unchecked errors cause corruption.  Note that libbdev already
  retries failing I/O operations a few times first.

- The libminixfs block device I/O module (bio.c) now deals properly
  with end-of-file conditions on block devices.  Since a device or
  partition size may not be a multiple of the root file system's block
  size, support for partial block retrival has been added, with a new
  internal lmfs_get_partial_block(3) call.  A new test program,
  test85, tests the new handling of EOF conditions when reading,
  writing, and memory-mapping a block device.

Change-Id: I05e35b6b8851488328a2679da635ebba0c6d08ce

9 years agolibminixfs: keep track of block usage 61/3061/2
David van Moolenbroek [Sun, 29 Mar 2015 15:26:23 +0000 (15:26 +0000)]
libminixfs: keep track of block usage

This patch changes the libminixfs API and implementation such that the
library is at all times aware of how many total and used blocks there
are in the file system.  This removes the last upcall of libminixfs
into file systems (fs_blockstats).  In the process, make this part of
the libminixfs API a little prettier and more robust.  Change file
systems accordingly.  Since this change only adds to MFS being unable
to deal with zones and blocks having different sizes, fail to mount
such file systems immediately rather than triggering an assert later.

Change-Id: I078e589c7e1be1fa691cf391bf5dfddd1baf2c86

9 years agolibminixfs: miscellaneous API cleanup 60/3060/2
David van Moolenbroek [Sat, 28 Mar 2015 00:45:28 +0000 (00:45 +0000)]
libminixfs: miscellaneous API cleanup

Mostly removal of unused parameters from calls.

Change-Id: I0eb7b568265d1669492d958e78b9e69d7cf6fc05

9 years agolibminixfs: do not flush blocks that are in use 59/3059/1
David van Moolenbroek [Sun, 29 Mar 2015 12:30:45 +0000 (12:30 +0000)]
libminixfs: do not flush blocks that are in use

This removes an implicit requirement for the way the libminixfs API is
to be used, namely that a block is to be marked as dirty only once its
contents have been fully updated, within a single get_block/put_block
window.  The requirement may not be appropriate for all file systems.

Change-Id: I6a129d51b1a5e9aec1572039dc7c1c82dd795db5

9 years agolibminixfs: add support for peeking blocks 58/3058/1
David van Moolenbroek [Fri, 27 Mar 2015 20:00:55 +0000 (20:00 +0000)]
libminixfs: add support for peeking blocks

With this change, the lmfs_get_block*(3) functions allow the caller to
specify that it only wants the block if it is in the cache or the
secondary VM cache.  If the block is not found there, the functions
return NULL.  Previously, the PREFETCH method would be used to this
end instead, which was both abuse in name and less efficient.

Change-Id: Ieb5a15b67fa25d2008a8eeef9d126ac908fc2395

9 years agolibminixfs: add support for memory-mapped holes 57/3057/1
David van Moolenbroek [Thu, 13 Aug 2015 12:23:06 +0000 (12:23 +0000)]
libminixfs: add support for memory-mapped holes

When VM asks a file system to provide a block to satisfy a page fault
on a file memory mapping, the file system previously had no way to
inform VM that the block is a hole, since there is no corresponding
block on the underlying device.  To work around this, MFS and ext2
would actually allocate a block for the hole when asked by VM, which
not only defeats the point of holes in the first place, but also does
not work on read-only file systems.  With this patch, a new libminixfs
call allows the file system to inform VM about holes.  This issue does
raise the question as to whether the VM cache is using the right data
structures, since there are now two places where we have to fake a
device offset.  This will have to be revisited in the future.

The patch changes file systems accordingly, and adds a test to test74.

Change-Id: Ib537d56b3f30a8eb05bc1f63c92b5c7428d18f4c

9 years agolibminixfs/VM: fix memory-mapped file corruption 56/3056/1
David van Moolenbroek [Thu, 13 Aug 2015 11:29:33 +0000 (11:29 +0000)]
libminixfs/VM: fix memory-mapped file corruption

This patch employs one solution to resolve two independent but related
issues.  Both issues are the result of one fundamental aspect of the
way VM's memory mapping works: VM uses its cache to map in blocks for
memory-mapped file regions, and for blocks already in the VM cache, VM
does not go to the file system before mapping them in.  To preserve
consistency between the FS and VM caches, VM relies on being informed
about all updates to file contents through the block cache.  The two
issues are both the result of VM not being properly informed about
such updates:

 1. Once a file system provides libminixfs with an inode association
    (inode number + inode offset) for a disk block, this association
    is not broken until a new inode association is provided for it.
    If a block is freed and reallocated as a metadata (non-inode)
    block, its old association is maintained, and may be supplied to
    VM's secondary cache.  Due to reuse of inodes, it is possible
    that the same inode association becomes valid for an actual file
    block again.  In that case, when that new file is memory-mapped,
    under certain circumstances, VM may end up using the metadata
    block to satisfy a page fault on the file, due to the stale inode
    association.  The result is a corrupted memory mapping, with the
    application seeing data other than the current file contents
    mapped in at the file block.

 2. When a hole is created in a file, the underlying block is freed
    from the device, but VM is not informed of this update, and thus,
    if VM's cache contains the block with its previous inode
    association, this block will remain there.  As a result, if an
    application subsequently memory-maps the file, VM will map in the
    old block at the position of the hole, rather than an all-zeroes
    block.  Thus, again, the result is a corrupted memory mapping.

This patch resolves both issues by making the file system inform the
minixfs library about blocks being freed, so that libminixfs can
break the inode association for that block, both in its own cache and
in the VM cache.  Since libminixfs does not know whether VM has the
block in its cache or not, it makes a call to VM for each block being
freed.  Thus, this change introduces more calls to VM, but it solves
the correctness issues at hand; optimizations may be introduced
later.  On the upside, all freed blocks are now marked as clean,
which should result in fewer blocks being written back to the device,
and the blocks are removed from the caches entirely, which should
result in slightly better cache usage.

This patch is necessary but not sufficient to resolve the situation
with respect to memory mapping of file holes in general.  Therefore,
this patch extends test 74 with a (rather particular but effective)
test for the first issue, but not yet with a test for the second one.

This fixes #90.

Change-Id: Iad8b134d2f88a884f15d3fc303e463280749c467

9 years agolibminixfs: add support for 64-bit block numbers 55/3055/1
David van Moolenbroek [Mon, 30 Mar 2015 10:44:09 +0000 (10:44 +0000)]
libminixfs: add support for 64-bit block numbers

There are currently no devices out there that require this change.
The change is merely needed to support subsequent changes.

Change-Id: I64214c5f46ff4a2260815d15c15e4a17709b9036

9 years agoVFS: merge scratchpad into fproc 54/3054/1
David van Moolenbroek [Mon, 10 Aug 2015 22:28:00 +0000 (22:28 +0000)]
VFS: merge scratchpad into fproc

There is no reason to keep these tightly coupled data structures
separate.  Moreover, there is no reason to have a union of file
descriptor and file pointer, since the second can be derived from
the first.  The result are somewhat cleaner VFS internals.

Change-Id: I854da7d8291177878eecfc3077ef0a9e0cc82aaa

9 years agoservice(8): no need to include kernel headers 53/3053/1
David van Moolenbroek [Thu, 13 Aug 2015 13:31:21 +0000 (13:31 +0000)]
service(8): no need to include kernel headers

Change-Id: I8fb7a1a58457909b7759a74925a12cf9b11261f0

9 years agoRestore and expand NONE_MAJOR comment 52/3052/1
David van Moolenbroek [Thu, 13 Aug 2015 13:40:38 +0000 (13:40 +0000)]
Restore and expand NONE_MAJOR comment

This fixes #50.

Change-Id: I318d08e8c57c12cfd409700b14c88a90c81a1715

9 years agoetc: create system log files 51/3051/2
David van Moolenbroek [Mon, 10 Aug 2015 10:22:40 +0000 (12:22 +0200)]
etc: create system log files

The new syslogd(8) does not create log files that do not already
exist, and thus, we adopt the NetBSD way of creating them.

Change-Id: Icd7fdba362726696df6a52dd55c049fd2bfcc2d3

9 years agolwip: no need to retrieve own endpoint 50/3050/1
David van Moolenbroek [Sat, 18 Jul 2015 08:07:19 +0000 (10:07 +0200)]
lwip: no need to retrieve own endpoint

Change-Id: I86bd20be9b1aec4116edbe112eb562737860568f

9 years agoKernel: correctly set USE_ defines from Makefile 49/3049/1
David van Moolenbroek [Fri, 17 Jul 2015 21:30:17 +0000 (23:30 +0200)]
Kernel: correctly set USE_ defines from Makefile

Without defining these to 1, #if statements on them will fail.

Change-Id: Ifc4824a6ffacc4bebcfd6f1110c864d7eb16401a

9 years agolibsys: add Tomas Hruby's asynsend barrier 48/3048/1
David van Moolenbroek [Wed, 15 Jul 2015 01:10:35 +0000 (03:10 +0200)]
libsys: add Tomas Hruby's asynsend barrier

This barrier ensures that all fields of an asynchronously sent
message are properly initialized before the message is marked as
valid.

Change-Id: I7b9590c11c4e040c8f992f1dd2581e54201bf214

9 years agoKernel: fix async message failure handling crash 47/3047/1
David van Moolenbroek [Mon, 13 Jul 2015 06:14:33 +0000 (08:14 +0200)]
Kernel: fix async message failure handling crash

If an asynchronous message is delivered during an ipc_receive(2) call,
but a failure occurred while copying out the status to the sending
process, then the receiving process would be left in an inconsistent
state, leading to a kernel crash shortly after.

For now, we fix this by altogether ignoring errors while copying out
the status field to the sending process.  While this resolves the
kernel crash, it is hardly ideal, since it will likely cause the same
message to be delivered repeatedly.  It would be better to disable
asynchronous communication from the sender process altogether, but this
solution requires more changes and thus more testing.

Change-Id: Ib00bf01ad29cdd10a5dee731d4788254d9037a76

9 years agolibsys: make tickdelay(3) more reliable 46/3046/1
David van Moolenbroek [Sat, 18 Jul 2015 07:52:27 +0000 (09:52 +0200)]
libsys: make tickdelay(3) more reliable

Previously, there was a tiny chance that tickdelay(3) would return
early or that it would fail to reinstate a previous alarm.

- sys_setalarm(2) now returns TMR_NEVER instead of 0 for the time
  left if no previous alarm was set;
- sys_setalarm(2) now also returns the current time, to allow the
  caller to determine whether it got an alarm notification for the
  alarm it set or for a previous alarm that has just gone off;
- tickdelay(3) now makes use of these facilities.

Change-Id: Id4f8fe19a61ca8574f43131964e6f0317f613f49

9 years agoaudio: use standard Makefile structure 45/3045/1
David van Moolenbroek [Mon, 6 Jul 2015 11:57:19 +0000 (13:57 +0200)]
audio: use standard Makefile structure

The previous approach of including libraries through the parent
directory's Makefile.inc created linking issues, with libchardriver
not finding snprintf in certain cases.  The new approach of including
libraries through the driver's only Makefile is the one used by all
other drivers.

Change-Id: I96e6308e12e54f0fce8ecf58bd061269860d4355

9 years agoImporting bin/domainname utility 44/3044/1
Kaustubh Kelkar [Sat, 11 Jul 2015 22:53:22 +0000 (17:53 -0500)]
Importing bin/domainname utility

Change-Id: Iaf2067296195d2d55b93d00ac593b431572ca4cd

9 years agotests: resolve new compiler warnings 43/3043/1
David van Moolenbroek [Tue, 28 Jul 2015 13:24:44 +0000 (13:24 +0000)]
tests: resolve new compiler warnings

Change-Id: I57f6602a9fe9e8524f7da4320b0d1a46889b90d6

9 years agolibc: add posix_spawn family of functions 42/3042/2
Jean-Baptiste Boric [Sun, 14 Jun 2015 10:29:01 +0000 (12:29 +0200)]
libc: add posix_spawn family of functions

The implementation is taken from newlib (BSD licensed) and test84 is based
on NetBSD's t_spawn.c

Change-Id: Ia4e9dd5204a0b4ef241a451978057e11fb29e3d6

9 years agoupdate_bootcfg(8): Add actually useful information 41/3041/1
Jacob Adams [Tue, 14 Jul 2015 21:08:59 +0000 (17:08 -0400)]
update_bootcfg(8): Add actually useful information

Change-Id: I3f1aa2141827b3dc4072f2e8cedeecb40006e626

9 years agoClose #83 with fix suggested 40/3040/1
Jacob Adams [Tue, 14 Jul 2015 20:24:50 +0000 (16:24 -0400)]
Close #83 with fix suggested

Change-Id: I83975a0963d09eab73df62adf81ce8027ca41bb0

9 years agopatch(1): fix arbitrary code execution bug 39/3039/1
David van Moolenbroek [Sun, 26 Jul 2015 15:47:05 +0000 (15:47 +0000)]
patch(1): fix arbitrary code execution bug

This is the combination of two NetBSD patches committed by Christos
Zoulas, based on the findings and Bitrig patch by Martin Natano.
The NetBSD log messages read:

  From Martin Natano @bitrig: Use execve(2) instead of system to
  apply patches that require rcs command execution instead system(3)
  to avoid malicious filenames in patches causing bad things to
  happen. In the process, lose SCCS support. It is not like we are
  shipping sccs commands for that to work.

And:

  Use absolute paths for RCS commands (Martin Natano)

Change-Id: Id44bd59a5a6bc6cd95d1e1fae468bd718cfff2db

9 years agoeMMC: add support to 8-bit mode. 38/3038/1
Leonardo Fogel [Thu, 2 Jul 2015 21:45:04 +0000 (18:45 -0300)]
eMMC: add support to 8-bit mode.

Change-Id: I0470130eb5f8de319cd55c448a9aa1b9131e8e07

9 years agoImport NetBSD syslogd(8) 37/3037/2
David van Moolenbroek [Fri, 24 Jul 2015 22:09:13 +0000 (22:09 +0000)]
Import NetBSD syslogd(8)

The primary reason for the import is a likely GPL taint of the
original MINIX3 syslogd.  As a result, this import may still
have some rough edges.

Change-Id: I5c8d26eca10fc2dd50ecc9eab44a1d483cf068a9