The VM server now manages its call masks such that all user processes
share the same call mask. As a result, an update for the call mask of
any user process will apply to all user processes. This is similar to
the privilege infrastructure employed by the kernel, and may serve as
a template for similar fine-grained restrictions in other servers.
Concretely, this patch fixes the problem of "service edit init" not
applying the given VM call mask to user processes started from RC
scripts during system startup.
In addition, this patch makes RS set a proper VM call mask for each
recovery script it spawns.
Change-Id: I520a30d85a0d3f3502d2b158293a2258825358cf
Some ARM chips handle power-off with RTC alarms. PM notifies
readclock (the driver for RTCs) about the impending power-off.
If the power-off mechanism is an RTC alarm, readclock will
set the alarm. If not, there is no effect.
Change-Id: Iee00066def2a0f742cdf0dbde8e32b376edf1b78
-By adding MKGCC=yes and MKGCCCMDS=yes on the make commandline
it is now possible to compile and install GCC on the system.
Before doing this, if you are not using the build.sh script,
you will need to call the fetch scripts in order to retrieve
the sources of GCC and its dependencies.
-Reduce difference with NetBSD share/mk
Move Minix-specific parameters from bsd.gcc.mk to bsd.own.mk,
which is anyway patched, so that bsd.gcc.mk is now aligned
on the NetBSD version.
-Clean libraries dependencies, compiles stdc++ only if gcc is
also compiled (it is part of the gcc sources)
-Correct minix.h header sequence, cleanup spec headers.
-Fix cross-compilation from a 32bit host targeting MINIX/arm
Change-Id: I1b234af18eed4ab5675188244e931b2a2b7bd943
Implement getrusage.
These fields of struct rusage are not supported and always set to zero at this time
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary context switches */
test75.c is the unit test for this new function
Change-Id: I3f1eb69de1fce90d087d76773b09021fc6106539
kernel:
. modules can be as big as the space (8MB) between them
instead of 4MB; memory is slightly bigger with DBG=-g
arm ucontext:
. r4 is clobbered by the restore function, as it's
used as a scratch register, causing problems for the
DBG=-g build
. r1-r3 are safe for scratch registers, as they are
caller-save, so use r3 instead; and don't bother
restoring r1-r3, but preserve r4
vfs:
. improve TLL pointer sanity check a bit
Change-Id: I0e3cfc367fdc14477e40d04b5e044f288ca4cc7d
. unpause() and revive() can race - revive() can run during
a device i/o unblock, causing two sendnb()s to occur, and the
2nd one to fail
. this can easily happen when a process is blocking on tty and
is then killed by a signal - tty cancels the i/o and then
kills the process by a signal
Change-Id: Ia319acaedfa336b78c030a2c4af7246959bdcf87
. the default entry for disabled ttys for getty
in /etc/ttys is "", but init crashed on handling that
string.
Change-Id: Ib7cd6c6869e338f47df0aa5abed36f15eda4f6ff
. test74 for mmap functionality
. vm: add a mem_file memory type that specifies an mmap()ped
memory range, backed by a file
. add fdref, an object that keeps track of FD references within
VM per process and so knows how to de-duplicate the use of FD's
by various mmap()ped ranges; there can be many more than there can
be FD's
. turned off for now, enable with 'filemap=1' as boot option
Change-Id: I640b1126cdaa522a0560301cf6732b7661555672
. libc: add vfs_mmap, a way for vfs to initiate mmap()s.
This is a good special case to have as vfs is a slightly
different client from regular user processes. It doesn't do it
for itself, and has the dev & inode info already so the callback
to VFS for the lookup isn't necessary. So it has different info
to have to give to VM.
. libc: also add minix_mmap64() that accepts a 64-bit offset, even
though our off_t is still 32 bit now.
. On exec() time, try to mmap() in the executable if available.
(It is not yet available in this commit.)
. To support mmap(), add do_vm_call that allows VM to lookup
(to ino+dev), do i/o from and close FD's on behalf of other
processes.
Change-Id: I831551e45a6781c74313c450eb9c967a68505932
The previous test would return EFAULT as soon as the group pointer
was NULL, while it is sensible when the count is also 0.
In that case, the SETGROUP syscall is expected to clear all the
group entries as the new set is empty.
Change-Id: I07b7e1d1f023a52e3035d53f7d9b42b660e039e8
The natural term to use when talking about MINIX big pages on ARM
is SECTION. A section is a level 1 page table entry pointing to
a 1MB area.
Change-Id: I9bd27ca99bc772126c31c27a537b1415db20c4a6
libminixfs may now be informed of changes to the block usage on the
filesystem. if the net change becomes big enough, libminixfs may
resize the cache based on the new usage.
. update the 2 FSes to provide this information to libminixfs
Change-Id: I158815a11da801fd5572a8de89c9e6c039b82650
This commit introduces a new request type called REQ_BPEEK. It
requests minor device blocks from the FS. Analogously to REQ_PEEK,
it requests the filesystem to get the requested blocks into its
cache, without actually copying the result anywhere.
Change-Id: If1d06645b0e17553a64b3167091e9d12efeb3d6f
In libexec, split the memory allocation method into cleared and
non-cleared. Cleared gives zeroed memory, non-cleared gives 'junk'
memory (that will be overwritten anyway, and so needn't be cleared)
that is faster to get.
Also introduce the 'memmap' method that can be used, if available,
to map code and data from executables into a process using the
third-party mmap() mode.
Change-Id: I26694fd3c21deb8b97e01ed675dfc14719b0672b
. use lmfs_* cache functions that provide the cache with inode
metadata whenever applicable, i.e. tell the cache code which
inode number and in-inode offset a particular cache block
corresponds to.
. needed for mmap implementation
Change-Id: Ic7d3c0c49029880f86a31368278722e907bc2896
Primary purpose of change: to support the mmap implementation, VM must
know both (a) about some block metadata for FS cache blocks, i.e.
inode numbers and inode offsets where applicable; and (b) know about
*all* cache blocks, i.e. also of the FS primary caches and not just
the blocks that spill into the secondary one. This changes the
interface and VM data structures.
This change is only for the interface (libminixfs) and VM data
structures; the filesystem code is unmodified, so although the
secondary cache will be used as normal, blocks will not be annotated
with inode information until the FS is modified to provide this
information. Until it is modified, mmap of files will fail gracefully
on such filesystems.
This is indicated to VFS/VM by returning ENOSYS for REQ_PEEK.
Change-Id: I1d2df6c485e6c5e89eb28d9055076cc02629594e
Memory types in VM are described by methods. Each mapped region has
a type, and all pages instantiated get that type on creation.
Individual page types has to be able to change though. This commit
changes the code to use the memory types of the individual pages,
where appropriate, instead of just the higher-level region, in case
it has changed. This is needed to e.g. support future copy-on-write
MAP_PRIVATE mmap modes.
Change-Id: I5523db14ac036ec774a54392fb67f9acb8725731
Some (backwards-compatible) changes in mmap() call message fields
that allow for a 64-bit offset. minix_mmap() takes an off_t and
minix_mmap64() takes a u64_t. Some mmap() work in VM goes into a
separate function, using the new fields, so that that can be re-used
when files are to be mapped (future commit).
Change-Id: Ifb77a90b593dd3c33cf81b396068e4da1ec5fb1c
The filesystems already implement REQ_PEEK, but do not fully
use the new filesystem cache code yet. (Because it isn't committed
yet..) REQ_PEEK should be disabled for them until they do.
This indicates to VFS that they are not annotating their cache
blocks (in VM) with inode number/offset info, and therefore mmap()
shouldn't succeed on any of their files. (Most importantly exec()
won't fallback elegantly otherwise.)
Change-Id: Ic57ee422864b4bbc031eadba32973270907b02fd
This commit removes the secondary cache code implementation from
VM and its usage from libminixfs. It is to be replaced by a new
implementation.
Change-Id: I8fa3af06330e7604c7e0dd4cbe39d3ce353a05b1
. test70: regression test for m_out vfs race condition
The following tests use testcache.c to generate test i/o
patterns, generate random write data and verify the reads.
. test71: blackbox full-stack test of FS operation, testing
using the regular VFS interface crazy i/o patterns
with various working set sizes, triggering only
primary cache, also secondary cache, and finally
disk i/o and verifying contents all the time
. test72: unit test of libminixfs, implementing
functions it needs from -lsys and -lblockdriver
and the client in order to simulate a working
cache client and backend environment.
. test73: blackbox test of secondary vm cache in isolation
Change-Id: I1287e9753182b8719e634917ad158e3c1e079ceb
. vfs read_only() assumes vnode->v_vmnt is non-NULL, but it can
be NULL sometimes
. e.g. fchmod() on UDS triggered NULL deref; add a check and
add REQ_CHMOD to pfs so unix domain sockets can be fchmod()ded
. add to test56
Change-Id: I83c840f101b647516897cc99fcf472116d762012
m_out is shared between threads as the reply message, and it can happen
results get overwritten by another thread before the reply is sent. This
change
. makes m_out local to the message handling function,
declared on the stack of the caller
. forces callers of reply() to give it a message, or
declare the reply message has no significant fields except
for the return code by calling replycode()
Change-Id: Id06300083a63c72c00f34f86a5c7d96e4bbdf9f6
Variant of utime(2) with struct timespec (with ns precision)
instead of time_t values; also allows for tv_nsec members
the values UTIME_NOW (force update to current time) or
UTIME_OMIT (allow to set either atim or mtim independently.)
Provides a superset of utimes(2), futimes(2), lutimes(2),
and futimens(2).
Provides the same subset of utimensat(2) as does NetBSD 6.
Also import utimens() and lutimeNS() from NetBSD-current.
makes lwip use "unsigned int" instead of "unsigned" since this is
more obvious (i.e. type is not implied).
Change-Id: I852eb80484516e1235241d55be3e15174fa24109
. inet: silence message about exceptions not being implemented
for select(UDP)
This message generates a lot of noise with openntpd. Hide it unless DEBUG is
turned on.
Change-Id: I1527a9ca2583601d6087456062b4f675c80dd711
This also adds the sys_settime() kernel call which allows for the adjusting
of the clock named realtime in the kernel. The existing sys_stime()
function is still needed for a separate job (setting the boottime). The
boottime is set in the readclock driver. The sys_settime() interface is
meant to be flexible and will support both clock_settime() and adjtime()
when adjtime() is implemented later.
settimeofday() was adjusted to use the clock_settime() interface.
One side note discovered during testing: uptime(1) (part of the last(1)),
uses wtmp to determine boottime (not Minix's times(2)). This leads `uptime`
to report odd results when you set the time to a time prior to boottime.
This isn't a new bug introduced by my changes. It's been there for a while.
In order to make it more clear that ticks should be used for timers
and realtime should be used for timestamps / displaying the date/time,
getuptime() was renamed to getticks() and getuptime2() was renamed to
getuptime().
Servers, drivers, libraries, tests, etc that use getuptime()/getuptime2()
have been updated. In instances where a realtime was calculated, the
calculation was changed to use realtime.
System calls clock_getres() and clock_gettime() were added to PM/libc.
. data structure that automatically keeps a set
of pages in reserve, to replace sparepages and
possibly re-used in the future for similar situations,
e.g. if in-filesystem-cache block eviction is
implemented and FS asks for a new block
Change-Id: I149d46c14b9c8e75df16cb94e08907f008c339a6
When you provided a string with junk after the terminating nul to a
UNIX domain socket and used bind(2), the canonical path function would
not properly terminate the new string. This caused VFS to return
ENAMETOOLONG on an otherwise valid path name.
Test case is added to test56.
Change-Id: I883b6be23d9e4ea13c3cee28cbb3726343df037f
Do not hardcode warning and optimisation flags, otherwise the
main options (i.e. DBG, CPPFLAGS) will not work as expected.
You can still provide specific default by using DBG?=<value>.
Doing so leaves the opportunity to override the setting from the
commandline, while the default value from the build system is
then ignored for that particular package.
When crosscompiling, and using build.sh, adding -V DBG=<value> has
this same effect as make DBG=<value>.
Change-Id: Ic610e4d33b945acad64571e1431f1814291e2d84
REQ_PEEK behaves just like REQ_READ except that it does not copy
data anywhere, just obtains the blocks from the FS into the cache.
To be used by the future mmap implementation.
Change-Id: I1b56de304f0a7152b69a72c8962d04258adb44f9
Select(2)ing on UNIX domain sockets was not working properly because
connection state wasn't properly checked/propagated. So selecting for
a read descriptor and closing the write descriptor on the other end
didn't cause select to return. Similarly, read(2) kept blocking while
it should return an error when the other end closed the socket.
Change-Id: I3f5bb52af1a6b03313d508bf915fc838357ba450
. if there is no memory there, it's not writable; this
check bug by the shared memory's writable() method causes
pagefaults not to be handled at all in certain situations,
triggering an assert() in pt_writemap()
. added some assert()s to catch this and similar situations
in the future
Change-Id: Ife89bfab4f9a3aa7bf4e33dfb0b13b89dcd5bb94
The build system distinction between "bootprog" and "service" is
meaningless as boot programs are standard services.
As minix.service.mk simply imports minix.bootprog.mk, reduce confusion
by removing minix.bootprog.mk and placing the rules in minix.service.mk.
Change-Id: I4056b1e574bed59a8c890239b41b1a7c7cad63e8
Remove old versions of system calls and system calls that don't have
a libc api interface anymore (dup, dup2, creat).
VFS still contains support for old system call numbers for the new stat
system calls (i.e., 65, 66, 67) to keep supporting old binaries built for
MINIX 3.2.1 (prior to the release).
Change-Id: I721779b58a50c7eeae20669de24658d55d69b25b
When a service fails to initialize, RS exits the service. When injecting
faults this is undesired behavior. With this patch, we're going to assume
that when starting services with the -b flag (no binary exponential
offset), we don't want to exit the service but simply restart the
initialization.
Change-Id: Ie8b9c89e16fe4df8a89ec30ec678a216b4ec5fd0
libchardriver does not support DEV_REOPEN and will return ERESTART
when you do try it. This made VFS unhappy and concluded erroneously
that the driver was EDEADEPT.
. the total amount of memory in the system didn't include the memory
used by the boot-time modules and some dynamic allocation by the
kernel at boot time (to map in VM). especially apparent on our
ARM board with 'only' 512MB of memory and a huge ramdisk.
. also: *add* the VM loaded module to the freelist after it has
been allocated for & mapped in instead of cutting it *out* of the
freelist! so we get a few more MB free..
Change-Id: If37ac32b21c9d38610830e21421264da4f20bc4f
. allow any number of pde's used for pagedir mapping
. allows >1024 NR_PROCS on x86, >64 on ARM
. allows NR_PROCS to be the same in both cases
. also cleanup: allocating spare PDE's is not necessary
throw that function out
Change-Id: Ibb8f8cf6e7db6a4d6384b6911d1a3f3f5e5d8256
if an exec() fails partway through reading in the sections, the target
process is already gone and a defunct process remains. sanity checking
the binary beforehand helps that.
test10 mutilates binaries and exec()s them on purpose; making an exec()
fail cleanly in such cases seems like acceptable behaviour.
fixes test10 on ARM.
Change-Id: I1ed9bb200ce469d4d349073cadccad5503b2fcb0
The 'polarity' of the RW bit is inversed on ARM, causing one
of the sanity check compensations to fail. ARM now runs basic
stuff with sanity checks passing.
Change-Id: Iee28ab63e430e759f204eeb204b24c301d5ea3c9
. make vm tell kernel virtual locations of mappings
. makes _minix_kerninfo feature work
. fix for mappings being larger than what 1 pde can address
(e.g. devices memory requested on arm)
. still requires a special case for devices memory for the
kernel, which has to switch to virtual addressing
Change-Id: I2e94090aa432346fa4da0edeba72f0b7406c2ad7
Due to the ABI we are using we have to use the earm architecture
moniker for the build system to behave correctly. This involves
then some headers to move around.
There is also a few related Makefile updates as well as minor
source code corrections.
Fix warnings about:
. Unused variables
. format mismatch in printf/scanf format string and arguments
. Missing parenthesis around assignment as truth values
. Clang warnings anout unknown GCC pragma