Commit graph

5012 commits

Author SHA1 Message Date
David van Moolenbroek 85edabcb42 btrace(8): resolve Coverity warnings 2012-07-30 12:10:07 +00:00
Thomas Veerman 66dbf73049 VFS: fix locking bug in clone_opcl
When VFS runs out of vnodes after closing a vnode in opcl, common_open
will try to unlock a vnode through unlock_filp that has already been
unlocked in clone_opcl. By first obtaining and locking a new vnode this
situation is prevented; if there are no free vnodes, common_open will
unlock a still locked vnode.
2012-07-30 10:01:16 +00:00
Thomas Veerman f6b0d662b5 VFS: check path components for NAME_MAX length 2012-07-30 09:44:58 +00:00
Thomas Veerman 48237f1730 ext2: use new secondary cache method
This gets rid of the ! emitted by VM when using ext2
2012-07-30 09:44:58 +00:00
Thomas Veerman 6c597561bc EXT2: various fixes
.enable all compile time warnings and make them errors
.refactor functions with unused parameters
.fix null pointer dereference before checking for null
.proper variable initialization
.use safe string copy functions
.fix massive memory corruption bug in fs_getdents
2012-07-30 09:44:58 +00:00
Thomas Veerman 238a9a057b PM: a few Coverity inspired fixes
.initialize variable to prevent negative array indexing
.remove dead code
2012-07-30 09:44:58 +00:00
Thomas Veerman ca085c16ef procfs: use safe string copy 2012-07-30 09:44:58 +00:00
Thomas Veerman c21503bdf8 isofs: fixes for coverity defects
.use safe string copy functions
.CD-ROM are always mounted read-only
2012-07-30 09:44:58 +00:00
Thomas Veerman 1c480f749a MFS: fixes for defects reported by Coverity
.use safe string copy
.fix (potential) int overflow in function return
2012-07-30 09:44:58 +00:00
Thomas Veerman fa9199e049 MFS: getdents fixes
.Use a bigger buffer to hold results
.Do not try to store more data than user buffer can hold
2012-07-30 09:44:57 +00:00
Ben Gras b6ea15115c kernel: facility for user-visible memory
. map all objects named usermapped_*.o with globally visible
	  pages; usermapped_glo_*.o with the VM 'global' bit on, i.e.
	  permanently in tlb (very scarce resource!)
	. added kinfo, machine, kmessages and loadinfo for a start
	. modified log, tty to make use of the shared messages struct
2012-07-28 20:57:38 +00:00
Ben Gras 53a947167c kernel: few more objects required in unpaged mode
. for 64-bit printf()
2012-07-28 22:26:52 +02:00
Ben Gras 11084d94e6 kernel: clean up objects
. objects left over from libraries are left around
2012-07-28 22:21:53 +02:00
David van Moolenbroek 6ded58b510 kernel: give kernel tasks their process name back 2012-07-26 14:35:08 +00:00
David van Moolenbroek 8caec1b57b libsys: 64-bit numbers support for printf()
Change some drivers accordingly.
2012-07-26 09:45:05 +00:00
Kees Jongenburger 86344bb535 Upgrade to NetBSD: tic.c,v 1.19
The upgrade of tic to v 1.19 fixes a memory corruptions that  was
visible when cross building (specially when using  long  path
names in the output file argument).
2012-07-25 11:48:27 +00:00
David van Moolenbroek 0b4c154160 VFS: call req_inhibread again 2012-07-19 14:36:51 +00:00
David van Moolenbroek e0742978f1 VFS: do not resolve symlinks in rename(2) 2012-07-18 14:59:45 +00:00
Ben Gras 49d4116100 kernel: keep serial info in system env
. otherwise serial hardware gets reinitialized by tty
2012-07-18 15:16:57 +02:00
Thomas Veerman 963a10e15a PFS: fix negative array index 2012-07-18 10:05:50 +00:00
Thomas Veerman 0d3ccd8908 VFS: fix coverity defects 2012-07-17 10:29:22 +00:00
Thomas Veerman fd60f03129 VFS: remove support for sync FS communication 2012-07-17 10:12:53 +00:00
Thomas Veerman 06f49fe167 VFS: prevent buffer overflow
If an FS returns faulty struct dirent data, VFS could overflow
a buffer that holds this data.
2012-07-17 08:49:41 +00:00
Ben Gras cbcdb838f1 various coverity-inspired fixes
. some strncpy/strcpy to strlcpy conversions
	. new <minix/param.h> to avoid including other minix headers
	  that have colliding definitions with library and commands code,
	  causing parse warnings
	. removed some dead code / assignments
2012-07-16 14:00:56 +02:00
Thomas Veerman 77dbd766c1 VFS: Use safe string copy functions 2012-07-16 10:57:43 +00:00
Ben Gras 1d48c0148e segmentless smp fixes
adjust the smp booting procedure for segmentless operation. changes are
mostly due to gdt/idt being dependent on paging, because of the high
location, and paging being on much sooner because of that too.

also smaller fixes: redefine DESC_SIZE, fix kernel makefile variable name
(crosscompiling), some null pointer checks that trap now because of a
sparser pagetable, acpi sanity checking
2012-07-15 22:47:20 +02:00
Ben Gras 50e2064049 No more intel/minix segments.
This commit removes all traces of Minix segments (the text/data/stack
memory map abstraction in the kernel) and significance of Intel segments
(hardware segments like CS, DS that add offsets to all addressing before
page table translation). This ultimately simplifies the memory layout
and addressing and makes the same layout possible on non-Intel
architectures.

There are only two types of addresses in the world now: virtual
and physical; even the kernel and processes have the same virtual
address space. Kernel and user processes can be distinguished at a
glance as processes won't use 0xF0000000 and above.

No static pre-allocated memory sizes exist any more.

Changes to booting:
        . The pre_init.c leaves the kernel and modules exactly as
          they were left by the bootloader in physical memory
        . The kernel starts running using physical addressing,
          loaded at a fixed location given in its linker script by the
          bootloader.  All code and data in this phase are linked to
          this fixed low location.
        . It makes a bootstrap pagetable to map itself to a
          fixed high location (also in linker script) and jumps to
          the high address. All code and data then use this high addressing.
        . All code/data symbols linked at the low addresses is prefixed by
          an objcopy step with __k_unpaged_*, so that that code cannot
          reference highly-linked symbols (which aren't valid yet) or vice
          versa (symbols that aren't valid any more).
        . The two addressing modes are separated in the linker script by
          collecting the unpaged_*.o objects and linking them with low
          addresses, and linking the rest high. Some objects are linked
          twice, once low and once high.
        . The bootstrap phase passes a lot of information (e.g. free memory
          list, physical location of the modules, etc.) using the kinfo
          struct.
        . After this bootstrap the low-linked part is freed.
        . The kernel maps in VM into the bootstrap page table so that VM can
          begin executing. Its first job is to make page tables for all other
          boot processes. So VM runs before RS, and RS gets a fully dynamic,
          VM-managed address space. VM gets its privilege info from RS as usual
          but that happens after RS starts running.
        . Both the kernel loading VM and VM organizing boot processes happen
	  using the libexec logic. This removes the last reason for VM to
	  still know much about exec() and vm/exec.c is gone.

Further Implementation:
        . All segments are based at 0 and have a 4 GB limit.
        . The kernel is mapped in at the top of the virtual address
          space so as not to constrain the user processes.
        . Processes do not use segments from the LDT at all; there are
          no segments in the LDT any more, so no LLDT is needed.
        . The Minix segments T/D/S are gone and so none of the
          user-space or in-kernel copy functions use them. The copy
          functions use a process endpoint of NONE to realize it's
          a physical address, virtual otherwise.
        . The umap call only makes sense to translate a virtual address
          to a physical address now.
        . Segments-related calls like newmap and alloc_segments are gone.
        . All segments-related translation in VM is gone (vir2map etc).
        . Initialization in VM is simpler as no moving around is necessary.
        . VM and all other boot processes can be linked wherever they wish
          and will be mapped in at the right location by the kernel and VM
          respectively.

Other changes:
        . The multiboot code is less special: it does not use mb_print
          for its diagnostics any more but uses printf() as normal, saving
          the output into the diagnostics buffer, only printing to the
          screen using the direct print functions if a panic() occurs.
        . The multiboot code uses the flexible 'free memory map list'
          style to receive the list of free memory if available.
        . The kernel determines the memory layout of the processes to
          a degree: it tells VM where the kernel starts and ends and
          where the kernel wants the top of the process to be. VM then
          uses this entire range, i.e. the stack is right at the top,
          and mmap()ped bits of memory are placed below that downwards,
          and the break grows upwards.

Other Consequences:
        . Every process gets its own page table as address spaces
          can't be separated any more by segments.
        . As all segments are 0-based, there is no distinction between
          virtual and linear addresses, nor between userspace and
          kernel addresses.
        . Less work is done when context switching, leading to a net
          performance increase. (8% faster on my machine for 'make servers'.)
	. The layout and configuration of the GDT makes sysenter and syscall
	  possible.
2012-07-15 22:30:15 +02:00
Ben Gras cfe1ed4df4 profiling related cleanup
. do not declare any data in <minix/profile.h>
	. addr check no longer necessary
2012-07-15 21:56:55 +02:00
Ben Gras c6a2f353c3 boot programs gzip/strip changes
as disk space typically isn't a concern when crosscompiling, but
convenience and ability to debug is, change the strip and gzip defaults

	. do not strip or gzip the binaries when crosscompiling

this makes it faster to rebuild and restart a compiled system, with
debugging info if so desired.
2012-07-05 18:12:03 +02:00
Kees Jongenburger c4d9681327 Add entry in fstab and let the mount system call start devman.
After this commit you will need an additional entry in fstab for
the /sys file system (see docs/UPDATING).
2012-07-05 14:52:16 +02:00
Kees Jongenburger 30b5c227e9 Allow to specify the rslabel to use for a file system.
When a file system is mounted some heuristics are used to define
a RS label for that system. This commit allows to specify the
label to use in an optional mount argument using either
mount -o rslabel=fs_myfs or as a mount option in fstab.

This can be used to start services that later also need to be
accessed directly.
2012-07-05 14:52:16 +02:00
Kees Jongenburger 1fb60d0811 Fixes for mount -a.
* Display an error message upon failure to mount a device.
* Handle a special case when the source device is "none"
* pass the mount options stored in fourth field of fstab
  to mount(3).
2012-07-05 14:45:30 +02:00
Kees Jongenburger c9b3bd9d45 Add a /sys entry to minix.mtree 2012-07-05 11:09:40 +02:00
Kees Jongenburger c755b5784a Cleanup minix.mtree.
Use consistent indenting and sort entries alphabetically.
2012-07-05 11:07:25 +02:00
Kees Jongenburger 101b99bc77 devmand call the cleanup method before doing an exit.
Call the cleanup mehtod before doing an exit to prevent stale pid
files.
2012-07-05 11:07:25 +02:00
Ben Gras ed993cd557 don't leave _VCS_REVISION in 2012-06-29 16:34:41 +02:00
Ben Gras 08f8084a21 align messages
Has a small but measurable performance improvement.
2012-06-29 16:13:54 +02:00
Ben Gras c3db1c6939 various symbol referencing fixes
make weak symbol references and namespace renames references
the renamed versions.

function renaming, weak symbol references and libc namespace.h
protection interact in hairy ways and causes weak symbol references
for renamed functions to be unresolved; e.g. vfork should be an
alias for _vfork but _vfork doesn't exist because __vfork14()
exists.

this is a problem for dynamically linked executables as all symbols
have to be resolved, used or not, at link time. it was masked by
clang-compiled base system libraries but is a problem when gcc does
it.
2012-06-28 15:20:53 +02:00
Thomas Veerman 8d1c219676 libvassert: don't build shared lib 2012-06-26 09:32:15 +00:00
Thomas Veerman f26d79e0ff releasetools: use build system macros 2012-06-26 09:32:15 +00:00
Ben Gras c58712f0f0 xz: add libc dependency 2012-06-25 17:21:01 +02:00
Ben Gras 6a6b7b5769 ld.so: be more mmap()-behaviour-independent
. if the layout of virtual address regions as returned
	  by mmap() without a location hint changes, ld.so could
	  trip itself up (under minix). this change allocates
	  the full size it needs for every object that's loaded
	  so that if that succeeds, it's sure there's virtual address
	  space for the whole thing no matter what other bits happen
	  to be there already.

	. this fix exposed a bug in the test; at atexit() execution
	  time the loaded object is unmapped, so that part of the
	  test is removed.
2012-06-25 14:13:07 +02:00
Thomas Veerman 3f40eb3511 fetch.sh: serve tarballs ourselves
And use the original sources as backup.
2012-06-25 10:46:31 +00:00
Thomas Veerman e3209ae766 Import lib{mpc,gmp,mpfr}
This decreases external dependencies for crosscompilation. Note that
these libraries are not built nor used by Minix itself.

Furthermore, the shell scripts that download the tarballs for these
libraries, gcc, binutils, and gmake now also support curl in addition
to wget.
2012-06-25 09:15:27 +00:00
Thomas Veerman f8c6b27b69 sed: unbreak crosscompilation 2012-06-21 14:07:59 +00:00
Ben Gras 1906a5b9b4 sed: add compatability symlink properly 2012-06-20 15:47:44 +02:00
Kees Jongenburger ace9a62765 Include bsd.own.mk in /usr/Makefile to have INSTALL_DIR defined. 2012-06-20 14:52:29 +02:00
Ben Gras 4725854459 sed: add compatability symlink 2012-06-20 14:47:01 +02:00
Thomas Veerman 305dacf6ea setup: copy boot.cfg.default to /boot.cfg
This way the setup stays in sync with the source tree.
2012-06-20 10:48:39 +00:00
Thomas Veerman 6759b24c57 /etc/rc: use mount -a instead of manual parsing
The rc script manually parses /etc/fstab to mount all file systems.
To do that it needs /bin/sed which does not exist anymore. mount(8)
now supports the -a flag which causes it to mount all file systems
listed in /etc/fstab except for '/'. File systems marked with 'noauto'
are skipped.
2012-06-20 10:48:38 +00:00