Commit graph

1236 commits

Author SHA1 Message Date
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
David van Moolenbroek
22840dea11 libfsdriver: preinitialize stat.st_ino
The stat.st_ino field must always be filled with the inode number
given as part of the fdr_stat request anyway, so libfsdriver can
simply fill in the number and allow the file system not to bother.

Change-Id: Ia7a849d0b23dfc83010df0d48fa26e4225427694
2015-06-23 14:38:04 +00:00
David van Moolenbroek
af4345b097 isofs: do not link against libc
This change requires a small patch to libc, in order to avoid that
libminc has to pull in a large chunk of libc just for mktime(3).

Change-Id: I48e598b3716eff626cac461f78a41e32334e6b28
2015-06-07 17:01:45 +00:00
Emmanuel Blot
4f89addcc1 Fix unused variable warnings
Do not define variables that are not used in Minix builds

Change-Id: I11d12e5e1de9fc359b71a7e7534fc8f09fac837d
2015-03-18 07:49:03 +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
David van Moolenbroek
289b04677a libfsdriver: prefill st_dev for stat requests
This obviates the need for several file system implementations to
remember the device on which they are mounted.

Change-Id: Ida8325cf4bcf072e61761cfee34e3f7ed2d750b9
2014-11-14 15:54:16 +00:00
Lionel Sambuc
1230fdc108 external/mit/expat: Import
Change-Id: Ieb49357166b392956df6554a06fcae83c8fd519d
2014-11-10 14:43:28 +01:00
Lionel Sambuc
7eb99bda90 Importing lib/libpci
Change-Id: I21ae1e409286cec27c5e35677de3778a3f505d1e
2014-11-07 16:20:39 +01:00
David van Moolenbroek
5d259c7f93 libc: enable setproctitle(3)
Change-Id: I31bbc5d960c60f7347424ce3d8f4bce89b396339
2014-10-03 10:01:03 +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
David van Moolenbroek
ad80a203db Move clock_time into libsys
Change-Id: Ibc5034617e6f6581de7c4a166ca075b3c357fa82
2014-09-18 12:46:26 +00:00
David van Moolenbroek
81db4f2cff libpuffs: use libfsdriver
Change-Id: I26651578066e1098dc275a9cfbe5710870a13811
2014-09-18 12:46:25 +00:00
David van Moolenbroek
89c9de7d09 Add libfsdriver: a library to drive file systems
This library provides new abstractions for the upper (VFS) side of
file system services, and should be used for all file system service
implementations from now on.  It provides the following functionality:

  - a function call table abstraction, hiding the details of the
    VFS-FS protocol with simple parameters;
  - a (currently limited) number of per-function steps required for
    all file system implementations, such as copying in and out path
    names and result buffers;
  - a default implementation for multicomponent path lookups, such
    that the file system merely has to implement resolution of single
    components at a time;
  - an abstraction for copying data from and to the file system, which
    allows transparent intraprocess copying as required for the lookup
    implementation;
  - a set of functions to simplify getdents implementations.

The message loop provided by the library is currently for use by
single-threaded file system implementations only.  Multithreaded file
system services may use the more low-level message processing
functionality.

Protocol-level optimizations such as including names in protocol
messages may be hidden entirely in this library.  In addition, in the
future, the lookup implementation may be replaced by a single-
component lookup VFS/FS protocol request as part of a VFS name cache
implementation; this, too, can be hidden entirely in this library.

Change-Id: Ib34f0d0e021dfa3426ce8826efcf3eaa94d3ef3e
2014-09-18 12:46:23 +00:00
Lionel Sambuc
31b808b8fa Drop minix-malloc & friends
Known limitations:
 - comment for now testisofs, as iso9660fs is known to be broken.

Benefits:
 - near 3x speed improvement on C++ code compilation, bringing down
   make build to from 44min down to 21min.

 - Allows for X applications to work properly, which should be available
   in near-term future through pkgsrc for 3.3.0.

Change-Id: I8f4179a7ea925ed381642add32cfd8c5822217e4
2014-09-08 17:30:18 +02:00
Ben Gras
bad58c9c51 merge libminlib with libc
Change-Id: I79cc4ea90c378a1da3dac16487b53034953827a7
2014-08-28 18:49:19 +02:00
Ben Gras
c2808d8b07 remove libcompat_minix as library
. get rid of includes in libcompat_minix:
	  . move configfile.h to minix/include/
	  . all others are unneeded as they point to other files
	. merge the .c files with libc

Change-Id: I5e840c66fb9bc484f377926aa9d66473bbd16259
2014-08-28 18:49:13 +02:00
Lionel Sambuc
433d6423c3 New sources layout
Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
2014-07-31 16:00:30 +02:00
Lionel Sambuc
6082b2b4de Message type for COMMON_REQ_GCOV_DATA.
Change-Id: I97d31059990e33411a685d5d8191c728a02e7d0f
2014-07-28 17:06:28 +02:00
Lionel Sambuc
43d985050c Use one message type for all BDEV request.
There are missing field assignements, and/or messsages being re-used
without re-initializations, which allows for fields to be implicitly
forwarded.

This prevents me from creating per request message types, as I can't
spend currently any more time debugging this issue.
2014-07-28 17:06:28 +02:00
Lionel Sambuc
0522c9d0c1 Message type for BDEV_REPLY.
Change-Id: I48ca5a4f77cc9e924e8aee2fe6c32e0da9b42560
2014-07-28 17:06:27 +02:00
Lionel Sambuc
8644f25feb Message type for SYS_PROFBUF.
Change-Id: I10c1e878b0e3ff9bfc52709cc87dace632fa3e4f
2014-07-28 17:06:27 +02:00
Lionel Sambuc
64fb3a184c Message type for SYS_CPROF and PM_CPROF.
Change-Id: I2dc3d9d95c2a2b4c5fdbceae359b0be2bbdf9fb5
2014-07-28 17:06:26 +02:00
Lionel Sambuc
8ad307eeed Message type for SYS_SPROF and PM_SPROF.
Change-Id: I598f88af47737be0172236fa9ad24058b50d3942
2014-07-28 17:06:26 +02:00
Lionel Sambuc
9ea21ea158 Message type for SYS_DIAGCTL.
Change-Id: Icdaa84847f8c75f5af6612dda3326f800166e0d7
2014-07-28 17:06:25 +02:00
Lionel Sambuc
93b1819dac Message type for SIGS_SIGNAL_RECEIVED.
Change-Id: I5c13ff06e0203a98d4087829308d03020f302542
2014-07-28 17:06:25 +02:00
Lionel Sambuc
f45c6b86cb Message type for SYS_READBIOS.
Change-Id: Id19f658f5eb5f350e3e19f9ce3f8ae80aea23c51
2014-07-28 17:06:25 +02:00
Ben Gras
5d0e31dbb3 custom message req & reply types for ds 2014-07-28 17:06:24 +02:00
Ben Gras
c727357664 custom types for RS_INIT, RS_UPDATE, and others 2014-07-28 17:06:23 +02:00
Ben Gras
9961d3d3e5 custom message types for safecopy calls 2014-07-28 17:06:23 +02:00
Ben Gras
c24f718bb4 custom message type for VM_UNMAP_PHYS 2014-07-28 17:06:23 +02:00
Ben Gras
6af75e6660 custom message type for vm_map_phys 2014-07-28 17:06:22 +02:00
Ben Gras
8c2ac80abd custom message type for VM_BRK 2014-07-28 17:06:22 +02:00
Ben Gras
7cb7ac5b42 use custom mmap struct type directly 2014-07-28 17:06:21 +02:00
Ben Gras
3610b3b1a6 custom message type for SYS_DEVIO 2014-07-28 17:06:21 +02:00
Ben Gras
fce93dad32 custom message type for SEMOP 2014-07-28 17:06:21 +02:00
Ben Gras
c476408dea custom message type for SHMCTL, SEMCTL, SEMGET 2014-07-28 17:06:20 +02:00
Ben Gras
e57d31d331 custom messages for SHMAT, SHMDT 2014-07-28 17:06:20 +02:00
Ben Gras
8627d33a42 custom message for SHMGET 2014-07-28 17:06:19 +02:00
Ben Gras
0881781e60 custom message for vm_query_exit 2014-07-28 17:06:19 +02:00
Ben Gras
93422a1f4c custom message for vm_update 2014-07-28 17:06:19 +02:00
Ben Gras
9e2efbd73d custom message type for VM_INFO 2014-07-28 17:06:18 +02:00
Ben Gras
3c88d20cb5 custom message type for VM_QUERY_EXIT 2014-07-28 17:06:18 +02:00
Ben Gras
01a50f57d8 custom message type for VM_GETREF 2014-07-28 17:06:17 +02:00
Ben Gras
28b5360df7 custom message type for VM_GETPHYS 2014-07-28 17:06:17 +02:00
Ben Gras
324fc1f604 custom message type for VM_SHM_UNMAP 2014-07-28 17:06:17 +02:00
Ben Gras
e3a0e6c3c3 custom message type for VM_REMAP, VM_REMAP_RO 2014-07-28 17:06:16 +02:00
Cristiano Giuffrida
d9cd49c332 sef: Add fault injection (and EDFI) support. 2014-07-28 17:06:06 +02:00
Ben Gras
33c4e94990 Empty libgcc_s.
This library is built just so that something is present in
/usr/lib/libgcc_s.so.1.  This is needed for dynamically programs built
with gcc, which might reference that library at runtime (i.e. all pkgsrc
packages). The necessary symbols are in libc however, so when built on a
clang-only system, so an empty library is a working stopgap.
2014-07-28 17:06:03 +02:00
Lionel Sambuc
4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00