Thomas Veerman [Mon, 13 Feb 2012 12:02:12 +0000 (12:02 +0000)]
libmthread: add guard pages to stacks
Add guard pages to the top of the stack to catch overflow errors.
Moreover, fix a bug where libmthread would keep using a stack that was
just deallocated; a detached thread would deallocate its own stack after
it was finished running).
Antoine Leca [Tue, 17 Jan 2012 15:08:40 +0000 (16:08 +0100)]
writeisofs: also boots plain binaries with -B
With -n -b file, a.out boot images can be used for CD booting;
with the new -n -B file option, plain binary (like bootxx_cd9660)
can be used instead.
Restore working the -h and -f options while there.
And add a new -F option for 2.8MB floppy image.
Antoine Leca [Fri, 3 Feb 2012 10:24:48 +0000 (11:24 +0100)]
writeisofs: improve compatibility
Register file timestamps
Remember the path tables in the primary descriptor
Put the size of the parent directory in the \1 entry, not own size
Allow the use of -b option without -a
Notes:
* Still missing the man page
* Filenames are still trimmed to 12 characters, because of
8.3 MS-DOS inherited compatibility (ISO9660 level 1);
also note that 7.4 or 9.2 filenames are accepted though
* Final . at end of filenames without extension is still missing
* VMS-compatible ;1 version suffix is still omitted
* Limit of 65,535 directories in path tables is not checked
Evgeniy Ivanov [Tue, 31 Jan 2012 11:48:14 +0000 (15:48 +0400)]
Allow human readable name for the root device.
Instead of using rootdev= or ramimagedev= in the boot monitor
which are changed to numbers and cannot be used with other
loaders, rootdevname= or ramimagename= are (MINIX-style)
device names always stored as strings.
Evgeniy Ivanov [Mon, 30 Jan 2012 12:27:23 +0000 (16:27 +0400)]
Rotate kernels/images/modules.
Kernels and system services are stored in a single directory in the
/boot/minix/ and rotated like /boot/images. /boot/minix_latest slink
is created automatically.
System serives are prefixed by "modNN_" to allow to easily load them
using "mod*" pattern.
Evgeniy Ivanov [Wed, 25 Jan 2012 12:29:07 +0000 (16:29 +0400)]
Remove libkern, leave just header.
Boot stuff dependencies from NetBSD.
Patch by Antoine Leca. Relocated to src/sys.
The port is using the same libminc.a as usual MINIX services (and does
not use NetBSD libkern); the headers imported from NetBSD sys/ tree
have been kept to a minimum (still numbers higher than 30 though.)
Note the peculiar way to use libraries (libsa, libi386, etc.): the
source code is shared, but each component builds its own copy of the
library, with its own set of preprocessor defines.
Thomas Veerman [Thu, 9 Feb 2012 14:24:28 +0000 (14:24 +0000)]
AVFS: fix various system call interruption issues
- When cancelling ioctls, VFS did not remember which file descriptor
to cancel and sent bogus to the driver.
- Select state was not cleaned up when select()ing process was
interrupted.
- Process trying to do a system call at the exact same time as a user
trying to interrupt the process, could cause the system call worker
thread to overwrite state belonging to the worker thread trying to
exit the process. This led to hanging threads and eventual system hang
when this happens often enough.
Thomas Veerman [Wed, 1 Feb 2012 11:34:40 +0000 (11:34 +0000)]
AVFS: only put mount point when it was used as one
When a mount operation fails and the FS exits, free_proc could try and
clean up resources associated with the mount point before the mount
thread itself can do that. However, the clean up procedure should only
clean up resources that were actually in use.
Thomas Veerman [Fri, 27 Jan 2012 11:50:11 +0000 (11:50 +0000)]
PM: extend srv_fork to set a specific UID
Currently, all servers and drivers run as root as they are forks of
RS. srv_fork now tells PM with which credentials to run the resulting
fork. Subsequently, PM lets VFS now as well.
This patch also fixes the following bugs:
- RS doesn't initialize the setugid variable during exec, causing the
servers and drivers to run setuid rendering the srv_fork extension
useless.
- PM erroneously tells VFS to run processes setuid. This doesn't
actually lead to setuid processes as VFS sets {r,e}uid and {r,e}gid
properly before checking PM's approval.
Tomas Hruby [Thu, 26 Jan 2012 11:39:40 +0000 (11:39 +0000)]
SMP - clock calibration spurious IRQ deadlock fix
- this patch fixes a deadlock which may occur if we get a
spurious interrupt while calibrating clocks during the boot
time. Since we never handle interrupts while in the kernel
(BKL locked) the interrupt code locks the lock. This is a
different situation, a corner case, boot time only. We do not
return to userspace but to the kernel, so the BKL is not
unlocked. So we need irq handler which leaves the BKL
unlocked. The clock handler does it already, this patch adds
a dummy spurious irq handler for the same reason. It is better
to handle the situation this way to keep the normal runtime
code simple.
Thomas Veerman [Thu, 19 Jan 2012 14:21:46 +0000 (14:21 +0000)]
Add support for survival of crashed FSs
When an FS crashes, VFS will clean up resources tied to that FS:
- Pending requests to the FS are canceled (i.e., fail with EIO)
- Threads waiting for a reply are stopped (i.e., fail with EIO)
- Open files are marked invalid. Future operations on a file descriptor
will cause EBADF errors.
- vmnt entry is cleared, so in-flight system calls that got past the
file descriptor check but not yet talking to the crashed FS, will
fail with EIO.
- The reference counter of the mount point is decreased, effectively
removing the crashed FS from the file system tree. Descendants of
this part of the tree are unreachable by means of a path, but can
still be unmounted by feeding the block special file to unmount(2).
This patch also gets rid of the "not a known driver endpoint" messages
during shutdown.
Thomas Veerman [Mon, 16 Jan 2012 11:42:29 +0000 (11:42 +0000)]
Use correct value for _NSIG
User processes can send signals with number up to _NSIG. There are a few
signal numbers above that used by the kernel, but should explicitly not
be included in the range or range checks in PM will fail.
The system processes use a different version of sigaddset, sigdelset,
sigemptyset, sigfillset, and sigismember which does not include a range
check on signal numbers (as opposed to the normal functions used by normal
processes).
This patch unbreaks test37 when the boot image is compiled with GCC/Clang.
Thomas Veerman [Thu, 12 Jan 2012 11:32:31 +0000 (11:32 +0000)]
AVFS: Return actual last dir when path is named by a symlink
Last_dir didn't consider paths that end in a symlink and hence didn't
actually return the last_dir when provided with one. For example,
/var/log is a symlink to /usr/log. Issuing `>/var/log' would trigger
an assert in AVFS, because /var/ is not the actual last directory; /usr/
is.
Last_dir now verifies the final component is not a symlink. If it is, it
follows the symlink and restarts finding of the last the directory.
Tomas Hruby [Tue, 25 Oct 2011 18:32:30 +0000 (18:32 +0000)]
SMP - asyn send SMP safe
- we must not deliver messages from/to unstable address spaces.
In such a case, we must postpone the delivery. To make sute
that a process which is expecting an asynchronous message does
not starve, we must remember that we skipped delivery of some
messages and we must try to deliver again once the source
address space is stable again.
Tomas Hruby [Wed, 26 Oct 2011 15:43:36 +0000 (15:43 +0000)]
SMP - fixed IPI livelock
- two CPUs can issue IPI to each other now without any hazzard
- we must be able to handle synchronous scheduling IPIs from
other CPUs when we are waiting for attention from another one.
Otherwise we might livelock.
Antoine Leca [Mon, 26 Dec 2011 16:33:18 +0000 (17:33 +0100)]
Allow clang for kernel compilation
Remove .ident sections, and force separations of .text and
.data sections into separate program headers, for the benefit
of the check done by MINIX boot monitor in multiboot mode.