Commit graph

257 commits

Author SHA1 Message Date
Jean-Baptiste Boric 9f988b7934 Import makefs from NetBSD
Change-Id: I0ebcc9d0168df9d26cfb0af0fce2bc894ce688af
2015-10-07 12:39:44 +02:00
Jean-Baptiste Boric 22ad44d6a9 libutil: add getmaxpartitions() implementation
Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9
2015-10-07 12:36:36 +02:00
David van Moolenbroek d1e4d7ce7d Import NetBSD csh(1)
Jobctl warning commented out.  Largely untested.

Change-Id: I4dffe23a2855a374628c820703b51591633aed64
2015-09-29 18:15:52 +00:00
David van Moolenbroek b80da2a01d commands: move manpages into command directories
Change-Id: Icf8a2d26629a1822725022c9ee21c587d3c4c3b4
2015-09-28 14:06:06 +00:00
David van Moolenbroek 9488aa4c04 Import NetBSD flock(1)
Also fix the MINIX3 libc flock(3) implementation.

Change-Id: Ia80280029968786d7f029940ec02e942057701bd
2015-09-23 12:03:13 +00:00
David van Moolenbroek fd962fdd93 Retire decomp16(1)
Change-Id: I455aac47b3efa4ffa5cc8305c6760f92e1e8642a
2015-09-23 12:03:11 +00:00
David van Moolenbroek c0d9ad695c Retire ci(1), co(1), svclog(1)
Change-Id: I1bd1d92b9aacd4dfc4843c423862ae540fe2b557
2015-09-23 12:03:10 +00:00
David van Moolenbroek 33513d60e9 fbdctl(8): move to proper location
- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: I1206b52e8804a68a3a80f6d7f63916e7fcdc9e3f
2015-09-23 12:03:10 +00:00
David van Moolenbroek c175cce5e6 diskctl(8): move to proper location
- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: Iccb4a8b27ae220254bae19e9198478b40706f542
2015-09-23 12:03:09 +00:00
David van Moolenbroek 964427e0ea btrace(8): move to proper location
- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: I08c16998bd499a468799a6587f6fe45f42590461
2015-09-23 12:03:09 +00:00
David van Moolenbroek 040ec64444 libfetch: switch to external/bsd version
Change-Id: I7eb6fbf0ae6c008e399fe9bffdfc2b98dfed3432
2015-09-23 12:03:08 +00:00
David van Moolenbroek 93d36fc9d8 Import NetBSD rcmd, rcp, rsh, rshd
Change-Id: I83d908bbe17f04826e9b5c3a220a5bb2c3a51c80
2015-09-23 12:03:06 +00:00
David van Moolenbroek e4d99eb9b0 Basic live rerandomization infrastructure
This commits adds a basic infrastructure to support Address Space
Randomization (ASR).  In a nutshell, using the already imported ASR
LLVM pass, multiple versions can be generated for the same system
service, each with a randomized, different address space layout.
Combined with the magic instrumentation for state transfer, a system
service can be live updated into another ASR-randomized version at
runtime, thus providing live rerandomization.

Since MINIX3 is not yet capable of running LLVM linker passes, the
ASR-randomized service binaries have to be pregenerated during
crosscompilation.  These pregenerated binaries can then be cycled
through at runtime.  This patch provides the basic proof-of-concept
infrastructure for both these parts.

In order to support pregeneration, the clientctl host script has
been extended with a "buildasr" command.  It is to be used after
building the entire system with bitcode and magic support, and will
produce a given number of ASR-randomized versions of all system
services.  These services are placed in /usr/service/asr in the
image that is generated as final step by the "buildasr" command.

In order to support runtime updating, a new update_asr(8) command
has been added to MINIX3.  This command attempts to live-update the
running system services into their next ASR-randomized versions.
For now, this command is not run automatically, and thus must be
invoked manually.

Technical notes:

- For various reasons, magic instrumentation is x86-only for now,
  and ASR functionality is therefore to be used on x86 only as well.
- The ASR-randomized binaries are placed in numbered subdirectories
  so as not to have to change their actual program names, which are
  assumed to be static in various places (system.conf, procfs).
- The root partition is typically too small to contain all the
  produced binaries, which is why we introduce /usr/service.  There
  is a symlink from /service/asr to /usr/service/asr for no other
  reason than to let userland continue to assume that all services
  are reachable through /service.
- The ASR count field (r_asr_count/ASRcount) maintained by RS is not
  used within RS in any way; it is only passed through procfs to
  userland in order to allow update_asr(8) to keep track of which
  version is currently loaded without having to maintain own state.
- Ideally, pre-instrumentation linking of a service would remove all
  its randomized versions.  Currently, the user is assumed not to
  perform ASR instrumentation and then recompile system services
  without performing ASR instrumentation again, as the randomized
  binaries included in the image would then be stale.  This aspect
  has to be improved later.
- Various other issues are flagged in the comments of the various
  parts of this patch.

Change-Id: I093ad57f31c18305591f64b2d491272288aa0937
2015-09-17 17:15:03 +00:00
Cristiano Giuffrida c8a9900b0c kernel: Add support for IPC filters.
Edited by David van Moolenbroek.

Change-Id: Ia0052c42a0f218d011dd2da1e3db6c5b2107adc7
2015-09-16 11:02:24 +00:00
David van Moolenbroek 56ac45c10b 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
2015-08-31 12:55:55 +00:00
David van Moolenbroek 6c46a77d95 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
2015-08-14 18:39:26 +00:00
David van Moolenbroek a6fc634735 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
2015-08-10 11:38:16 +00:00
Kaustubh Kelkar 989398b447 Importing bin/domainname utility
Change-Id: Iaf2067296195d2d55b93d00ac593b431572ca4cd
2015-07-28 21:56:19 +00:00
Jean-Baptiste Boric 1facb0487c 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
2015-07-28 14:18:03 +00:00
David van Moolenbroek 3e07920fe2 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
2015-07-26 11:57:04 +00:00
Erik van der Kouwe c97d4ff6e5 test83: add test to send strange/wrong UDP and TCP packets
Change-Id: I73444d2753adab140a4f8e6bee2db32282044888
2015-07-22 22:25:09 +02:00
David van Moolenbroek 6d315cbf9e benchmarks: remove unixbench
This code appears to be GPL-licensed and thus does not belong in
the MINIX3 source tree.

Change-Id: I9e88c3ffd8eae8697b629899dba9728863a4413a
2015-07-20 11:05:28 +00:00
Erik van der Kouwe 86e41e22cf Add test82 (HTTP)
This test connects to a remote HTTP server to retrieve files, using various
chunk sizes and concurrency settings to exercise the network stack. The test
is only performed is USENETWORK=yes. This test requires the following URLs to
remain available: http://test82.minix3.org/test1.txt and
 http://test82.minix3.org/test2.bin. The former contains a 'Hello world'
message followed by a newline, the latter all 16-bit values in increasing
order, using big-endian notation.

Change-Id: I696106482fb1658f9657be2b6845a1b37a3d6172
2015-07-08 09:54:56 +02:00
Erik van der Kouwe 294d159017 Add new tests 80 (TCP) and 81 (UDP)
These new tests are largely based on the code from test 56 (UDS). Common code
is moved into a separate file common-socket.c. In some instances the tests
are too strict for TCP/UDP sockets, which may not always react instantly to
whatever happens on the other side (even locally). For these cases, the
ignore_* fields in struct socket_test_info indicate that there needs to be
an exception. There are also tests where it seems the functionality of inet
is either incorrect or incomplete with regard to the POSIX standard. In these
cases, the bug_* fields are used to document the issues while avoiding
failure of the test.

Change-Id: Ia860deb4559d42608790451936b1aade866faebc
2015-07-08 09:46:56 +02:00
David van Moolenbroek da21d85025 Add PTYFS, Unix98 pseudo terminal support
This patch adds support for Unix98 pseudo terminals, that is,
posix_openpt(3), grantpt(3), unlockpt(3), /dev/ptmx, and /dev/pts/.
The latter is implemented with a new pseudo file system, PTYFS.

In effect, this patch adds secure support for unprivileged pseudo
terminal allocation, allowing programs such as tmux(1) to be used by
non-root users as well.  Test77 has been extended with new tests, and
no longer needs to run as root.

The new functionality is optional.  To revert to the old behavior,
remove the "ptyfs" entry from /etc/fstab.

Technical nodes:

o The reason for not implementing the NetBSD /dev/ptm approach is that
  implementing the corresponding ioctl (TIOCPTMGET) would require
  adding a number of extremely hairy exceptions to VFS, including the
  PTY driver having to create new file descriptors for its own device
  nodes.

o PTYFS is required for Unix98 PTYs in order to avoid that the PTY
  driver has to be aware of old-style PTY naming schemes and even has
  to call chmod(2) on a disk-backed file system.  PTY cannot be its
  own PTYFS since a character driver may currently not also be a file
  system.  However, PTYFS may be subsumed into a DEVFS in the future.

o The Unix98 PTY behavior differs somewhat from NetBSD's, in that
  slave nodes are created on ptyfs only upon the first call to
  grantpt(3).  This approach obviates the need to revoke access as
  part of the grantpt(3) call.

o Shutting down PTY may leave slave nodes on PTYFS, but once PTY is
  restarted, these leftover slave nodes will be removed before they
  create a security risk.  Unmounting PTYFS will make existing PTY
  slaves permanently unavailable, and absence of PTYFS will block
  allocation of new Unix98 PTYs until PTYFS is (re)mounted.

Change-Id: I822b43ba32707c8815fd0f7d5bb7a438f51421c1
2015-06-23 17:43:46 +00:00
Leonardo Fogel 07cbc27cb0 Add a driver for the eMMC on the BeagleBone Black
Change-Id: I30ab36ac048c65538718e372db9502fb8f51d41f
2015-06-21 11:04:16 +00:00
Jacob Adams be4841096d Add manpage for sprofdiff
Change-Id: Ifa98ab133ef818d21921f05db650069448ea52ff
2015-05-18 13:52:13 +02:00
Jacob Adams 2a6b817353 Add manpage for sprofalyze
Change-Id: I206a5878e8f788ea4ff742453148462959263a6a
2015-05-18 13:41:29 +02:00
Jacob Adams c19d619d42 Importing bin/dd
Change-Id: Ibdfed821aa834419c9713dc80f698c8ed74ff269
2015-04-15 13:50:57 +02:00
Jacob Adams 9cf6cc5098 Import games/caesar and games/rot13
Change-Id: Ib6b074c6c525ee817b9182b17a06ae18851f5afe
2015-04-15 09:47:27 +02:00
Jacob Adams f1489796fd Add games/banner
Change-Id: Ib4a002422d668d8aa5cf0e7171ea430ef630eeff
2015-04-15 09:47:23 +02:00
Jacob Adams eb95f895b2 Import games/rain
Change-Id: Ifc9a9d69795e3281f62c3c3438622ce74994b8b0
2015-04-15 08:33:52 +02:00
Thomas Cort fc850d580c man: clean-out man1x category.
Removes the following man pages:

* awk.1x -- for a version of awk we no longer have
* kermit.1x -- seems gone altogether
* macros.1x -- not useful for anyone anymore

Moves the following man pages:

* mined.1x -- Moved to minix/commands/mined/mined.1
and reformatted to use the mdoc macros instead of the
Minix macros so that it displays properly.

Removes /usr/man/man1x from the directory tree.

closes #44

Change-Id: I59b8bd54cf5cba6d188e51e99a92b36e90c275c1
2015-03-25 06:53:44 +01:00
Jacob Adams d82c151c9e commands/fix: create manpage for fix(8)
Change-Id: I868f1338994d6cc2cba6789b9b4e8934610d0142
2015-03-24 08:21:14 +01:00
Robin Karlsson e3b78ef14f Import NetBSD games/rogue
Change-Id: Id4aef4950f250edef2d507910877aabc6b9580ea
2015-03-14 14:59:16 +01:00
Ben Gras 5ae1a533c7 ARM: can build with llvm, switch to EABI
. bitcode fixes
	. switch to compiler-rt instead of netbsd libc functions
	  or libgcc for support functions for both x86 and arm
	. minor build fixes
	. allow  build with llvm without crossbuilding llvm itself
	. can now build minix/arm using llvm and eabi - without C++
	  support for now (hence crossbuilding llvm itself is turned off
	  for minix/arm)

Change-Id: If5c44ef766f5b4fc4394d4586ecc289927a0d6eb
2014-12-12 13:04:56 +01:00
Lionel Sambuc 41ba8c04cc Restart policies: Add testing and ProcFS DB
- Expose in procfs the service status and supported recovery policies.
 - This adds a test (testrelpol.sh) to exercise the restart policies of
   the system services and drivers.

NOTE:
  The policy support information is temporarily hardcoded in ProcFS, but
  this has to be replaced by properly retrieving this information from
  RS, which should in turn be setup on a per service basis, at
  initialization time.

Change-Id: I0cb1516a450355b38d0c46b1a8b3d9e841a2c029
2014-12-10 23:11:25 +01:00
Lionel Sambuc 0805ab8cfd Import a few manpages
The following manpages where contributed by
Jacob Adams <tookmund@gmail.com>:
 - atnormalize.8
 - autopart.8
 - decomp16.1
 - devsize.8
 - rawspeed.8
 - rotate.8
 - update_bootcfg.8
 - updateboot.8

Change-Id: Ide3abf0962083b83e37426e2d47f3a9391d6315e
2014-11-25 11:04:20 +01:00
Lionel Sambuc 957802cd0c Import NetBSD shell environment files
With the import of Xorg, a proper separation between login-time and sub
shell-time of the environment setup is necessary.

Instead of re-developping this from scratch, I am taking the opportunity
to import the NetBSD default environment.

Change-Id: Ib6a8fbd9c2f407ccd59be57a52ef9df21c2c9ce7
2014-11-10 16:48:56 +01:00
Lionel Sambuc 971bb1a587 Importing external/mit/xorg support rules
Change-Id: Ib11d8659485a444797bf3a2118182a1d4e316b50
2014-11-10 14:43:29 +01:00
Lionel Sambuc 1230fdc108 external/mit/expat: Import
Change-Id: Ieb49357166b392956df6554a06fcae83c8fd519d
2014-11-10 14:43:28 +01:00
Lionel Sambuc 5d8311761a Turn PCI into a character driver
Change-Id: Ia9c83af4d52e82e845b6a847c3e82e33d1920ae0
2014-11-10 14:43:27 +01:00
Lionel Sambuc 7eb99bda90 Importing lib/libpci
Change-Id: I21ae1e409286cec27c5e35677de3778a3f505d1e
2014-11-07 16:20:39 +01:00
David van Moolenbroek 521fa314e2 Add trace(1): the MINIX3 system call tracer
Change-Id: Ib970c8647409196902ed53d6e9631a1673a4ab2e
2014-11-04 21:46:31 +00:00
David van Moolenbroek eda6f5931d Import tmux
We have to use SOCK_SEQPACKET instead of SOCK_STREAM for client/server
communication, because UDS does things with control messages that tmux
does not expect.

Change-Id: I3edb1875d61fb976cf6485c650f4fd4b82fa354c
2014-10-03 10:01:08 +00:00
David van Moolenbroek e985b92992 Import libevent
Change-Id: Ic75f4cac5eb07ffaba8f97d10673d7d7e2b1762d
2014-10-03 10:00:53 +00:00
David van Moolenbroek 1dcfbcd173 Remove support for call profiling
The entire infrastructure relied on an ACK feature, and as such, it
has been broken for years now, with no easy way to repair it.

Change-Id: I783c2a21276967af115a642199f31fef0f14a572
2014-09-30 12:39:03 +00:00
AndrewEdwards e3fd605f72 Create new colemak minix keymap.
Change-Id: I3464e723bd6bb578f415dfe78540e60b2eefb8b7
2014-09-29 00:39:25 +02:00
Ben Gras 0d9602e04b Import NetBSD legal/COPYRIGHT.
Change-Id: Ic23e5f1902ade92402faa968bb945b7d873aaf6b
2014-09-28 16:28:05 +02:00
Alexandre Beletti 6a76678e59 Import NetBSD games/fish command.
Change-Id: Ie3009121c768fa5e0c50c681b87cde344ae7cfe2
2014-09-25 02:03:28 +02:00