Commit graph

83 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
Leonardo Fogel 07cbc27cb0 Add a driver for the eMMC on the BeagleBone Black
Change-Id: I30ab36ac048c65538718e372db9502fb8f51d41f
2015-06-21 11:04:16 +00:00
David van Moolenbroek 4bf270019a dp8390: update, allow default port and IRQ
Bochs has switched from port base 0x240 to 0x300 for its default
NE2000 ISA configuration, and QEMU is using the same settings.

Change-Id: Ide6cdb14321eb4324d0bf6d6314c5970b3493e95
2014-12-04 12:10:46 +00:00
David van Moolenbroek e321f65582 libfsdriver: support mmap on FSes with no device
This patch adds (very limited) support for memory-mapping pages on
file systems that are mounted on the special "none" device and that
do not implement PEEK support by themselves.  This includes hgfs,
vbfs, and procfs.

The solution is implemented in libvtreefs, and consists of allocating
pages, filling them with content by calling the file system's READ
functionality, passing the pages to VM, and freeing them again.  A new
VM flag is used to indicate that these pages should be mapped in only
once, and thus not cached beyond their single use.  This prevents
stale data from getting mapped in without the involvement of the file
system, which would be problematic on file systems where file contents
may become outdated at any time.  No VM caching means no sharing and
poor performance, but mmap no longer fails on these file systems.

Compared to a libc-based approach, this patch retains the on-demand
nature of mmap.  Especially tail(1) is known to map in a large file
area only to use a small portion of it.

All file systems now need to be given permission for the SETCACHEPAGE
and CLEARCACHE calls to VM.

A very basic regression test is added to test74.

Change-Id: I17afc4cb97315b515cad1542521b98f293b6b559
2014-11-15 11:19:52 +00:00
Cristiano Giuffrida d9cd49c332 sef: Add fault injection (and EDFI) support. 2014-07-28 17:06:06 +02:00
David van Moolenbroek 760f3d62d7 PTY: split off from TTY
Requires recreation of /dev/tty[pq]*, /dev/pty[pq]* device nodes.

Change-Id: I0e5a28d82faa934497fd3b97d619e506bcb5f439
2014-07-28 17:05:12 +02:00
Ben Gras a06e2ab395 big <utmp.h>-inspired netbsd switch
import/switch of:
init, getty, reboot, halt, shutdown, wall, last

changes:
	. change reboot() call to netbsd prototype and args
	. allows pristine <utmp.h>
	. use clean <sys/reboot.h> instead of <minix/reboot.h>
	. implement TIOCSCTTY for use by getty so getty can get
	  controlling terminal from init's child(ren)
	. allow NULL envp for exec

Change-Id: I5ca02cb4230857140c08794bbfeba7df982c58a3
2014-03-01 09:05:02 +01:00
David van Moolenbroek 24ec0d73b5 Clean up interface to PM and VFS
- introduce new call numbers, names, and field aliases;
- initialize request messages to zero for all ABI calls;
- format callnr.h in the same way as com.h;
- redo call tables in both servers;
- remove param.h namespace pollution in the servers;
- make brk(2) go to VM directly, rather than through PM;
- remove obsolete BRK, UTIME, and WAIT calls;
- clean up path copying routine in VFS;
- move remaining system calls from libminlib to libc;
- correct some errno-related mistakes in libc routines.

Change-Id: I2d8ec5d061cd7e0b30c51ffd77aa72ebf84e2565
2014-03-01 09:05:01 +01:00
David van Moolenbroek e5cc85fdc4 Extend dupfrom(2) into copyfd(2)
This single function allows copying file descriptors from and to
processes, and closing a previously copied remote file descriptor.
This function replaces the five FD-related UDS backcalls. While it
limits the total number of in-flight file descriptors to OPEN_MAX,
this change greatly improves crash recovery support of UDS, since all
in-flight file descriptors will be closed instead of keeping them
open indefinitely (causing VFS to crash on system shutdown). With the
new copyfd call, UDS becomes simpler, and the concept of filps is no
longer exposed outside of VFS.

This patch also moves the checkperms(2) stub into libminlib, thus
fully abstracting away message details of VFS communication from UDS.

Change-Id: Idd32ad390a566143c8ef66955e5ae2c221cff966
2014-03-01 09:04:58 +01:00
David van Moolenbroek b003ed0929 UDS: split off from PFS
Change-Id: I769cbd64aa6e5e85a797caf0f8bbb4c20e145263
2014-03-01 09:04:57 +01:00
David van Moolenbroek 6d466f941b at_wini: PCI-only now; one controller per instance
- remove non-PCI support, since all supported platforms with at_wini
  devices also have PCI support by now;
- correspondingly, stop using information from the BIOS altogether;
- limit each driver instance to one controller, to be in line with
  the general MINIX3 one-instance-per-controller driver model; this
  limits the number of disks per at_wini instance to four;
- go through the controllers by the order of their occurrence in the
  PCI table, thus removing the exception for compatibility devices;
- let the second at_wini instance shut down silently if there is only
  one IDE controller;
- clean up some extra code we don't need anymore, and resolve some
  WARNS=5 level warnings.

Overall, these changes should simplify automatic loading of the right
disk drivers at boot time in the future.

Change-Id: Ia64d08cfbeb9916abd68c9c2941baeb87d02a806
2014-03-01 09:04:57 +01:00
David van Moolenbroek 89332ecdf1 system.conf: subsystem VID/DID matching support
- change "vid/did" to "vid:did", old form still supported for now;
- allow "vid:did/subvid:subdid" specification in system.conf, in
  which case a device will be visible to a driver if the subsystem
  VID/DID also match.

Change-Id: I7aef54da1b0bc81e24b5d98f1a28416f38f8b266
2014-03-01 09:04:57 +01:00
David van Moolenbroek 6b3f4dc157 Input infrastructure, INPUT server, PCKBD driver
This commit separates the low-level keyboard driver from TTY, putting
it in a separate driver (PCKBD). The commit also separates management
of raw input devices from TTY, and puts it in a separate server
(INPUT). All keyboard and mouse input from hardware is sent by drivers
to the INPUT server, which either sends it to a process that has
opened a raw input device, or otherwise forwards it to TTY for
standard processing.

Design by Dirk Vogt. Prototype by Uli Kastlunger.

Additional changes made to the prototype:

- the event communication is now based on USB HID codes; all input
  drivers have to use USB codes to describe events;
- all TTY keymaps have been converted to USB format, with the effect
  that a single keymap covers all keys; there is no (static) escaped
  keymap anymore;
- further keymap tweaks now allow remapping of literally all keys;
- input device renumbering and protocol rewrite;
- INPUT server rewrite, with added support for cancel and select;
- PCKBD reimplementation, including PC/AT-to-USB translation;
- support for manipulating keyboard LEDs has been added;
- keyboard and mouse multiplexer devices have been added to INPUT,
  primarily so that an X server need only open two devices;
- a new "libinputdriver" library abstracts away protocol details from
  input drivers, and should be used by all future input drivers;
- both INPUT and PCKBD can be restarted;
- TTY is now scheduled by KERNEL, so that it won't be punished for
  running a lot; without this, simply running "yes" on the console
  kills the system;
- the KIOCBELL IOCTL has been moved to /dev/console;
- support for the SCANCODES termios setting has been removed;
- obsolete keymap compression has been removed;
- the obsolete Olivetti M24 keymap has been removed.

Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578
2014-03-01 09:04:55 +01:00
David van Moolenbroek 36ac0dbcf8 Take LOG out of the boot image
Change-Id: Id2629776b53aae46629b04a42c15cbbacac9b949
2014-03-01 09:04:55 +01:00
David van Moolenbroek 6989311826 Add VND driver, providing loopback devices
Change-Id: I40fa695e28c67477a75383e6f1550e451afcab41
2014-03-01 09:04:54 +01:00
David van Moolenbroek b48542d914 VM: readd support for forgetting cached FS blocks
Not all services involved in block I/O go through VM to access the
blocks they need.  As a result, the blocks in VM may become stale,
possibly causing corruption when the stale copy is restored by a
service that does go through VM later on.  This patch restores support
for forgetting cached blocks that belong to a particular device, and
makes the relevant file systems use this functionality 1) when
requested by VFS through REQ_FLUSH, and 2) upon unmount.

Change-Id: I0758c5ed8fe4b5ba81d432595d2113175776aff8
2014-03-01 09:04:53 +01:00
Ben Gras 9dfbfc9af7 release.sh: simplify by removing usb option
. relies on bios_wini which is long gone

Change-Id: I95257b6204cc6d928abcbd8492808b4b6450a99e
2013-09-25 12:26:31 +00:00
Thomas Cort 0a9eab0bb6 gpio: port to am335x
* port libgpio to am335x.
 * increase NR_IRQ to 16 to avoid too many IRQs requested error.
 * move gpio binary to /sbin (that's where mount looks for drivers).
 * fix bug that re-enabled banks that were disabled due to bad revision.
 * fix padconf masks for dm37xx in gpio driver (should be 16-bit).
 * fix a few typos in README.txt and comments.

Change-Id: I32374415a97135174c5224f76374a870909fa90c
2013-09-03 08:14:18 -04:00
Thomas Cort 4593804bf0 kernel: add padconf kernel call
On the AM335X, writes to the padconf registers must be done in privileged
mode. To allow userspace drivers to dynamically change the padconf at
runtime, a kernel call has been added.

Change-Id: I4b25d2879399b1785a360912faa0e90b5c258533
2013-08-28 12:53:05 -04:00
Thomas Cort 471dc65ada bmp085: driver for the BMP085 temp&pressure sensor
Change-Id: I5c297a7f4f8cea2549e537df30a5c7bf5b9d8b51
2013-08-22 16:54:03 -04:00
Thomas Cort 3bdd1ae659 sht21: driver for the SHT21 humidity & temp sensor
Change-Id: Ia71168e394a7b260019e74973db6c9d75d3d4482
2013-08-22 16:53:57 -04:00
Thomas Cort 845aabfe65 tsl2550: driver for the TSL2550 light sensor
Change-Id: I9e1c87132404509ffec8bf22a8c6cc993df1aa73
2013-08-22 16:53:49 -04:00
Thomas Cort 26f14d6b5d fb: auto-configure with EDID
Use EDID when available to configure the frame buffer driver with
good settings for the attached display.

Change-Id: I69a78155a93e55ffa1ca3ff6621a879a56cdbceb
2013-08-11 20:37:16 +02:00
Thomas Cort bab2a34e1b tps65950: driver for the TPS65950 PMIC
Change-Id: I6b6163e59233d1f823f03550b949d53e1738a7f4
2013-08-09 12:41:43 +02:00
David van Moolenbroek 8e87bd84b4 Remove VM_VFS_REPLY from VM_BASIC_CALLS
Change-Id: I0a03f1c95fd7ef87cecb01a028f59696a8447738
2013-08-08 23:23:13 +02:00
Thomas Cort d9b62047f1 tps65217: driver for the TPS65217 PMIC
Change-Id: Ic2259c15645816627d757c9c45560cb4c5c0156c
2013-08-05 10:22:59 -04:00
Thomas Cort 09db2a8c67 readclock: add support for am335x RTC
Add support for getting/setting the am335x SoC's internal real
time clock. Also, allow the power off alarm to be set.

Make readclock an "always on" driver. This is needed for setting
power-off alarms whenever the power button is pressed on the BBB.

Replace the readclock.sh script & single run driver with a
readclock program that takes the same arguments and forwards
the requests on to the always up readclock driver.

Change-Id: Ifd6c2acd80ae4b5e79d83df510df445c24e24a71
2013-08-05 08:37:51 -04:00
Thomas Cort 1b78e86fb8 tda19988: driver for the TDA19988 HDMI Transmitter
Change-Id: Ia7750df3dd4ec4bd68624c800a0241c70eea7ca4
2013-07-29 12:38:01 -04:00
Thomas Cort 526eb34144 cat24c256: driver for the cat24c256 i2c eeprom
Change-Id: I682d136c80fc868d3f0a5edb0cf6c33c0f3a28ea
2013-07-15 17:03:18 -04:00
Thomas Cort 550fdfb443 i2c: initial bus drivers for am335x and dm37xx
Change-Id: I478704fbf30dbf6d3382bcbfb11e75b512c032a1
2013-07-15 11:11:13 -04:00
Kees Jongenburger e399fe53ae arm:increase the mmc driver process priority.
Increase driver process priority to prevent starvation. Without
special attribute drivers will have the same priority as other
userland processes this. Posix test 1 was taking so much resources
that it triggered alarms in the MMC driver.

Change-Id: Icd3295d8f2a4a284418327a3715641fe9a3b3043
2013-06-24 09:12:10 +02:00
Ben Gras 33a7ac7557 vfs: mmap support
. 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
2013-05-31 15:42:00 +00:00
Kees Jongenburger 758c8eaf41 arm:adapt MMC driver to also work on the AM335X platform.
Change-Id: I30e69b7bfd377d1dd2b0b458dd00ee411b060285
2013-05-24 15:47:04 +02:00
Ben Gras 49eb1f4806 vm: new secondary cache code
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
2013-04-24 10:18:16 +00:00
Thomas Veerman ba49a155b5 fb: introduce framebuffer support to Minix
This patch introduces a framebuffer to Minix. It's written for the ARM
port of Minix, but has an architectural split that separates the
hardware dependent part from the non-hardware dependent part. Futhermore,
this driver was developed using a screen that has a native resolution of
1024x600 pixels and having lack of support for obtaining EDID from the
screen. Consequently, it uses a hardcoded resolution of 1024x600.

The driver uses an interface based on the Linux ioctl API, but supports
only a very limited subset.
2013-02-21 10:29:08 +00:00
Kees Jongenburger 3357fcb24a GPIO:further development
* Generalize GPIO handling.
* Add libs to configure gpio's clocks and pads
* Add Interrupt handling.
* Introduce mmio.h and log.h

Change-Id: I928e4c807d15031de2eede4b3ecff62df795f8ac
2013-02-06 16:07:43 +01:00
Kees Jongenburger 3de9b14567 mmc:development
* let busy loops timeout.
* Start using interrupt handlers.
* Allocate the ramdisk only when used.

Change-Id: Ie08d66eefef3c8cd3ee16c04f74a9a50cc12b021
2013-02-01 13:31:10 +01:00
Kees Jongenburger e641d42a37 gpio:Initial GPIO driver.(ARM)
Small GPIO driver that exports a few pins using a virtual file
system. Currently the two user leds and the user button are exported.

Change-Id: I001d017ae27cd17b635587873f7da981054da459
2013-01-28 15:51:20 +01:00
Arne Welzel a27b60af75 virtio: virtio-blk driver 2013-01-23 09:03:03 +00:00
David van Moolenbroek f4737c94ee vbfs: add DS to system.conf IPC list 2012-12-06 13:27:26 +00:00
Thomas Veerman 2773b5efb7 Use proper uid when mounting NTFS partition 2012-11-14 13:42:13 +00:00
Kees Jongenburger 49246fcdd5 MMC driver.
Change-Id: I0d460d63070855df9b11eaf3d33eb7bb89c570f1
2012-10-08 09:11:17 +02:00
Ben Gras 053fa581b5 vm: remove stack handling for signals
. moved to the kernel as the handling was only
	  reading it; the kernel may as well write it too
2012-08-29 17:31:38 +02:00
Ben Gras 769af57274 further libexec generalization
. new mode for sys_memset: include process so memset can be
	  done in physical or virtual address space.
	. add a mode to mmap() that lets a process allocate uninitialized
	  memory.
	. this allows an exec()er (RS, VFS, etc.) to request uninitialized
	  memory from VM and selectively clear the ranges that don't come
	  from a file, leaving no uninitialized memory left for the process
	  to see.
	. use callbacks for clearing the process, clearing memory in the
	  process, and copying into the process; so that the libexec code
	  can be used from rs, vfs, and in the future, kernel (to load vm)
	  and vm (to load boot-time processes)
2012-06-07 15:15:02 +02:00
Ben Gras ee4016155e vm: add third-party mmap() mode and PROCCTL
these two functions will be used to support all exec() functionality
going into a single library shared by RS and VFS and exec() knowledge
leaving VM.

	. third-party mmap: allow certain processes (VFS, RS) to
	  do mmap() on behalf of another process
	. PROCCTL: used to free and clear a process' address space
2012-06-07 12:43:16 +02:00
Ben Gras cfb2d7bca5 retire BIOS_SEG and umap_bios
. readbios call is now a physical copy with range check in
	  the kernel call instead of BIOS_SEG+umap_bios
	. requires all access to physical memory in bios range to go
	  through sys_readbios
	. drivers/dpeth: wasn't using it
	. adjusted printer
2012-05-09 19:03:59 +02:00
Ben Gras 511c977f93 retire bios_wini 2012-04-12 03:02:21 +02:00
David van Moolenbroek 928d76dbe8 Add VBFS: VirtualBox Shared Folder File System
Refer to "man vbfs" on how to mount it.
2012-04-11 00:27:48 +02:00
David van Moolenbroek 6aa61efd09 VBOX: add host/guest communication interface
This interface can be used by other system processes by means of the
newly provided vbox API in libsys.
2012-04-09 15:56:20 +02:00
David van Moolenbroek 186a4db672 ahci: use sys_vumap() instead of sys_umap()
This is only an optimization for CPU performance. Callers are
currently still required to supply contiguous memory.
2012-03-24 19:51:13 +01:00