dragonfly.git
20 years agoYah yah. Always good to commit the header file needed for the last fix.
Matthew Dillon [Mon, 20 Oct 2003 16:50:39 +0000 (16:50 +0000)]
Yah yah.  Always good to commit the header file needed for the last fix.

20 years agoFix a bug introduced by recent INVARIANTS debugging additions, sometimes
Matthew Dillon [Mon, 20 Oct 2003 16:09:00 +0000 (16:09 +0000)]
Fix a bug introduced by recent INVARIANTS debugging additions, sometimes
the first word of M_ZERO'd memory isn't zero'd.

20 years agoFix an error message.
Matthew Dillon [Mon, 20 Oct 2003 07:01:05 +0000 (07:01 +0000)]
Fix an error message.

20 years agoDo a bit of cleanup and add a bit of debugging to the checkpoint module.
Matthew Dillon [Mon, 20 Oct 2003 06:50:51 +0000 (06:50 +0000)]
Do a bit of cleanup and add a bit of debugging to the checkpoint module.

Fix a bug in the offset calculations in the ELF checkpoint file descriptor
writeout code... one loop was skipping descriptors 0,1,2, another loop
was not.  This bug had prevented 'primes' from being properly checkpointed.

20 years agoAdd the checkpt module to the system tree. Currently this may only be
Matthew Dillon [Mon, 20 Oct 2003 04:48:42 +0000 (04:48 +0000)]
Add the checkpt module to the system tree.  Currently this may only be
loaded as a module, not configured into the kernel directly.

20 years agoAdditional checkpoint suppor for vmspace info. In particular, the data size
Matthew Dillon [Mon, 20 Oct 2003 04:47:35 +0000 (04:47 +0000)]
Additional checkpoint suppor for vmspace info.  In particular, the data size
is used by sbrk and must be restored for programs to work properly.

20 years agoAdd the 'checkpt' utility to support the process checkpoint module. This
Matthew Dillon [Mon, 20 Oct 2003 04:46:14 +0000 (04:46 +0000)]
Add the 'checkpt' utility to support the process checkpoint module.  This
originated from Kip Macy with cleanups and modifications by Matt Dillon.

Note: currently i386-specific.  The system calls have not been integrated
into libc yet.

Submitted-by: Kip Macy <kmacy@fsmware.com>
20 years agoAdd the 'checkpt' utility to support the process checkpoint module. This
Matthew Dillon [Mon, 20 Oct 2003 04:45:54 +0000 (04:45 +0000)]
Add the 'checkpt' utility to support the process checkpoint module.  This
originated from Kip Macy with cleanups and modifications by Matt Dillon.

Submitted-by: Kip Macy <kmacy@fsmware.com>
20 years agoAdd a fp_vpopen() function to kern_fp.c, and add reserved fields to
Matthew Dillon [Sun, 19 Oct 2003 23:23:29 +0000 (23:23 +0000)]
Add a fp_vpopen() function to kern_fp.c, and add reserved fields to
various checkpoint structures.

20 years agoUn-initialise (i.e free) the HPFS inode hash; previously, unloading
Hiten Pandya [Sun, 19 Oct 2003 21:24:55 +0000 (21:24 +0000)]
Un-initialise (i.e free) the HPFS inode hash; previously, unloading
the HPFS module led to stray number of bytes still being allocated.
32K almost.

Related to:

   malloc_uninit: 32768 bytes of 'HPFS hphash' still allocated on cpu0

20 years agoEnhance the fp_*() API. Reorganize the ELF dump code using the fp_*()
Matthew Dillon [Sun, 19 Oct 2003 19:24:20 +0000 (19:24 +0000)]
Enhance the fp_*() API.  Reorganize the ELF dump code using the fp_*()
API and adding hooks to make checkpointing easier.

Submitted-by: Kip Macy <kmacy@fsmware.com>
20 years agoFix the INVARIANTS memuse test, the memuse for each cpu must be aggregated
Matthew Dillon [Sun, 19 Oct 2003 18:18:50 +0000 (18:18 +0000)]
Fix the INVARIANTS memuse test, the memuse for each cpu must be aggregated
and the final total used.  Array entries cannot be used individually.

20 years agoFix a ``missing free''.
Hiten Pandya [Sun, 19 Oct 2003 18:11:37 +0000 (18:11 +0000)]
Fix a ``missing free''.

The NTFS Inode hashing code did not free the inode hash, which caused
the following warning at unload time.  This is only noticed when NTFS
is loaded as a KLD module:

   malloc_uninit: 32768 bytes of 'NTFS nthash' still allocated on cpu0

Use vfs_uninit() entry point to solve this issue, by calling (new)
ntfs_nthash_uninit() function to release the NT inode hash.

20 years agoUnravel a nested conditional.
Jeffrey Hsu [Sun, 19 Oct 2003 05:19:21 +0000 (05:19 +0000)]
Unravel a nested conditional.
Same as FreeBSD rev 1.185.

20 years agoEntirely remove the old kernel malloc and kmem_map code. The slab allocator
Matthew Dillon [Sun, 19 Oct 2003 00:23:30 +0000 (00:23 +0000)]
Entirely remove the old kernel malloc and kmem_map code.  The slab allocator
is now mandatory.  Also remove the related conf options, USE_KMEM_MAP and
NO_SLAB_ALLOCATOR.

20 years agoHack up param.h even more so sys/socket.h can include portions of it without
Matthew Dillon [Sun, 19 Oct 2003 00:13:18 +0000 (00:13 +0000)]
Hack up param.h even more so sys/socket.h can include portions of it without
polluting the namespace (like it did before), but without preventing another
header or source file from including it directly, as well.

20 years agoDon't try to call an ipiq function with a UP build when the cpuid doesn't
Matthew Dillon [Sat, 18 Oct 2003 23:59:58 +0000 (23:59 +0000)]
Don't try to call an ipiq function with a UP build when the cpuid doesn't
match, panic instead.

20 years agoAdd the pim(4) and multicast(4) manual pages, following
Hiten Pandya [Sat, 18 Oct 2003 21:40:41 +0000 (21:40 +0000)]
Add the pim(4) and multicast(4) manual pages, following
Jeffrey Hsu's recent addition of the Protocol Independent Multicasting
code.

Both manual pages by: Pavlin Radoslavov <pavlin@icir.org>

20 years agoRemove a diagnostic message that detected PHOLD() vs exit()/process-reaping
Matthew Dillon [Sat, 18 Oct 2003 20:41:08 +0000 (20:41 +0000)]
Remove a diagnostic message that detected PHOLD() vs exit()/process-reaping
races.  The races are handled just fine, the message was just to see if they
could even occur (and they can).

20 years agoFix races in ihashget that were introduced when I introduced the
Matthew Dillon [Sat, 18 Oct 2003 20:15:10 +0000 (20:15 +0000)]
Fix races in ihashget that were introduced when I introduced the
lwkt_gettoken() API to interlock the vnode and hash table ops.

Report-by: David Rhodus.
20 years agoUpdate sysinstall's NFS module:
Hiten Pandya [Sat, 18 Oct 2003 20:12:26 +0000 (20:12 +0000)]
Update sysinstall's NFS module:

* Add ability to select NFSv3 version (default)

* Add ability to use TCP as protocol.  TCP is
  not made default to retain automatic compatiblity
  with a wider range of NFS servers.

* Fix argument processing in mediaInitNFS(), variable_get()
  cannot be used in a conditional statement because it returns
  a "char *" string; instead, use variable_cmp().

* Update I/O block sizes in the case when NFS_SLOW is not
  set to "YES".  Previously, the NFS_SLOW case had a bigger
  block size than the fast case which defaulted to 512b,
  whereas the former was 1024.  The new block size used is
  4096, which is reasonable for the lowest of connection
  mediums.

Reviewed by: dillon, drhodus

20 years agomachine/param.h has to be included outside of _KERNEL for MAXCPU.
Matthew Dillon [Sat, 18 Oct 2003 20:07:32 +0000 (20:07 +0000)]
machine/param.h has to be included outside of _KERNEL for MAXCPU.

20 years agoMake vmstat -m understand the new per-cpu aggregation for
Matthew Dillon [Sat, 18 Oct 2003 19:59:45 +0000 (19:59 +0000)]
Make vmstat -m understand the new per-cpu aggregation for
malloc_type statistics.

20 years agoUse vnconfig(8) instead of mdconfig(8) to enable ${swapfile},
Hiten Pandya [Sat, 18 Oct 2003 14:17:30 +0000 (14:17 +0000)]
Use vnconfig(8) instead of mdconfig(8) to enable ${swapfile},
as the latter is not available.

Submitted by: Skip Ford <skip.ford@verizon.net>

20 years agoAdd SysV IPC regression suite.
Hiten Pandya [Sat, 18 Oct 2003 12:13:01 +0000 (12:13 +0000)]
Add SysV IPC regression suite.

Obtained from: NetBSD

20 years agoFix build by not attempting to compile libc's malloc directly.
Hiten Pandya [Sat, 18 Oct 2003 11:53:43 +0000 (11:53 +0000)]
Fix build by not attempting to compile libc's malloc directly.

Submitted by: Skip Ford <skip.ford@verizon.net>

20 years agoFix memory leaks in the namecache code commited so far to stabilize its
Matthew Dillon [Sat, 18 Oct 2003 05:53:57 +0000 (05:53 +0000)]
Fix memory leaks in the namecache code commited so far to stabilize its
memory use.  These are temporary fixes.

20 years agoMake malloc_type statistics per-cpu, which fixes statistics update races
Matthew Dillon [Sat, 18 Oct 2003 05:48:44 +0000 (05:48 +0000)]
Make malloc_type statistics per-cpu, which fixes statistics update races
in the slab allocator that would result in malloc statistics being way off.

20 years agoFix a uni-processor bug with the last commit... we weren't rescheduling on
Matthew Dillon [Fri, 17 Oct 2003 07:44:18 +0000 (07:44 +0000)]
Fix a uni-processor bug with the last commit... we weren't rescheduling on
priority changes.

20 years agoCleanup P_CURPROC and P_CP_RELEASED handling. P_CP_RELEASED prevents the
Matthew Dillon [Fri, 17 Oct 2003 07:30:43 +0000 (07:30 +0000)]
Cleanup P_CURPROC and P_CP_RELEASED handling.  P_CP_RELEASED prevents the
userland scheduler from messing with a process and must be set (in a lazy
fashion) when a thread that came in from userland is about to block in
the kernel.  P_CURPROC is used to manage which threads belonging to
processes controlled by the userland scheduler are scheduled by LWKT.
The userland scheduler has also been streamlined considerably.

p_priority now has a rollup priority that can be compared directly,
regardless of the realtime/idle/whatever queue a process is on.
p_priority has been changed from an unsigned char to a signed short.

schedclock is now distributed, so 'top' shows the correct values.

A huge amount of cpu affinity code has been added to the scheduler.  It is
not working 100% yet, but the framework is there (see kern/kern_switch.c).
globaldata now has gd_upri to support remote reschedule requests issued
by the affinity code.  There are two goals to the new scheduling code for
MP boxes: (1) so niced/idleprio cpu bound programs do not interfere
*at* *all* with other things (like, say, a buildworld).  (2) to reduce
the flip-flopping of processes between cpus.

lwkt_gettoken() now increments the generation number unconditionally so
kernel code can detect when other processes have used a token.

lwkt_send_ipiq_mask() removes stopped cpus from the mask automatically.

20 years agoCreate kern_readv() and kern_writev() and use them to split read(), pread(),
David P. Reese, Jr. [Fri, 17 Oct 2003 05:25:45 +0000 (05:25 +0000)]
Create kern_readv() and kern_writev() and use them to split read(), pread(),
readv(), write(), pwrite(), and writev().

Also, rewrite linux_pread() and linux_pwrite() using the in-kernel syscalls.

20 years agoRemove PUSER entirely. Since p_priority has nothing to do with kernel
Matthew Dillon [Thu, 16 Oct 2003 23:59:15 +0000 (23:59 +0000)]
Remove PUSER entirely.  Since p_priority has nothing to do with kernel
thread priorities, the userland scheduler can now use the entire range 0-127.

Document the estcpu and other macros related to the p_priority calculation.

Adjust the default values such that a cpu bound nice -20 process will not
completely starve a nice +0 process (though it gets close!).  Note that a
nice +2 process will not run at all in the face of a cpu bound nice -20
process.

20 years agoFix the userland scheduler. When the scheduler releases the P_CURPROC
Matthew Dillon [Thu, 16 Oct 2003 22:26:42 +0000 (22:26 +0000)]
Fix the userland scheduler.  When the scheduler releases the P_CURPROC
designation it unconditionally handed it off to the highest priority
process on the userland process queue, ignoring the fact that the 'current'
process might have had a higher priority.  There was also a missing call to
lwkt_maybe_switch() in the resched_wanted() case that could cause interrupt
threads to stall for a long period of time when they could not preempt.

In SMP there are still some issues.  Niced processes work better, but at
the moment the P_CURPROC handoff does not take into account the fact that
the new higher priority process might better be handed off to another cpu
that is running a lower priority process then the current cpu.

20 years agocorrect the .PATH for access to scvesactl.c
Matthew Dillon [Thu, 16 Oct 2003 01:18:00 +0000 (01:18 +0000)]
correct the .PATH for access to scvesactl.c

Report-by: David Rhodus <drhodus@catpa.com>
20 years agoHave lwkt_reltoken() return the generation number to facilitate checks
Matthew Dillon [Wed, 15 Oct 2003 23:27:06 +0000 (23:27 +0000)]
Have lwkt_reltoken() return the generation number to facilitate checks
for stolen tokens.  Cleanup, optimize, and better document lwkt_gentoken().

20 years agoFix an inherited bug in ptrace's PT_IO. The wrong thread was being assigned
Matthew Dillon [Wed, 15 Oct 2003 21:52:38 +0000 (21:52 +0000)]
Fix an inherited bug in ptrace's PT_IO.  The wrong thread was being assigned
to the UIO.

20 years agoSecond contigmalloc() cleanup:
Hiten Pandya [Wed, 15 Oct 2003 16:48:04 +0000 (16:48 +0000)]
Second contigmalloc() cleanup:

* Move the contigmalloc/vm_contig_pg API into its own
  file, vm_contig.c.

* Give contigmalloc1() a more sensible to reflect its
  purpose, contigmalloc_map().

20 years agoMajor contigmalloc() API cleanup:
Hiten Pandya [Wed, 15 Oct 2003 16:03:04 +0000 (16:03 +0000)]
Major contigmalloc() API cleanup:

    * split the contigmalloc() function into two distinct
      functions:

        - vm_contig_pg_alloc(): this function does the alloc
          of contiguous pages.

        - vm_contig_pg_kmap(): this function maps the allocated
          range of pages into a VM map (i.e. kernel map).

    * remove the duplicated page queue flush management handling
      and put it into a separate function, vm_contig_pg_clean().

The split is important for some special case drivers, which
like to allocated >2G contig memory, and then mmpa(2) it to
userland for various purposes.

By splitting, the contigmalloc/vm_contig_pg API does not
enforce the client to map the contiguous pages into the
KVA, which would have otherwise failed the allocation.

These functions will probably be moved to their own file
some time soon.

Reviewed/Approved/Tested by: Matt Dillon

20 years agoRemove zalloci/zfreei from the Makefile too.
Hiten Pandya [Wed, 15 Oct 2003 15:37:58 +0000 (15:37 +0000)]
Remove zalloci/zfreei from the Makefile too.

20 years agoNuke the zalloci() and zfree() stuff sky-high. We no longer have
Hiten Pandya [Wed, 15 Oct 2003 15:36:44 +0000 (15:36 +0000)]
Nuke the zalloci() and zfree() stuff sky-high.  We no longer have
those functions as zalloc/zfree are interrupt and MP safe.

20 years agoI wasn't properly checking for rollover in iovec_copyin(). Remove code
David P. Reese, Jr. [Wed, 15 Oct 2003 08:43:37 +0000 (08:43 +0000)]
I wasn't properly checking for rollover in iovec_copyin().  Remove code
that ineffectively checks for rollover by checking if a size_t was ever
less than zero (duh).

Add the proper error checking to kern_sendmsg() and kern_recvmsg() which
recieve a uio structure that was populated with the aid of iovec_copyin().

20 years agoRename do_dup() to kern_dup() and pull in some changes from FreeBSD-CURRENT.
David P. Reese, Jr. [Wed, 15 Oct 2003 06:38:46 +0000 (06:38 +0000)]
Rename do_dup() to kern_dup() and pull in some changes from FreeBSD-CURRENT.
Implement dup(), dup2() and fcntl(F_DUPFD) with kern_dup().

Split fcntl() into fcntl() and kern_fcntl().

Implement linux_fcntl() using kern_fcntl() and replace a call to fcntl()
in linux_accept() with a call to kern_fcntl().

20 years agoUpdate the sys_sig* manual page to include portability suggestions.
Matthew Dillon [Tue, 14 Oct 2003 23:13:05 +0000 (23:13 +0000)]
Update the sys_sig* manual page to include portability suggestions.

20 years agoNSIG is now 64. Extend the siglist arrays to match.
Matthew Dillon [Tue, 14 Oct 2003 23:04:10 +0000 (23:04 +0000)]
NSIG is now 64.  Extend the siglist arrays to match.

20 years ago/bin/sh needs to use sys_nsig, not NSIG, when accessing static arrays
Matthew Dillon [Tue, 14 Oct 2003 23:03:08 +0000 (23:03 +0000)]
/bin/sh needs to use sys_nsig, not NSIG, when accessing static arrays
defined in libc.  /bin/sh also needs to check for NULL entries.

20 years agoMake sure PORTSDIR is not in the environment when bootstrapping a
Matthew Dillon [Mon, 13 Oct 2003 23:57:41 +0000 (23:57 +0000)]
Make sure PORTSDIR is not in the environment when bootstrapping a
DragonFly port from a FreeBSD port.

20 years agoAdd checkpoint tty signaling support to stty and tcsh. The signal
Matthew Dillon [Mon, 13 Oct 2003 21:24:29 +0000 (21:24 +0000)]
Add checkpoint tty signaling support to stty and tcsh.  The signal
defaults to '^E'.

20 years agoOops, I gave Kip bad advise. The checkpoint execution code is supposed
Matthew Dillon [Mon, 13 Oct 2003 21:16:42 +0000 (21:16 +0000)]
Oops, I gave Kip bad advise.  The checkpoint execution code is supposed
to be in issignal(), not psignal()!

20 years agoStart separating the ucred from NDINIT.
Matthew Dillon [Mon, 13 Oct 2003 21:16:10 +0000 (21:16 +0000)]
Start separating the ucred from NDINIT.

20 years agoFix miscellanious kern_fp.c bugs.
Matthew Dillon [Mon, 13 Oct 2003 21:15:48 +0000 (21:15 +0000)]
Fix miscellanious kern_fp.c bugs.

20 years agoUse the one remaining free termios control character slot for a tty
Matthew Dillon [Mon, 13 Oct 2003 21:08:50 +0000 (21:08 +0000)]
Use the one remaining free termios control character slot for a tty
checkpoint capability, which defaults to ^E and sends the SIGCKPT signal.

20 years agoExtend NSIG to 64 and introduce a registration function for the checkpointing
Matthew Dillon [Mon, 13 Oct 2003 18:12:07 +0000 (18:12 +0000)]
Extend NSIG to 64 and introduce a registration function for the checkpointing
signal to support the checkpoint module.  This is somewhat of a hack at the
moment but will be cleaned up later.

Submitted-by: Kip Macy <kmacy@fsmware.com>
20 years agoAugment falloc() to support thread-only file pointers (with no integer file
Matthew Dillon [Mon, 13 Oct 2003 18:01:28 +0000 (18:01 +0000)]
Augment falloc() to support thread-only file pointers (with no integer file
descriptor or process).

Add new generic 'easy to use' fp_*() kernel functions which operate on file
pointers.  This will greatly ease in-kernel functions which must open,
perform I/O, and close files.

Adopted from: other kernel sources and Kip Macy's checkpoint code.

20 years agoAdd bsd.dfport.pre.mk and bsd.dfport.post.mk to the Makefile
Matthew Dillon [Mon, 13 Oct 2003 15:06:58 +0000 (15:06 +0000)]
Add bsd.dfport.pre.mk and bsd.dfport.post.mk to the Makefile

20 years agoadd /usr/share/examples/splash to the mtree, for installworld.
Matthew Dillon [Mon, 13 Oct 2003 08:43:56 +0000 (08:43 +0000)]
add /usr/share/examples/splash to the mtree, for installworld.

20 years agoFix an ordering issue, call vm_map_entry_reserve() prior to locking
Hiten Pandya [Mon, 13 Oct 2003 07:03:40 +0000 (07:03 +0000)]
Fix an ordering issue, call vm_map_entry_reserve() prior to locking
the map.

Noticed by: Matt

20 years agoAMI MegaRAID Crash-Dumps support.
Hiten Pandya [Mon, 13 Oct 2003 06:56:13 +0000 (06:56 +0000)]
AMI MegaRAID Crash-Dumps support.

Special thanks to Paul Saab (ps@FreeBSD.ORG) for providing the patch.

20 years agoImplement socket() and shutdown() using the in-kernel syscalls. This
David P. Reese, Jr. [Mon, 13 Oct 2003 04:58:13 +0000 (04:58 +0000)]
Implement socket() and shutdown() using the in-kernel syscalls.  This
commit completely removes COMPAT_43 and stackgap allocations from
linux_socket.c.

20 years agoFix kldload(2) error return when a module is rejected becaue it is
Hiten Pandya [Mon, 13 Oct 2003 04:16:51 +0000 (04:16 +0000)]
Fix kldload(2) error return when a module is rejected becaue it is
statically linked into the kernel.  This is due to a problem in the
linker code.  The EEXIST code which was returned was not reported
and instead an ENOEXEC was returned incorrectly, thus making stuff
like sysinstall act weirdly.

Obtained from: FreeBSD 5.x

20 years agoAdd a splash example / DragonFly BMP
Matthew Dillon [Mon, 13 Oct 2003 03:15:26 +0000 (03:15 +0000)]
Add a splash example / DragonFly BMP

Supplied-by: Emiel Kollof <coolvibe@hackerheaven.org>
20 years agoFix compile when GUPROF is defined.
Hiten Pandya [Sun, 12 Oct 2003 23:38:53 +0000 (23:38 +0000)]
Fix compile when GUPROF is defined.

I.e. add cpu_ prefix to disable_intr() and enable_intr().

20 years ago* Pull is some security checks from sendmail 8.12.10.
David Rhodus [Sun, 12 Oct 2003 16:56:26 +0000 (16:56 +0000)]
* Pull is some security checks from sendmail 8.12.10.

Discussed with: Greg Shapiro and Matt Dillon

20 years agoMore hacks to support DragonFly port overrides. Deal with ports which
Matthew Dillon [Sun, 12 Oct 2003 01:43:59 +0000 (01:43 +0000)]
More hacks to support DragonFly port overrides.  Deal with ports which
use bsd.port.pre.mk and bsd.port.post.mk.

20 years agoFix bugs introduced from the last commit. The loadav routine somehow got
Matthew Dillon [Sun, 12 Oct 2003 00:52:48 +0000 (00:52 +0000)]
Fix bugs introduced from the last commit.  The loadav routine somehow got
deleted, and other minor things.

20 years agodocument the new fdisk option.
Matthew Dillon [Sun, 12 Oct 2003 00:45:24 +0000 (00:45 +0000)]
document the new fdisk option.

20 years agoAdd a -p option to fdisk that allows it to operate on normal files which
Matthew Dillon [Sun, 12 Oct 2003 00:43:17 +0000 (00:43 +0000)]
Add a -p option to fdisk that allows it to operate on normal files which
represent disk images.

20 years agoUpgrade isc-dhcp, e.g. dhclient.
Matthew Dillon [Sat, 11 Oct 2003 21:14:25 +0000 (21:14 +0000)]
Upgrade isc-dhcp, e.g. dhclient.

Taken-from: FreeBSD-current

20 years agoadd bsd.dfport.pre.mk and bsd.dfport.post.mk, part of the DragonFly ports
Matthew Dillon [Sat, 11 Oct 2003 21:08:33 +0000 (21:08 +0000)]
add bsd.dfport.pre.mk and bsd.dfport.post.mk, part of the DragonFly ports
override mechanism.

20 years ago* Add missing function declaration that was some how
David Rhodus [Sat, 11 Oct 2003 19:30:42 +0000 (19:30 +0000)]
* Add missing function declaration that was some how
missed during inital ACPI import.

20 years ago* Move variable 'p' into a more proper place.
David Rhodus [Sat, 11 Oct 2003 19:04:58 +0000 (19:04 +0000)]
* Move variable 'p' into a more proper place.

20 years ago* Add this nice filesystem testing tool that I've recently
David Rhodus [Sat, 11 Oct 2003 13:37:14 +0000 (13:37 +0000)]
* Add this nice filesystem testing tool that I've recently
missed having close by.

20 years agoCorrect unsafe use of realloc().
Hiten Pandya [Sat, 11 Oct 2003 11:38:44 +0000 (11:38 +0000)]
Correct unsafe use of realloc().

Obtained from: FreeBSD (KAME commit by Hajimu UMEMOTO)

20 years agoSecurity Fix:
Hiten Pandya [Sat, 11 Oct 2003 09:56:48 +0000 (09:56 +0000)]
Security Fix:

     Fix a BSS buffer overflow caused by makeargv() writing past the
     end of margv[] when an input line contains 20 or more space
     separated words.

Obtained from: FreeBSD

20 years agoData reads and writes should not need credentials, and most filesystems
Matthew Dillon [Fri, 10 Oct 2003 22:01:13 +0000 (22:01 +0000)]
Data reads and writes should not need credentials, and most filesystems
ignore the ucred argument.  NFS does, though, and FreeBSD-4.x had some
terrible hacks to associate credentials with data that only 'mostly' worked.
There were VM paging and buffer reconstitution cases which broke the
credentials even in 4.x.  The hacks were removed from DragonFly during
the VFS messaging reorganization.

In DragonFly credentials are checked on open() but no credentials are
required for read and write ops.  I had NFS just use the 'root' credential
for the RPC.  However, this breaks NFS mounts which do not use the -maproot
(server side) directive.  Really the bug is on the server side, but to
maintain general compatibility with NFS servers we have to provide a
non-root credential if root did not issue the I/O.  This commit hacks up
the NFS code (rather then hacking up the rest of the kernel) to restore
the hacks that were previously removed from the kernel.  Unfortunately it
can lead to a proliferation of ucred structures (FreeBSD-4.x did as well),
but that's the price we have to pay for now.

Report-by: Galen Sampson <galen_sampson@yahoo.com>
20 years agonamecache work stage 3a: Adjust the VFS APIs to include a namecache pointer
Matthew Dillon [Thu, 9 Oct 2003 22:27:27 +0000 (22:27 +0000)]
namecache work stage 3a: Adjust the VFS APIs to include a namecache pointer
where necessary.  For the moment we pass NULL for these parameters (the old
'dvp' vnode pointer's cannot be ripped out quite yet).

20 years agoSync with FreeBSD-5, fix-up the use of certain flags variables.
Matthew Dillon [Thu, 9 Oct 2003 15:39:36 +0000 (15:39 +0000)]
Sync with FreeBSD-5, fix-up the use of certain flags variables.

20 years agoUse the _KERNEL_STRUCTURES define to allow userland to bring in kernel
Matthew Dillon [Thu, 9 Oct 2003 03:31:33 +0000 (03:31 +0000)]
Use the _KERNEL_STRUCTURES define to allow userland to bring in kernel
structures without also bringing in kernel prototypes.

20 years agoDefine _KERNEL_STRUCTURES instead of _KERNEL to get just the
Matthew Dillon [Wed, 8 Oct 2003 20:06:15 +0000 (20:06 +0000)]
Define _KERNEL_STRUCTURES instead of _KERNEL to get just the
kernel structures without the kernel prototype pollution.

20 years agoAdd _KERNEL_STRUCTURES support for userland use of this header file.
Matthew Dillon [Wed, 8 Oct 2003 20:05:39 +0000 (20:05 +0000)]
Add _KERNEL_STRUCTURES support for userland use of this header file.

20 years agoFix a bug in the last commit where sendfile() would forget to drop a file
David P. Reese, Jr. [Wed, 8 Oct 2003 03:21:26 +0000 (03:21 +0000)]
Fix a bug in the last commit where sendfile() would forget to drop a file
pointer if the file wasn't of type DTYPE_VNODE.

20 years agoIntroduce the function iovec_copyin() and it's friend iovec_free().
David P. Reese, Jr. [Wed, 8 Oct 2003 01:30:32 +0000 (01:30 +0000)]
Introduce the function iovec_copyin() and it's friend iovec_free().
These remove a great deal of duplicate code in the syscall functions.
For those who like numbers, this patch uses iovec_copyin() four times
in uipc_syscalls.c, two times in linux_socket.c and two times in
43bsd_socket.c.  Would somebody please comment on the inclusion of
sys/malloc.h in sys/uio.h?

Remove sockargs() which was used once in the svr4 emulation code.  It
is replaced with a small piece of code that gets an mbuf and copyin()'s
to it's data region.

Remove the osendfile() syscall which was inapropriately named and placed
in the COMPAT_43 code where it doesn't belong.

Split the socket(), shutdown() and sendfile() syscalls.  All of the
syscalls in kern/uipc_syscalls.c are now split.

Prevent a panic due to m_freem()'ing a dangling pointer in recvmsg(),
orecvmsg(), linux_recvmsg().

This patch completely removes COMPAT_43 from kern/uipc_syscalls.c.

20 years agoDisable background bitmap writes. They appear to cause at least two race
Matthew Dillon [Wed, 8 Oct 2003 00:10:56 +0000 (00:10 +0000)]
Disable background bitmap writes.  They appear to cause at least two race
conditions:  First, on MP systems even an LK_NOWAIT lock may block,
invalidating flags checks done just prior to the lock attempt.  Second, on
both MP and UP systems, the original buffer (origbp) may be modified during
the completion of a background write without its lock being held and these
modifications can race against mainline code that is also modifying the same
buffer with the lock held.

Eventually the problem background bitmap writes solved will be solved more
generally by implementing page COWing durign device I/O to avoid stalls on
pages undergoing write I/O.

20 years agoThe splash_bmp and splash_pcx builds were missing some symbols, add the
Matthew Dillon [Mon, 6 Oct 2003 17:19:38 +0000 (17:19 +0000)]
The splash_bmp and splash_pcx builds were missing some symbols, add the
appropriate files to the Makefile.

20 years agoUnroll obfuscated loop.
Jeffrey Hsu [Mon, 6 Oct 2003 06:08:23 +0000 (06:08 +0000)]
Unroll obfuscated loop.

20 years agoThe CMOV family of instructions do not work across all cpu families. In
Matthew Dillon [Sun, 5 Oct 2003 23:06:45 +0000 (23:06 +0000)]
The CMOV family of instructions do not work across all cpu families.  In
particular they do not work on some of the oldest pentiums or 486's, and
probably do not work on some non-intel cpus either.

Replace the cmovcl in the preload code's inline assembly with a jnc/movl
combination.

Located by the persistence of:  Galen Sampson <galen_sampson@yahoo.com>

20 years ago* Fix a typo that was introduced from the last change.
David Rhodus [Sun, 5 Oct 2003 20:08:41 +0000 (20:08 +0000)]
* Fix a typo that was introduced from the last change.

20 years ago* Correct several integer underflows/overflows in linprocfs
David Rhodus [Sun, 5 Oct 2003 20:04:08 +0000 (20:04 +0000)]
* Correct several integer underflows/overflows in linprocfs
  by making use od the uiomove_frombuf routine.

Reported by:    Joost Pol <joost@pine.nl>

20 years ago* Try to make gencat(1) recognize.
David Rhodus [Sun, 5 Oct 2003 16:51:39 +0000 (16:51 +0000)]
* Try to make gencat(1) recognize.

20 years agoFix a spelling mistake.
Hiten Pandya [Sun, 5 Oct 2003 16:12:00 +0000 (16:12 +0000)]
Fix a spelling mistake.

20 years agoK&R style function removal. Update functions to ANSI style.
Hiten Pandya [Sat, 4 Oct 2003 20:36:55 +0000 (20:36 +0000)]
K&R style function removal.  Update functions to ANSI style.

While I am there, add $DragonFly$ IDs to these files, or the
commit just busts up.  Also fixup C Style comments on the
files.

Patch has been tested by submitter and me.

Submitted by: Eirik Nygaard <eirikn@bluezone.no>
Reviewed by: Hiten Pandya

20 years agoModify linux_{send,recv}msg() and linux_{set,get}sockopt() to use the
David P. Reese, Jr. [Sat, 4 Oct 2003 02:12:51 +0000 (02:12 +0000)]
Modify linux_{send,recv}msg() and linux_{set,get}sockopt() to use the
split syscalls.

Add a sanity check to linux_copyout_sockaddr().

Remove two functions that used stackgap allocations.

20 years agoModify kern_{send,recv}msg() to take struct uio's, not struct msghdr's.
David P. Reese, Jr. [Fri, 3 Oct 2003 00:04:04 +0000 (00:04 +0000)]
Modify kern_{send,recv}msg() to take struct uio's, not struct msghdr's.
Fix up all syscalls which use these functions, including the 43bsd
syscalls.

Also, fix some spots where I forgot to pass the message flags in the
emulation code.

20 years agoAddendum: Many thanks for continuing to Galen Sampson for running such an
Matthew Dillon [Thu, 2 Oct 2003 22:29:15 +0000 (22:29 +0000)]
Addendum:  Many thanks for continuing to Galen Sampson for running such an
old platform, that brought all the bugs found in the prior commit to light.

20 years agoFix a number of interrupt related issues.
Matthew Dillon [Thu, 2 Oct 2003 22:27:00 +0000 (22:27 +0000)]
Fix a number of interrupt related issues.

* Don't access kernel_map in free(), defer such operations to malloc()

* Fix a slab allocator panic due to mishandling of malloc size slab
  limit checks on machines with small amounts of memory (the slab allocator
  reduces the size of the zone on low-memory machines but did not handle the
  reduced size properly).

* Add thread->td_nest_count to prevent splz recursions from underflowing
  the kernel stack.  This can occur because we drop the critical section
  when calling sched_ithd() in order to allow it to preempt.

* Properly adjust intr_nesting_level around FAST interrupts

* Adjust the debugging printf() in lockmgr to only complain about blockable
  lock requests from interrupts.

20 years agoRename:
Hiten Pandya [Thu, 2 Oct 2003 21:00:20 +0000 (21:00 +0000)]
Rename:

- vm_map_pageable() -> vm_map_wire()
- vm_map_user_pageable() -> vm_map_unwire()

20 years ago * Turn on debugging options by default
David Rhodus [Thu, 2 Oct 2003 19:45:40 +0000 (19:45 +0000)]
 * Turn on debugging options by default

20 years agocorrect a comment.
Matthew Dillon [Thu, 2 Oct 2003 19:26:35 +0000 (19:26 +0000)]
correct a comment.

20 years agoDescribe the hw.physmem loader variable.
Matthew Dillon [Thu, 2 Oct 2003 19:24:10 +0000 (19:24 +0000)]
Describe the hw.physmem loader variable.

20 years ago Introduce a uiomove_frombuf helper routine that handles computing and
David Rhodus [Thu, 2 Oct 2003 19:21:06 +0000 (19:21 +0000)]
 Introduce a uiomove_frombuf helper routine that handles computing and
 validating the offset within a given memory buffer before handing the
 real work off to uiomove(9).

 Use uiomove_frombuf in procfs to correct several issues with
 integer arithmetic that could result in underflows/overflows.  As a
 side-effect, the code is significantly simplified.

 Add additional sanity checks when computing a memory allocation size
 in pfs_read.

 Reported by:    Joost Pol <joost@pine.nl>  (integer underflows/overflows)
 Originated from: FreeBSD

20 years agoK&R style function removal. Update functions to ANSI style.
Hiten Pandya [Thu, 2 Oct 2003 17:42:27 +0000 (17:42 +0000)]
K&R style function removal.  Update functions to ANSI style.

Patch has been tested.

Submitted by: Eirik Nygaard <eirikn@bluezone.no>
Reviewed by: Hiten Pandya