Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/kern/kern_exec.c

[BACK] Up to [FreeBSD] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.365.2.3: download - view: text, markup, annotated - select for diffs
Thu Feb 9 10:30:45 2012 UTC (14 hours, 24 minutes ago) by kib
Branches: RELENG_9
Diff to: previous 1.365.2.2: preferred, colored; branchpoint 1.365: preferred, colored; next MAIN 1.366: preferred, colored
Changes since revision 1.365.2.2: +8 -5 lines
SVN rev 231268 on 2012-02-09 10:30:45Z by kib

MFC r230341:
Use shared lock for the executable vnode in the exec path after the
VV_TEXT changes are handled. Assert that vnode is exclusively locked at
the places that modify VV_TEXT.

Revision 1.367: download - view: text, markup, annotated - select for diffs
Thu Jan 19 23:03:31 2012 UTC (3 weeks ago) by kib
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.366: preferred, colored
Changes since revision 1.366: +8 -5 lines
SVN rev 230341 on 2012-01-19 23:03:31Z by kib

Use shared lock for the executable vnode in the exec path after the
VV_TEXT changes are handled. Assert that vnode is exclusively locked at
the places that modify VV_TEXT.

Discussed with:	alc
MFC after:	3 weeks

Revision 1.365.2.2.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.365.2.2: preferred, colored; next MAIN 1.365.2.3: preferred, colored
Changes since revision 1.365.2.2: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.337.2.10: download - view: text, markup, annotated - select for diffs
Tue Oct 11 13:54:20 2011 UTC (3 months, 4 weeks ago) by kib
Branches: RELENG_8
Diff to: previous 1.337.2.9: preferred, colored; branchpoint 1.337: preferred, colored; next MAIN 1.338: preferred, colored
Changes since revision 1.337.2.9: +0 -11 lines
SVN rev 226256 on 2011-10-11 13:54:20Z by kib

MFC r225791:
Do not deliver SIGTRAP on exec as the normal signal, use ptracestop() on
syscall exit path. Otherwise, if SIGTRAP is ignored, that tdsendsignal()
do not want to deliver the signal, and debugger never get a notification
of exec.

Revision 1.365.2.2: download - view: text, markup, annotated - select for diffs
Tue Oct 11 13:18:44 2011 UTC (3 months, 4 weeks ago) by kib
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.365.2.1: preferred, colored; branchpoint 1.365: preferred, colored
Changes since revision 1.365.2.1: +0 -10 lines
SVN rev 226248 on 2011-10-11 13:18:44Z by kib

MFC r225791:
Do not deliver SIGTRAP on exec as the normal signal, use ptracestop() on
syscall exit path. Otherwise, if SIGTRAP is ignored, that tdsendsignal()
do not want to deliver the signal, and debugger never get a notification
of exec.

Approved by:	re (bz)

Revision 1.366: download - view: text, markup, annotated - select for diffs
Tue Sep 27 13:17:02 2011 UTC (4 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.365: preferred, colored
Changes since revision 1.365: +0 -10 lines
SVN rev 225791 on 2011-09-27 13:17:02Z by kib

Do not deliver SIGTRAP on exec as the normal signal, use ptracestop() on
syscall exit path. Otherwise, if SIGTRAP is ignored, that tdsendsignal()
do not want to deliver the signal, and debugger never get a notification
of exec.

Found and tested by:	Anton Yuzhaninov <citrin citrin ru>
Discussed with:	jhb
MFC after:	2 weeks

Revision 1.365.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
Diff to: previous 1.365: preferred, colored
Changes since revision 1.365: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.365: download - view: text, markup, annotated - select for diffs
Fri Sep 16 13:58:51 2011 UTC (4 months, 3 weeks ago) by kmacy
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.364: preferred, colored
Changes since revision 1.364: +3 -3 lines
SVN rev 225617 on 2011-09-16 13:58:51Z by kmacy

In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)

Revision 1.364: download - view: text, markup, annotated - select for diffs
Thu Aug 11 12:30:23 2011 UTC (6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.363: preferred, colored
Changes since revision 1.363: +5 -1 lines
SVN rev 224778 on 2011-08-11 12:30:23Z by rwatson

Second-to-last commit implementing Capsicum capabilities in the FreeBSD
kernel for FreeBSD 9.0:

Add a new capability mask argument to fget(9) and friends, allowing system
call code to declare what capabilities are required when an integer file
descriptor is converted into an in-kernel struct file *.  With options
CAPABILITIES compiled into the kernel, this enforces capability
protection; without, this change is effectively a no-op.

Some cases require special handling, such as mmap(2), which must preserve
information about the maximum rights at the time of mapping in the memory
map so that they can later be enforced in mprotect(2) -- this is done by
narrowing the rights in the existing max_protection field used for similar
purposes with file permissions.

In namei(9), we assert that the code is not reached from within capability
mode, as we're not yet ready to enforce namespace capabilities there.
This will follow in a later commit.

Update two capability names: CAP_EVENT and CAP_KEVENT become
CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they
represent.

Approved by:	re (bz)
Submitted by:	jonathan
Sponsored by:	Google Inc

Revision 1.363: download - view: text, markup, annotated - select for diffs
Sun Jul 17 23:05:24 2011 UTC (6 months, 3 weeks ago) by rwatson
Branches: MAIN
Diff to: previous 1.362: preferred, colored
Changes since revision 1.362: +3 -2 lines
SVN rev 224159 on 2011-07-17 23:05:24Z by rwatson

Define two new sysctl node flags: CTLFLAG_CAPRD and CTLFLAG_CAPRW, which
may be jointly referenced via the mask CTLFLAG_CAPRW.  Sysctls with these
flags are available in Capsicum's capability mode; other sysctl nodes are
not.

Flag several useful sysctls as available in capability mode, such as memory
layout sysctls required by the run-time linker and malloc(3).  Also expose
access to randomness and available kernel features.

A few sysctls are enabled to support name->MIB conversion; these may leak
information to capability mode by virtue of providing resolution on names
not flagged for access in capability mode.  This is, generally, not a huge
problem, but might be something to resolve in the future.  Flag these cases
with XXX comments.

Submitted by:	jonathan
Sponsored by:	Google, Inc.

Revision 1.362: download - view: text, markup, annotated - select for diffs
Thu Jun 30 10:56:02 2011 UTC (7 months, 1 week ago) by jonathan
Branches: MAIN
Diff to: previous 1.361: preferred, colored
Changes since revision 1.361: +24 -0 lines
SVN rev 223692 on 2011-06-30 10:56:02Z by jonathan

Add some checks to ensure that Capsicum is behaving correctly, and add some
more explicit comments about what's going on and what future maintainers
need to do when e.g. adding a new operation to a sys_machdep.c.

Approved by: mentor(rwatson), re(bz)

Revision 1.308.2.17: download - view: text, markup, annotated - select for diffs
Sat Apr 2 10:31:41 2011 UTC (10 months, 1 week ago) by dchagin
Branches: RELENG_7
Diff to: previous 1.308.2.16: preferred, colored; branchpoint 1.308: preferred, colored; next MAIN 1.309: preferred, colored
Changes since revision 1.308.2.16: +0 -6 lines
SVN rev 220277 on 2011-04-02 10:31:41Z by dchagin

Revert r220263, SV_ABI patches was never merged to 7.

Revision 1.308.2.16: download - view: text, markup, annotated - select for diffs
Sat Apr 2 06:25:13 2011 UTC (10 months, 1 week ago) by dchagin
Branches: RELENG_7
Diff to: previous 1.308.2.15: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.15: +6 -0 lines
SVN rev 220263 on 2011-04-02 06:25:13Z by dchagin

MFC r219041:

ktrace_resize_pool() locking slightly reworked:
1) do not take a lock around the single atomic operation.
2) do not lose the invariant of lock by dropping/acquiring
   ktrace_mtx around free() or malloc().

MFC r219042:

Introduce preliminary support of the show description of the ABI of
traced process by adding two new events which records value of process
sv_flags to the trace file at process creation/execing/exiting time.

MFC r219311:

Partially rework r219042.
The reason for this is a bug at ktrops() where process dereferenced
without having a lock. This might cause a panic if ktrace was runned
with -p flag and the specified process exited between the dropping
a lock and writing sv_flags.

Since it is impossible to acquire sx lock while holding mtx switch
to use asynchronous enqueuerequest() instead of writerequest().

Rename ktr_getrequest_ne() to more understandable name.

MFC r219312:

Fix indentation in comment, double ';' in variable declaration.

PR:		ports/155083

Revision 1.337.2.9: download - view: text, markup, annotated - select for diffs
Sat Apr 2 06:13:31 2011 UTC (10 months, 1 week ago) by dchagin
Branches: RELENG_8
Diff to: previous 1.337.2.8: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.8: +6 -0 lines
SVN rev 220262 on 2011-04-02 06:13:31Z by dchagin

MFC r219041:

ktrace_resize_pool() locking slightly reworked:
1) do not take a lock around the single atomic operation.
2) do not lose the invariant of lock by dropping/acquiring
   ktrace_mtx around free() or malloc().

MFC r219042:

Introduce preliminary support of the show description of the ABI of
traced process by adding two new events which records value of process
sv_flags to the trace file at process creation/execing/exiting time.

MFC r219311:

Partially rework r219042.
The reason for this is a bug at ktrops() where process dereferenced
without having a lock. This might cause a panic if ktrace was runned
with -p flag and the specified process exited between the dropping
a lock and writing sv_flags.

Since it is impossible to acquire sx lock while holding mtx switch
to use asynchronous enqueuerequest() instead of writerequest().

Rename ktr_getrequest_ne() to more understandable name.

MFC r219312:

Fix indentation in comment, double ';' in variable declaration.

Revision 1.337.2.8: download - view: text, markup, annotated - select for diffs
Mon Feb 28 23:28:35 2011 UTC (11 months, 1 week ago) by rwatson
Branches: RELENG_8
Diff to: previous 1.337.2.7: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.7: +3 -3 lines
SVN rev 219107 on 2011-02-28 23:28:35Z by rwatson

Merge userspace DTrace support from head to stable/8:

r209721:

  Merge from vendor-sys/opensolaris:
  * add fasttrap files

r209731:

  Introduce USD_{SET,GET}{BASE,LIMIT}. These help setting up the user
  segment descriptor hi and lo values. Idea from Solaris.

  Reviewed by:  kib

r209763:

  Fix style issues with the previous commit, namely
  use-tab-instead-of-space and don't use underscores in macro variables.

  Pointed out by:       bde

r210292:

  Fix typo in comment.

r210357:

  MFamd64:
    Add USD_GETBASE(), USD_SETBASE(), USD_GETLIMIT() and USD_SETLIMIT().

r210611:

  Bump the witness pendlist to 768 to accomodate the increased number of
  spinlocks.

r211553:

  Add sysname to struct opensolaris_utsname. This is needed by one DTrace
  test.

r211566:

  Add a sysname char * to struct opensolaris_utsname.

r211606:

  Add the FreeBSD definition for the fasttrap ioctls.

r211607:

  Add a function compatibility function dtrace_instr_size_isa() that on
  FreeBSD does the same as dtrace_dis_isize().

r211608:

  Kernel DTrace support for:
  o uregs  (sson@)
  o ustack (sson@)
  o /dev/dtrace/helper device (needed for USDT probes)

r211610:

  Add more compatibility structure members needed by the upcoming fasttrap
  DTrace device.

r211611:

  Destroy the helper device when unloading.

r211613:

  Fix style issues.

r211614:

  Bump KDTRACE_THREAD_ZERO and use M_ZERO as a malloc flag instead of
  calling bzero.

r211615:

  Remove an elif and add an or-clause.

r211616:

  Add an extra comment to the SDT probes definition. This allows us to get
  use '-' in probe names, matching the probe names in Solaris.

  Add userland SDT probes definitions to sys/sdt.h.

r211617:

  Call the systrace_probe_func() when the error value.

r211618:

  Port this to FreeBSD. We miss some suword functions, so we use copyout.

r211738:

  Port the fasttrap provider to FreeBSD. This provider is responsible for
  injecting debugging probes in the userland programs and is the basis for
  the pid provider and the usdt provider.

r211744:

  MD fasttrap implementation.

r211745:

  Replace a pksignal() call with tdksignal().

  Pointed out by:       kib

r211746:

  Update for the recent location of the fasttrap code.

r211747:

  Replace structure assignments with explicity memcpy calls. This allows
  Clang to compile this file: it was using the builtin memcpy and we want
  to use the memcpy defined in gptboot.c. (Clang can't compile boot2 yet).

  Submitted by: Dimitry Andric <dimitry at andric.com>
  Reviewed by:  jhb

r211751:

  Add a trap code for DTrace induced traps.

r211752:

  Add two DTrace trap type values. Used by fasttrap.

r211753:

  Enable fasttrap and make dtraceall depend on fasttrap when building i386
  or amd64.

r211804:

  Call the necessary DTrace function pointers when we have different kinds
  of traps.

r211813:

  Add the necessary DTrace function pointers.

r211839:

  Sync DTrace bits with amd64 and fix the build.

r211924:

  Register an interrupt vector for DTrace return probes. There is some
  code missing in lapic to make sure that we don't overwrite this entry,
  but this will be done on a sequent commit.

r211925:

  Replace a memory barrier with a mutex barrier.

r211926:

  Add the path necessary to find fasttrap_isa.h to CFLAGS.

r211929:

  Remove debugging.

r212004:

  When DTrace is enabled, make sure we don't overwrite the IDT_DTRACE_RET
  entry with an IRQ for some hardware component.

  Reviewed by:  jhb

r212093:

  Make the /dev/dtrace/helper node have the mode 0660. This allows
  programs that refuse to run as root (pgsql) to install probes when their
  user is part of the wheel group.

r212357:

  Fix two bugs in DTrace:
  * when the process exits, remove the associated USDT probes
  * when the process forks, duplicate the USDT probes.

r212465:

  Avoid a LOR (sleepable after non-sleepable) in
  fasttrap_tracepoint_enable().

r212494:

  Revamp locking a bit. This fixes three problems:
  * processes now can't go away while we are inserting probes (fixes a panic)
  * if a trap happens, we won't be holding the process lock (fixes a hang)
  * fix a LOR between the process lock and the fasttrap bucket list lock

  Thanks to kib for pointing some problems.

r212568:

  Bump __FreeBSD_version to reflect the userland DTrace changes

Sponsored by:                   The FreeBSD Foundation
Userspace DTrace work by:       rpaulo

Revision 1.361: download - view: text, markup, annotated - select for diffs
Fri Feb 25 22:05:33 2011 UTC (11 months, 2 weeks ago) by dchagin
Branches: MAIN
Diff to: previous 1.360: preferred, colored
Changes since revision 1.360: +6 -0 lines
SVN rev 219042 on 2011-02-25 22:05:33Z by dchagin

Introduce preliminary support of the show description of the ABI of
traced process by adding two new events which records value of process
sv_flags to the trace file at process creation/execing/exiting time.

MFC after:	1 Month.

Revision 1.308.2.15: download - view: text, markup, annotated - select for diffs
Tue Jan 25 20:33:47 2011 UTC (12 months, 2 weeks ago) by jhb
Branches: RELENG_7
Diff to: previous 1.308.2.14: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.14: +2 -10 lines
SVN rev 217839 on 2011-01-25 20:33:47Z by jhb

MFC 211514,214158:
- There isn't really a need to hold the ktrace mutex just to read the
  value of p_traceflag that is stored in the kinfo_proc structure.
- When disabling ktracing on a process, free any pending requests that
  may be left.  This fixes a memory leak that can occur when tracing is
  disabled on a process via disabling tracing of a specific file (or if
  an I/O error occurs with the tracefile) if the process's next system
  call is exit().  The trace disabling code clears p_traceflag, so exit1()
  doesn't do any KTRACE-related cleanup leading to the leak.  I chose to
  make the free'ing of pending records synchronous rather than patching
  exit1().
- Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into
  kern_ktrace.c instead.  Make ktrace_mtx private to kern_ktrace.c as a
  result.

Revision 1.337.2.7: download - view: text, markup, annotated - select for diffs
Tue Jan 25 20:33:12 2011 UTC (12 months, 2 weeks ago) by jhb
Branches: RELENG_8
Diff to: previous 1.337.2.6: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.6: +2 -10 lines
SVN rev 217838 on 2011-01-25 20:33:12Z by jhb

MFC 211514,214158:
- There isn't really a need to hold the ktrace mutex just to read the
  value of p_traceflag that is stored in the kinfo_proc structure.
- When disabling ktracing on a process, free any pending requests that
  may be left.  This fixes a memory leak that can occur when tracing is
  disabled on a process via disabling tracing of a specific file (or if
  an I/O error occurs with the tracefile) if the process's next system
  call is exit().  The trace disabling code clears p_traceflag, so exit1()
  doesn't do any KTRACE-related cleanup leading to the leak.  I chose to
  make the free'ing of pending records synchronous rather than patching
  exit1().
- Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into
  kern_ktrace.c instead.  Make ktrace_mtx private to kern_ktrace.c as a
  result.

Revision 1.360: download - view: text, markup, annotated - select for diffs
Sat Jan 8 16:13:44 2011 UTC (13 months ago) by kib
Branches: MAIN
Diff to: previous 1.359: preferred, colored
Changes since revision 1.359: +85 -4 lines
SVN rev 217151 on 2011-01-08 16:13:44Z by kib

Create shared (readonly) page. Each ABI may specify the use of page by
setting SV_SHP flag and providing pointer to the vm object and mapping
address. Provide simple allocator to carve space in the page, tailored
to put the code with alignment restrictions.

Enable shared page use for amd64, both native and 32bit FreeBSD
binaries.  Page is private mapped at the top of the user address
space, moving a start of the stack one page down. Move signal
trampoline code from the top of the stack to the shared page.

Reviewed by:	 alc

Revision 1.308.2.14.2.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.308.2.14: preferred, colored; next MAIN 1.308.2.15: preferred, colored
Changes since revision 1.308.2.14: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.337.2.6.2.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.337.2.6: preferred, colored; next MAIN 1.337.2.7: preferred, colored
Changes since revision 1.337.2.6: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.308.2.14: download - view: text, markup, annotated - select for diffs
Wed Nov 17 18:21:29 2010 UTC (14 months, 3 weeks ago) by alc
Branches: RELENG_7
CVS tags: RELENG_7_4_BP
Branch point for: RELENG_7_4
Diff to: previous 1.308.2.13: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.13: +1 -1 lines
SVN rev 215433 on 2010-11-17 18:21:29Z by alc

MFC r209407, r209648, r209650
  Introduce and use vm_page_next() and vm_page_prev().  They provide both
  a simpler and faster interface for iterating over the pages of an object.

Revision 1.337.2.6: download - view: text, markup, annotated - select for diffs
Wed Nov 17 17:29:22 2010 UTC (14 months, 3 weeks ago) by alc
Branches: RELENG_8
CVS tags: RELENG_8_2_BP
Branch point for: RELENG_8_2
Diff to: previous 1.337.2.5: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.5: +1 -1 lines
SVN rev 215430 on 2010-11-17 17:29:22Z by alc

MFC r209407, r209648, r209650
  Introduce and use vm_page_next() and vm_page_prev().  They provide both
  a simpler and faster interface for iterating over the pages of an object.

Revision 1.337.2.5: download - view: text, markup, annotated - select for diffs
Wed Nov 3 21:21:12 2010 UTC (15 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.337.2.4: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.4: +4 -0 lines
SVN rev 214755 on 2010-11-03 21:21:12Z by kib

MFC r208453:
Reorganize syscall entry and leave handling.
Implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and
PL_FLAG_EXEC.

The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are
changed to use syscallenter()/syscallret(). MIPS and arm are not
converted and use the mostly unchanged syscall() implementation.

MFC r208514:
Change ia64' struct syscall_args definition so that args is a pointer to
the arguments array instead of array itself.

MFC r208566:
Allow to use syscallname(9) outside subr_trap.c.

MFC r209258 (by rpaulo):
Make DTrace syscall provider work again by including opt_kdtrace.h here.

MFC r209313:
Only enable kdtrace hook in the LINT on the architectures that implement it.

MFC r209697:
Obey sv_syscallnames bounds in syscallname().

NOTE: The KBI of the struct sysentvec is changed, new required members
sv_set_syscall_retval, sv_fetch_syscall_args and sv_syscallnames are
added. The sv_prepsyscall field is now ignored. Third-party modules
using the struct sysentvec must be modified and recompiled, we believe
that only ABI emulators are affected. No such out-of-tree modules are
known. In-tree modules that are affected by the change were converted
to depend on exact version of the kernel, see r214421.

Revision 1.359: download - view: text, markup, annotated - select for diffs
Thu Oct 21 19:17:40 2010 UTC (15 months, 2 weeks ago) by jhb
Branches: MAIN
Diff to: previous 1.358: preferred, colored
Changes since revision 1.358: +2 -10 lines
SVN rev 214158 on 2010-10-21 19:17:40Z by jhb

- When disabling ktracing on a process, free any pending requests that
  may be left.  This fixes a memory leak that can occur when tracing is
  disabled on a process via disabling tracing of a specific file (or if
  an I/O error occurs with the tracefile) if the process's next system
  call is exit().  The trace disabling code clears p_traceflag, so exit1()
  doesn't do any KTRACE-related cleanup leading to the leak.  I chose to
  make the free'ing of pending records synchronous rather than patching
  exit1().
- Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into
  kern_ktrace.c instead.  Make ktrace_mtx private to kern_ktrace.c as a
  result.

MFC after:	1 month

Revision 1.358: download - view: text, markup, annotated - select for diffs
Mon Aug 30 16:30:18 2010 UTC (17 months, 1 week ago) by jh
Branches: MAIN
Diff to: previous 1.357: preferred, colored
Changes since revision 1.357: +8 -8 lines
SVN rev 212002 on 2010-08-30 16:30:18Z by jh

execve(2) has a special check for file permissions: a file must have at
least one execute bit set, otherwise execve(2) will return EACCES even
for an user with PRIV_VFS_EXEC privilege.

Add the check also to vaccess(9), vaccess_acl_nfs4(9) and
vaccess_acl_posix1e(9). This makes access(2) to better agree with
execve(2). Because ZFS doesn't use vaccess(9) for VEXEC, add the check
to zfs_freebsd_access() too. There may be other file systems which are
not using vaccess*() functions and need to be handled separately.

PR:		kern/125009
Reviewed by:	bde, trasz
Approved by:	pjd (ZFS part)

Revision 1.357: download - view: text, markup, annotated - select for diffs
Sun Aug 22 11:18:57 2010 UTC (17 months, 2 weeks ago) by rpaulo
Branches: MAIN
Diff to: previous 1.356: preferred, colored
Changes since revision 1.356: +3 -3 lines
SVN rev 211616 on 2010-08-22 11:18:57Z by rpaulo

Add an extra comment to the SDT probes definition. This allows us to get
use '-' in probe names, matching the probe names in Solaris.[1]

Add userland SDT probes definitions to sys/sdt.h.

Sponsored by:	The FreeBSD Foundation
Discussed with:	rwaston [1]

Revision 1.356: download - view: text, markup, annotated - select for diffs
Tue Aug 17 08:55:45 2010 UTC (17 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.355: preferred, colored
Changes since revision 1.355: +28 -3 lines
SVN rev 211412 on 2010-08-17 08:55:45Z by kib

Supply some useful information to the started image using ELF aux vectors.
In particular, provide pagesize and pagesizes array, the canary value
for SSP use, number of host CPUs and osreldate.

Tested by:	marius (sparc64)
MFC after:	1 month

Revision 1.355: download - view: text, markup, annotated - select for diffs
Wed Jul 28 04:47:40 2010 UTC (18 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.354: preferred, colored
Changes since revision 1.354: +4 -0 lines
SVN rev 210555 on 2010-07-28 04:47:40Z by alc

The interpreter name should no longer be treated as a buffer that can be
overwritten.  (This change should have been included in r210545.)

Submitted by:	kib

Revision 1.354: download - view: text, markup, annotated - select for diffs
Tue Jul 27 17:31:03 2010 UTC (18 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.353: preferred, colored
Changes since revision 1.353: +23 -13 lines
SVN rev 210545 on 2010-07-27 17:31:03Z by alc

Introduce exec_alloc_args().  The objective being to encapsulate the
details of the string buffer allocation in one place.

Eliminate the portion of the string buffer that was dedicated to storing
the interpreter name.  The pointer to the interpreter name can simply be
made to point to the appropriate argument string.

Reviewed by:	kib

Revision 1.353: download - view: text, markup, annotated - select for diffs
Sun Jul 25 17:43:38 2010 UTC (18 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.352: preferred, colored
Changes since revision 1.352: +8 -6 lines
SVN rev 210475 on 2010-07-25 17:43:38Z by alc

Change the order in which the file name, arguments, environment, and
shell command are stored in exec*()'s demand-paged string buffer.  For
a "buildworld" on an 8GB amd64 multiprocessor, the new order reduces
the number of global TLB shootdowns by 31%.  It also eliminates about
330k page faults on the kernel address space.

Change exec_shell_imgact() to use "args->begin_argv" consistently as
the start of the argument and environment strings.  Previously, it
would sometimes use "args->buf", which is the start of the overall
buffer, but no longer the start of the argument and environment
strings.  While I'm here, eliminate unnecessary passing of "&length"
to copystr(), where we don't actually care about the length of the
copied string.

Clean up the initialization of the exec map.  In particular, use the
correct size for an entry, and express that size in the same way that
is used when an entry is allocated.  The old size was one page too
large.  (This discrepancy originated in 2004 when I rewrote
exec_map_first_page() to use sf_buf_alloc() instead of the exec map
for mapping the first page of the executable.)

Reviewed by:	kib

Revision 1.352: download - view: text, markup, annotated - select for diffs
Fri Jul 23 18:58:27 2010 UTC (18 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.351: preferred, colored
Changes since revision 1.351: +2 -3 lines
SVN rev 210429 on 2010-07-23 18:58:27Z by alc

Eliminate a little bit of duplicated code.

Revision 1.351: download - view: text, markup, annotated - select for diffs
Fri Jul 9 13:59:53 2010 UTC (19 months ago) by jhb
Branches: MAIN
Diff to: previous 1.350: preferred, colored
Changes since revision 1.350: +4 -4 lines
SVN rev 209848 on 2010-07-09 13:59:53Z by jhb

Accidentally committed an older version of this comment rather than the
final one.

Revision 1.350: download - view: text, markup, annotated - select for diffs
Fri Jul 9 13:53:25 2010 UTC (19 months ago) by jhb
Branches: MAIN
Diff to: previous 1.349: preferred, colored
Changes since revision 1.349: +4 -5 lines
SVN rev 209847 on 2010-07-09 13:53:25Z by jhb

Refine a comment.

Reviewed by:	bde

Revision 1.349: download - view: text, markup, annotated - select for diffs
Fri Jul 2 15:50:30 2010 UTC (19 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.348: preferred, colored
Changes since revision 1.348: +1 -1 lines
SVN rev 209648 on 2010-07-02 15:50:30Z by alc

Use vm_page_next() instead of vm_page_lookup() in exec_map_first_page()
because vm_page_next() is faster.

Revision 1.348: download - view: text, markup, annotated - select for diffs
Tue Jun 29 20:41:52 2010 UTC (19 months, 1 week ago) by jhb
Branches: MAIN
Diff to: previous 1.347: preferred, colored
Changes since revision 1.347: +2 -2 lines
SVN rev 209592 on 2010-06-29 20:41:52Z by jhb

Tweak the in-kernel API for sending signals to threads:
- Rename tdsignal() to tdsendsignal() and make it private to kern_sig.c.
- Add tdsignal() and tdksignal() routines that mirror psignal() and
  pksignal() except that they accept a thread as an argument instead of
  a process.  They send a signal to a specific thread rather than to an
  individual process.

Reviewed by:	kib

Revision 1.337.2.4.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 4 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.337.2.4: preferred, colored; next MAIN 1.337.2.5: preferred, colored
Changes since revision 1.337.2.4: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.347: download - view: text, markup, annotated - select for diffs
Sun May 23 18:32:02 2010 UTC (20 months, 2 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.346: preferred, colored
Changes since revision 1.346: +4 -0 lines
SVN rev 208453 on 2010-05-23 18:32:02Z by kib

Reorganize syscall entry and leave handling.

Extend struct sysvec with three new elements:
sv_fetch_syscall_args - the method to fetch syscall arguments from
  usermode into struct syscall_args. The structure is machine-depended
  (this might be reconsidered after all architectures are converted).
sv_set_syscall_retval - the method to set a return value for usermode
  from the syscall. It is a generalization of
  cpu_set_syscall_retval(9) to allow ABIs to override the way to set a
  return value.
sv_syscallnames - the table of syscall names.

Use sv_set_syscall_retval in kern_sigsuspend() instead of hardcoding
the call to cpu_set_syscall_retval().

The new functions syscallenter(9) and syscallret(9) are provided that
use sv_*syscall* pointers and contain the common repeated code from
the syscall() implementations for the architecture-specific syscall
trap handlers.

Syscallenter() fetches arguments, calls syscall implementation from
ABI sysent table, and set up return frame. The end of syscall
bookkeeping is done by syscallret().

Take advantage of single place for MI syscall handling code and
implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and
PL_FLAG_EXEC. The SCE and SCX flags notify the debugger that the
thread is stopped at syscall entry or return point respectively.  The
EXEC flag augments SCX and notifies debugger that the process address
space was changed by one of exec(2)-family syscalls.

The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are
changed to use syscallenter()/syscallret(). MIPS and arm are not
converted and use the mostly unchanged syscall() implementation.

Reviewed by:	jhb, marcel, marius, nwhitehorn, stas
Tested by:	marcel (ia64), marius (sparc64), nwhitehorn (powerpc),
	stas (mips)
MFC after:	1 month

Revision 1.346: download - view: text, markup, annotated - select for diffs
Thu May 6 18:58:32 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.345: preferred, colored
Changes since revision 1.345: +1 -3 lines
SVN rev 207728 on 2010-05-06 18:58:32Z by alc

Eliminate page queues locking around most calls to vm_page_free().

Revision 1.345: download - view: text, markup, annotated - select for diffs
Wed May 5 18:16:06 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.344: preferred, colored
Changes since revision 1.344: +2 -0 lines
SVN rev 207669 on 2010-05-05 18:16:06Z by alc

Acquire the page lock around all remaining calls to vm_page_free() on
managed pages that didn't already have that lock held.  (Freeing an
unmanaged page, such as the various pmaps use, doesn't require the page
lock.)

This allows a change in vm_page_remove()'s locking requirements.  It now
expects the page lock to be held instead of the page queues lock.
Consequently, the page queues lock is no longer required at all by callers
to vm_page_rename().

Discussed with: kib

Revision 1.344: download - view: text, markup, annotated - select for diffs
Fri Apr 30 00:46:43 2010 UTC (21 months, 1 week ago) by kmacy
Branches: MAIN
Diff to: previous 1.343: preferred, colored
Changes since revision 1.343: +4 -4 lines
SVN rev 207410 on 2010-04-30 00:46:43Z by kmacy

On Alan's advice, rather than do a wholesale conversion on a single
architecture from page queue lock to a hashed array of page locks
(based on a patch by Jeff Roberson), I've implemented page lock
support in the MI code and have only moved vm_page's hold_count
out from under page queue mutex to page lock. This changes
pmap_extract_and_hold on all pmaps.

Supported by: Bitgravity Inc.

Discussed with: alc, jeffr, and kib

Revision 1.343: download - view: text, markup, annotated - select for diffs
Thu Mar 25 14:31:26 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.342: preferred, colored
Changes since revision 1.342: +1 -0 lines
SVN rev 205643 on 2010-03-25 14:31:26Z by nwhitehorn

Add the ELF relocation base to struct image_params. This will be
required to correctly relocate the executable entry point's function
descriptor on powerpc64.

Revision 1.342: download - view: text, markup, annotated - select for diffs
Thu Mar 25 14:24:00 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.341: preferred, colored
Changes since revision 1.341: +3 -4 lines
SVN rev 205642 on 2010-03-25 14:24:00Z by nwhitehorn

Change the arguments of exec_setregs() so that it receives a pointer
to the image_params struct instead of several members of that struct
individually. This makes it easier to expand its arguments in the future
without touching all platforms.

Reviewed by:	jhb

Revision 1.341: download - view: text, markup, annotated - select for diffs
Wed Mar 24 03:13:24 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.340: preferred, colored
Changes since revision 1.340: +2 -2 lines
SVN rev 205574 on 2010-03-24 03:13:24Z by nwhitehorn

The nargvstr and nenvstr properties of arginfo are ints, not longs,
so should be copied to userspace with suword32() instead of suword().
This alleviates problems on 64-bit big-endian architectures, and is a
no-op on all 32-bit architectures.

Tested on:	amd64, sparc64, powerpc64

Revision 1.308.2.13.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (2 years ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.308.2.13: preferred, colored; next MAIN 1.308.2.14: preferred, colored
Changes since revision 1.308.2.13: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.308.2.13: download - view: text, markup, annotated - select for diffs
Thu Jan 21 19:17:42 2010 UTC (2 years ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_3_BP
Branch point for: RELENG_7_3
Diff to: previous 1.308.2.12: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.12: +1 -1 lines
SVN rev 202765 on 2010-01-21 19:17:42Z by jhb

MFC 198411:
- Fix several off-by-one errors when using MAXCOMLEN.  The p_comm[] and
  td_name[] arrays are actually MAXCOMLEN + 1 in size and a few places that
  created shadow copies of these arrays were just using MAXCOMLEN.
- Prefer using sizeof() of an array type to explicit constants for the
  array length in a few places.
- Ensure that all of p_comm[] is always zero'd during execve() to guard
  against any possible information leaks.  Previously trailing garbage in
  p_comm[] could be leaked to userland in ktrace record headers.

Revision 1.337.2.4: download - view: text, markup, annotated - select for diffs
Thu Jan 21 19:11:18 2010 UTC (2 years ago) by jhb
Branches: RELENG_8
CVS tags: RELENG_8_1_BP
Branch point for: RELENG_8_1
Diff to: previous 1.337.2.3: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.3: +7 -13 lines
SVN rev 202764 on 2010-01-21 19:11:18Z by jhb

MFC 198411:
- Fix several off-by-one errors when using MAXCOMLEN.  The p_comm[] and
  td_name[] arrays are actually MAXCOMLEN + 1 in size and a few places that
  created shadow copies of these arrays were just using MAXCOMLEN.
- Prefer using sizeof() of an array type to explicit constants for the
  array length in a few places.
- Ensure that all of p_comm[] and td_name[] is always zero'd during
  execve() to guard against any possible information leaks.  Previously
  trailing garbage in p_comm[] could be leaked to userland in ktrace
  record headers via td_name[].

Revision 1.308.2.12: download - view: text, markup, annotated - select for diffs
Tue Dec 22 20:05:09 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_7
Diff to: previous 1.308.2.11: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.11: +24 -2 lines
SVN rev 200864 on 2009-12-22 20:05:09Z by kib

MFC r189927:
Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and
compat32 binaries.

Note that the merge was edited due to fexecve(2) support not present in
stable/7.

Tested by:	bms, Mykola Dzham <freebsd levsha org ua>

Revision 1.337.2.3.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.337.2.3: preferred, colored; next MAIN 1.337.2.4: preferred, colored
Changes since revision 1.337.2.3: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.340: download - view: text, markup, annotated - select for diffs
Fri Oct 23 15:14:54 2009 UTC (2 years, 3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.339: preferred, colored
Changes since revision 1.339: +7 -13 lines
SVN rev 198411 on 2009-10-23 15:14:54Z by jhb

- Fix several off-by-one errors when using MAXCOMLEN.  The p_comm[] and
  td_name[] arrays are actually MAXCOMLEN + 1 in size and a few places that
  created shadow copies of these arrays were just using MAXCOMLEN.
- Prefer using sizeof() of an array type to explicit constants for the
  array length in a few places.
- Ensure that all of p_comm[] and td_name[] is always zero'd during
  execve() to guard against any possible information leaks.  Previously
  trailing garbage in p_comm[] could be leaked to userland in ktrace
  record headers via td_name[].

Reviewed by:	bde

Revision 1.308.2.11: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_7
Diff to: previous 1.308.2.10: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.10: +12 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.308.2.8.2.2: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_7_2
Diff to: previous 1.308.2.8.2.1: preferred, colored; branchpoint 1.308.2.8: preferred, colored; next MAIN 1.308.2.9: preferred, colored
Changes since revision 1.308.2.8.2.1: +12 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.308.2.6.2.2: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_7_1
Diff to: previous 1.308.2.6.2.1: preferred, colored; branchpoint 1.308.2.6: preferred, colored; next MAIN 1.308.2.7: preferred, colored
Changes since revision 1.308.2.6.2.1: +12 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.275.2.9: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6
Diff to: previous 1.275.2.8: preferred, colored; branchpoint 1.275: preferred, colored; next MAIN 1.276: preferred, colored
Changes since revision 1.275.2.8: +14 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.275.2.8.4.2: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6_4
Diff to: previous 1.275.2.8.4.1: preferred, colored; branchpoint 1.275.2.8: preferred, colored; next MAIN 1.275.2.9: preferred, colored
Changes since revision 1.275.2.8.4.1: +14 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.275.2.8.2.1: download - view: text, markup, annotated - select for diffs
Fri Oct 2 18:09:56 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_6_3
Diff to: previous 1.275.2.8: preferred, colored; next MAIN 1.275.2.9: preferred, colored
Changes since revision 1.275.2.8: +14 -3 lines
SVN rev 197715 on 2009-10-02 18:09:56Z by simon

MFC r197711 (partial) to 6.x and 7.x:

- Add no zero mapping feature, disabled by default. [EN-09:05]

MFC 178913,178914,179242,179243,180336,180340 to 6.x:

- Fix kqueue pipe race conditions. [SA-09:13]

MFC r192301 to 7.x; 6.x has slightly different fix:

- Fix devfs / VFS NULL pointer race condition. [SA-09:14]

Security:	FreeBSD-SA-09:13.pipe
Security:	FreeBSD-SA-09:14.devfs
Errata:		FreeBSD-EN-09:05.null
Submitted by:	kib [SA-09:13] [SA-09:14]
Submitted by:	bz [EN-09:05]
In collaboration with:	jhb, kib, alc [EN-09:05]
Approved by:	so (simon)

Revision 1.337.2.3: download - view: text, markup, annotated - select for diffs
Fri Oct 2 17:58:47 2009 UTC (2 years, 4 months ago) by simon
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.337.2.2: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.2: +12 -3 lines
SVN rev 197714 on 2009-10-02 17:58:47Z by simon

MFC r197711:

Add no zero mapping feature.

NOTE: Unlike in the other branches where this change will be "merged"
to, the 'no zero mapping' is enabled by default in stable/8.

Errata:		FreeBSD-EN-09:05.null
Approved by:	re (kib)

Revision 1.339: download - view: text, markup, annotated - select for diffs
Fri Oct 2 17:48:51 2009 UTC (2 years, 4 months ago) by bz
Branches: MAIN
Diff to: previous 1.338: preferred, colored
Changes since revision 1.338: +12 -3 lines
SVN rev 197711 on 2009-10-02 17:48:51Z by bz

Add a mitigation feature that will prevent user mappings at
virtual address 0, limiting the ability to convert a kernel
NULL pointer dereference into a privilege escalation attack.

If the sysctl is set to 0 a newly started process will not be able
to map anything in the address range of the first page (0 to PAGE_SIZE).
This is the default. Already running processes are not affected by this.

You can either change the sysctl or the tunable from loader in case
you need to map at a virtual address of 0, for example when running
any of the extinct species of a set of a.out binaries, vm86 emulation, ..
In that case set security.bsd.map_at_zero="1".

Superseeds:		r197537
In collaboration with:	jhb, kib, alc

Revision 1.337.2.2: download - view: text, markup, annotated - select for diffs
Sat Sep 12 18:05:57 2009 UTC (2 years, 4 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.337.2.1: preferred, colored; branchpoint 1.337: preferred, colored
Changes since revision 1.337.2.1: +2 -0 lines
SVN rev 197124 on 2009-09-12 18:05:57Z by kib

MFC r197031:
Unlock the image vnode around the call of pmc PMC_FN_PROCESS_EXEC hook.
The hook calls vn_fullpath(9), that should not be executed with a vnode
lock held.

Approved by:	re (kensmith)

Revision 1.338: download - view: text, markup, annotated - select for diffs
Wed Sep 9 10:52:36 2009 UTC (2 years, 5 months ago) by kib
Branches: MAIN
Diff to: previous 1.337: preferred, colored
Changes since revision 1.337: +2 -0 lines
SVN rev 197031 on 2009-09-09 10:52:36Z by kib

Unlock the image vnode around the call of pmc PMC_FN_PROCESS_EXEC hook.
The hook calls vn_fullpath(9), that should not be executed with a vnode
lock held.

Reported by:	Bruce Cran <bruce cran org uk>
Tested by:	pho
MFC after:	3 days

Revision 1.308.2.10: download - view: text, markup, annotated - select for diffs
Thu Aug 13 17:51:26 2009 UTC (2 years, 5 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.308.2.9: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.9: +1 -1 lines
SVN rev 196197 on 2009-08-13 17:51:26Z by jhb

MFC: Fix some LORs between vnode locks and filedescriptor table locks.
- Don't grab the filedesc lock just to read fd_cmask.
- Drop vnode locks earlier when mounting the root filesystem and before
  sanitizing stdin/out/err file descriptors during execve().

Revision 1.337.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
Diff to: previous 1.337: preferred, colored
Changes since revision 1.337: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.337: download - view: text, markup, annotated - select for diffs
Fri Jul 31 13:40:06 2009 UTC (2 years, 6 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.336: preferred, colored
Changes since revision 1.336: +1 -1 lines
SVN rev 195995 on 2009-07-31 13:40:06Z by jhb

Fix some LORs between vnode locks and filedescriptor table locks.
- Don't grab the filedesc lock just to read fd_cmask.
- Drop vnode locks earlier when mounting the root filesystem and before
  sanitizing stdin/out/err file descriptors during execve().

Submitted by:	kib
Approved by:	re (rwatson)
MFC after:	1 week

Revision 1.336: download - view: text, markup, annotated - select for diffs
Tue Jul 28 21:52:24 2009 UTC (2 years, 6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.335: preferred, colored
Changes since revision 1.335: +1 -1 lines
SVN rev 195926 on 2009-07-28 21:52:24Z by rwatson

Rework vnode argument auditing to follow the same structure, in order
to avoid exposing ARG_ macros/flag values outside of the audit code in
order to name which one of two possible vnodes will be audited for a
system call.

Approved by:	re (kib)
Obtained from:	TrustedBSD Project
MFC after:	1 month

Revision 1.335: download - view: text, markup, annotated - select for diffs
Sat Jun 27 13:58:44 2009 UTC (2 years, 7 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.334: preferred, colored
Changes since revision 1.334: +4 -4 lines
SVN rev 195104 on 2009-06-27 13:58:44Z by rwatson

Replace AUDIT_ARG() with variable argument macros with a set more more
specific macros for each audit argument type.  This makes it easier to
follow call-graphs, especially for automated analysis tools (such as
fxr).

In MFC, we should leave the existing AUDIT_ARG() macros as they may be
used by third-party kernel modules.

Suggested by:	brooks
Approved by:	re (kib)
Obtained from:	TrustedBSD Project
MFC after:	1 week

Revision 1.334: download - view: text, markup, annotated - select for diffs
Fri Jun 19 17:10:35 2009 UTC (2 years, 7 months ago) by brooks
Branches: MAIN
Diff to: previous 1.333: preferred, colored
Changes since revision 1.333: +1 -3 lines
SVN rev 194498 on 2009-06-19 17:10:35Z by brooks

Rework the credential code to support larger values of NGROUPS and
NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024
and 1023 respectively.  (Previously they were equal, but under a close
reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it
is the number of supplemental groups, not total number of groups.)

The bulk of the change consists of converting the struct ucred member
cr_groups from a static array to a pointer.  Do the equivalent in
kinfo_proc.

Introduce new interfaces crcopysafe() and crsetgroups() for duplicating
a process credential before modifying it and for setting group lists
respectively.  Both interfaces take care for the details of allocating
groups array. crsetgroups() takes care of truncating the group list
to the current maximum (NGROUPS) if necessary.  In the future,
crsetgroups() may be responsible for insuring invariants such as sorting
the supplemental groups to allow groupmember() to be implemented as a
binary search.

Because we can not change struct xucred without breaking application
ABIs, we leave it alone and introduce a new XU_NGROUPS value which is
always 16 and is to be used or NGRPS as appropriate for things such as
NFS which need to use no more than 16 groups.  When feasible, truncate
the group list rather than generating an error.

Minor changes:
  - Reduce the number of hand rolled versions of groupmember().
  - Do not assign to both cr_gid and cr_groups[0].
  - Modify ipfw to cache ucreds instead of part of their contents since
    they are immutable once referenced by more than one entity.

Submitted by:	Isilon Systems (initial implementation)
X-MFC after:	never
PR:		bin/113398 kern/133867

Revision 1.308.2.9: download - view: text, markup, annotated - select for diffs
Wed Jun 10 12:07:52 2009 UTC (2 years, 8 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.308.2.8: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.8: +1 -1 lines
SVN rev 193906 on 2009-06-10 12:07:52Z by kib

MFC r185647;
Several threads in a process may do vfork() simultaneously. Then, all
parent threads sleep on the parent' struct proc until corresponding
child releases the vmspace. Each sleep is interlocked with proc mutex of
the child, that triggers assertion in the sleepq_add(). The assertion
requires that at any time, all simultaneous sleepers for the channel use
the same interlock.

Silent the assertion by using conditional variable allocated in the
child. Broadcast the variable event on exec() and exit().

MFC r188750:
Adapt linux emulation to use cv for vfork wait.

Revision 1.333: download - view: text, markup, annotated - select for diffs
Sun Jun 7 19:38:26 2009 UTC (2 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.332: preferred, colored
Changes since revision 1.332: +1 -1 lines
SVN rev 193643 on 2009-06-07 19:38:26Z by alc

Eliminate unnecessary obfuscation when testing a page's valid bits.

Revision 1.332: download - view: text, markup, annotated - select for diffs
Sat Jun 6 20:13:14 2009 UTC (2 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.331: preferred, colored
Changes since revision 1.331: +1 -2 lines
SVN rev 193593 on 2009-06-06 20:13:14Z by alc

If vm_pager_get_pages() returns VM_PAGER_OK, then there is no need to check
the page's valid bits.  The page is guaranteed to be fully valid.  (For the
record, this is documented in vm/vm_pager.h's comments.)

Revision 1.331: download - view: text, markup, annotated - select for diffs
Fri Jun 5 14:55:22 2009 UTC (2 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.330: preferred, colored
Changes since revision 1.330: +0 -1 lines
SVN rev 193511 on 2009-06-05 14:55:22Z by rwatson

Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC
and used in a large number of files, but also because an increasing number
of incorrect uses of MAC calls were sneaking in due to copy-and-paste of
MAC-aware code without the associated opt_mac.h include.

Discussed with:	pjd

Revision 1.308.2.8.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.308.2.8: preferred, colored
Changes since revision 1.308.2.8: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.330: download - view: text, markup, annotated - select for diffs
Tue Mar 17 12:53:28 2009 UTC (2 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.329: preferred, colored
Changes since revision 1.329: +29 -2 lines
SVN rev 189927 on 2009-03-17 12:53:28Z by kib

Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and
compat32 binaries.

Tested by:	pho
Reviewed by:	kan

Revision 1.329: download - view: text, markup, annotated - select for diffs
Thu Feb 26 16:32:48 2009 UTC (2 years, 11 months ago) by ed
Branches: MAIN
Diff to: previous 1.328: preferred, colored
Changes since revision 1.328: +10 -11 lines
SVN rev 189076 on 2009-02-26 16:32:48Z by ed

Remove unneeded pointer `ndp'.

Inside do_execve(), we have a pointer `ndp', which always points to
`&nd'. I can imagine a primitive (non-optimizing) compiler to really
reserve space for such a pointer, so just remove the variable and use
`&nd' directly.

Revision 1.308.2.8: download - view: text, markup, annotated - select for diffs
Thu Feb 26 15:59:22 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_2_BP
Branch point for: RELENG_7_2
Diff to: previous 1.308.2.7: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.7: +7 -0 lines
SVN rev 189075 on 2009-02-26 15:59:22Z by jhb

MFC: Add support for "superpages" on amd64 and i386.  This includes adding the
superpage reservation system to the machine-independent VM system as well as
changes to the pmap code for amd64 and i386 to support superpages.

Reviewed by:	alc
Tested by:	ps

Revision 1.328: download - view: text, markup, annotated - select for diffs
Thu Feb 26 15:51:54 2009 UTC (2 years, 11 months ago) by ed
Branches: MAIN
Diff to: previous 1.327: preferred, colored
Changes since revision 1.327: +0 -3 lines
SVN rev 189074 on 2009-02-26 15:51:54Z by ed

Remove even more unneeded variable assignments.

kern_time.c:
- Unused variable `p'.

kern_thr.c:
- Variable `error' is always caught immediately, so no reason to
  initialize it. There is no way that error != 0 at the end of
  create_thread().

kern_sig.c:
- Unused variable `code'.

kern_synch.c:
- `rval' is always assigned in all different cases.

kern_rwlock.c:
- `v' is always overwritten with RW_UNLOCKED further on.

kern_malloc.c:
- `size' is always initialized with the proper value before being used.

kern_exit.c:
- `error' is always caught and returned immediately. abort2() never
  returns a non-zero value.

kern_exec.c:
- `len' is always assigned inside the if-statement right below it.

tty_info.c:
- `td' is always overwritten by FOREACH_THREAD_IN_PROC().

Found by:	LLVM's scan-build

Revision 1.308.2.7: download - view: text, markup, annotated - select for diffs
Tue Jan 6 21:34:53 2009 UTC (3 years, 1 month ago) by rodrigc
Branches: RELENG_7
Diff to: previous 1.308.2.6: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.6: +3 -4 lines
SVN rev 186840 on 2009-01-06 21:34:53Z by rodrigc

MFC 184700:
  Add DTrace probes for process execution.  This covers cases tested
  by the DTrace test suite.

Approved by:	jb

Revision 1.327: download - view: text, markup, annotated - select for diffs
Fri Dec 5 20:50:24 2008 UTC (3 years, 2 months ago) by kib
Branches: MAIN
Diff to: previous 1.326: preferred, colored
Changes since revision 1.326: +1 -1 lines
SVN rev 185647 on 2008-12-05 20:50:24Z by kib

Several threads in a process may do vfork() simultaneously. Then, all
parent threads sleep on the parent' struct proc until corresponding
child releases the vmspace. Each sleep is interlocked with proc mutex of
the child, that triggers assertion in the sleepq_add(). The assertion
requires that at any time, all simultaneous sleepers for the channel use
the same interlock.

Silent the assertion by using conditional variable allocated in the
child. Broadcast the variable event on exec() and exit().

Since struct proc * sleep wait channel is overloaded for several
unrelated events, I was unable to remove wakeups from the places where
cv_broadcast() is added, except exec().

Reported and tested by:	ganbold
Suggested and reviewed by:	jhb
MFC after:	2 week

Revision 1.308.2.6.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.308.2.6: preferred, colored
Changes since revision 1.308.2.6: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.326: download - view: text, markup, annotated - select for diffs
Wed Nov 5 19:40:36 2008 UTC (3 years, 3 months ago) by rodrigc
Branches: MAIN
Diff to: previous 1.325: preferred, colored
Changes since revision 1.325: +4 -5 lines
SVN rev 184700 on 2008-11-05 19:40:36Z by rodrigc

Merge latest DTrace changes from Perforce.

Approved by:	jb

Revision 1.308.2.6: download - view: text, markup, annotated - select for diffs
Tue Oct 28 17:01:16 2008 UTC (3 years, 3 months ago) by csjp
Branches: RELENG_7
CVS tags: RELENG_7_1_BP
Branch point for: RELENG_7_1
Diff to: previous 1.308.2.5: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.5: +5 -1 lines
SVN rev 184417 on 2008-10-28 17:01:16Z by csjp

MFC SVN rev 181647

- Reduce the scope of the vnode lock such that it does not
  cover the various copyouts associated with initializing
  the process's argv/env data in userspace.  It is possible
  that these copyout operations can fault under memory
  pressure, possibly resulting in dead locks.

Approved by:	re@ (kib)

Revision 1.275.2.8.4.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.275.2.8: preferred, colored
Changes since revision 1.275.2.8: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.325: download - view: text, markup, annotated - select for diffs
Wed Sep 10 13:16:41 2008 UTC (3 years, 5 months ago) by trasz
Branches: MAIN
Diff to: previous 1.324: preferred, colored
Changes since revision 1.324: +5 -4 lines
SVN rev 182905 on 2008-09-10 13:16:41Z by trasz

Remove VSVTX, VSGID and VSUID.  This should be a no-op,
as VSVTX == S_ISVTX, VSGID == S_ISGID and VSUID == S_ISUID.

Approved by:	rwatson (mentor)

Revision 1.324: download - view: text, markup, annotated - select for diffs
Thu Aug 28 15:23:18 2008 UTC (3 years, 5 months ago) by attilio
Branches: MAIN
Diff to: previous 1.323: preferred, colored
Changes since revision 1.323: +2 -2 lines
SVN rev 182371 on 2008-08-28 15:23:18Z by attilio

Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread
was always curthread and totally unuseful.

Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>

Revision 1.308.2.5: download - view: text, markup, annotated - select for diffs
Wed Aug 27 04:41:15 2008 UTC (3 years, 5 months ago) by jb
Branches: RELENG_7
Diff to: previous 1.308.2.4: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.4: +31 -0 lines
SVN rev 182231 on 2008-08-27 04:41:15Z by jb

MFC

DTrace support.

Note that this defaults the 'make buildkernel' to build with CTF data so
that the release kernel and modules are DTrace-able.

Revision 1.323: download - view: text, markup, annotated - select for diffs
Mon Aug 25 13:50:01 2008 UTC (3 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.322: preferred, colored
Changes since revision 1.322: +2 -0 lines
SVN rev 182158 on 2008-08-25 13:50:01Z by rwatson

More fully audit fexecve(2) and its arguments.

Obtained from:	TrustedBSD Project
Sponsored by:	Google, Inc.

Revision 1.322: download - view: text, markup, annotated - select for diffs
Sat Aug 23 15:26:36 2008 UTC (3 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.321: preferred, colored
Changes since revision 1.321: +5 -7 lines
SVN rev 182063 on 2008-08-23 15:26:36Z by rwatson

Introduce two related changes to the TrustedBSD MAC Framework:

(1) Abstract interpreter vnode labeling in execve(2) and mac_execve(2)
    so that the general exec code isn't aware of the details of
    allocating, copying, and freeing labels, rather, simply passes in
    a void pointer to start and stop functions that will be used by
    the framework.  This change will be MFC'd.

(2) Introduce a new flags field to the MAC_POLICY_SET(9) interface
    allowing policies to declare which types of objects require label
    allocation, initialization, and destruction, and define a set of
    flags covering various supported object types (MPC_OBJECT_PROC,
    MPC_OBJECT_VNODE, MPC_OBJECT_INPCB, ...).  This change reduces the
    overhead of compiling the MAC Framework into the kernel if policies
    aren't loaded, or if policies require labels on only a small number
    or even no object types.  Each time a policy is loaded or unloaded,
    we recalculate a mask of labeled object types across all policies
    present in the system.  Eliminate MAC_ALWAYS_LABEL_MBUF option as it
    is no longer required.

MFC after:	1 week ((1) only)
Reviewed by:	csjp
Obtained from:	TrustedBSD Project
Sponsored by:	Apple, Inc.

Revision 1.321: download - view: text, markup, annotated - select for diffs
Tue Aug 12 21:27:48 2008 UTC (3 years, 5 months ago) by csjp
Branches: MAIN
Diff to: previous 1.320: preferred, colored
Changes since revision 1.320: +5 -1 lines
SVN rev 181647 on 2008-08-12 21:27:48Z by csjp

Reduce the scope of the vnode lock such that it does not cover
the various copyouts associated with initializing the process's
argv/env data in userspace.  It is possible that these copyout
operations can fault under memory pressure, possibly resulting
in dead locks.  This is believed to be safe since none of the
copyout_strings() operations need to interact with the vnode here.

Submitted by:	Zhouyi Zhou
PR:		kern/111260
Discussed with:	kib
MFC after:	3 weeks

Revision 1.308.2.4: download - view: text, markup, annotated - select for diffs
Fri Aug 1 10:07:40 2008 UTC (3 years, 6 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.308.2.3: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.3: +2 -4 lines
SVN rev 181120 on 2008-08-01 10:07:40Z by kib

MFC r180799:
Call pargs_drop() unconditionally in do_execve(), the function correctly
handles the NULL argument.
Make pargs_free() static.

Revision 1.308.2.3: download - view: text, markup, annotated - select for diffs
Thu Jul 31 11:43:07 2008 UTC (3 years, 6 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.308.2.2: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.2: +9 -0 lines
SVN rev 181055 on 2008-07-31 11:43:07Z by kib

MFC r180570:
Pair the VOP_OPEN call from do_execve() with the reciprocal VOP_CLOSE.

Note: the change needed small adaptation to RELENG_7 because fexecve(2)
is not merged into the branch.

Revision 1.320: download - view: text, markup, annotated - select for diffs
Fri Jul 25 11:55:32 2008 UTC (3 years, 6 months ago) by kib
Branches: MAIN
Diff to: previous 1.319: preferred, colored
Changes since revision 1.319: +2 -4 lines
SVN rev 180799 on 2008-07-25 11:55:32Z by kib

Call pargs_drop() unconditionally in do_execve(), the function correctly
handles the NULL argument.
Make pargs_free() static.

MFC after:	1 week

Revision 1.319: download - view: text, markup, annotated - select for diffs
Thu Jul 17 16:44:07 2008 UTC (3 years, 6 months ago) by kib
Branches: MAIN
Diff to: previous 1.318: preferred, colored
Changes since revision 1.318: +9 -0 lines
SVN rev 180570 on 2008-07-17 16:44:07Z by kib

Pair the VOP_OPEN call from do_execve() with the reciprocal VOP_CLOSE.
This was unnoticed because local filesystems usually do nothing
non-trivial in the close vop.

Reported and tested by:	Rick Macklem
MFC after:	2 weeks

Revision 1.318: download - view: text, markup, annotated - select for diffs
Sat May 24 06:22:16 2008 UTC (3 years, 8 months ago) by jb
Branches: MAIN
Diff to: previous 1.317: preferred, colored
Changes since revision 1.317: +32 -0 lines
Add DTrace 'proc' provider probes using the Statically Defined Trace
(sdt) mechanism.

Revision 1.317: download - view: text, markup, annotated - select for diffs
Mon Mar 31 12:05:52 2008 UTC (3 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.316: preferred, colored
Changes since revision 1.316: +77 -28 lines
Implement the fexecve(2) syscall.

Based on the submission by rdivacky,
	sponsored by Google Summer of Code 2007
Reviewed by:	rwatson, rdivacky
Tested by:	pho

Revision 1.316: download - view: text, markup, annotated - select for diffs
Wed Mar 12 10:11:59 2008 UTC (3 years, 11 months ago) by jeff
Branches: MAIN
Diff to: previous 1.315: preferred, colored
Changes since revision 1.315: +1 -1 lines
Remove kernel support for M:N threading.

While the KSE project was quite successful in bringing threading to
FreeBSD, the M:N approach taken by the kse library was never developed
to its full potential.  Backwards compatibility will be provided via
libmap.conf for dynamically linked binaries and static binaries will
be broken.

Revision 1.308.2.1.2.1: download - view: text, markup, annotated - select for diffs
Sat Jan 19 18:15:05 2008 UTC (4 years ago) by kib
Branches: RELENG_7_0
CVS tags: RELENG_7_0_0_RELEASE
Diff to: previous 1.308.2.1: preferred, colored; next MAIN 1.308.2.2: preferred, colored
Changes since revision 1.308.2.1: +3 -1 lines
MFC fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

The reason for MFCing this so late in release cycle is, according to
marius@, because
> it fixes the crashing (though no panic) of the test suite
> of the graphic/OpenEXR port on sparc64. This test suite is run
> (and required to succeed) during the package build and that's
> why portmgr@ bitch about at it as OpenEXR is a dependency of KDE
> which in turn is supposed to end up on the release CD images.

Revisions MFCed:
  1.677     of      src/sys/amd64/amd64/machdep.c
  1.592     of      src/sys/amd64/amd64/pmap.c
  1.88      of      src/sys/arm/arm/pmap.c
  1.27      of      src/sys/arm/at91/kb920x_machdep.c
  1.22      of      src/sys/arm/sa11x0/assabet_machdep.c
  1.8       of      src/sys/arm/xscale/i80321/ep80219_machdep.c
  1.29      of      src/sys/arm/xscale/i80321/iq31244_machdep.c
  1.3       of      src/sys/arm/xscale/i8134x/crb_machdep.c
  1.6       of      src/sys/arm/xscale/ixp425/avila_machdep.c
  1.41      of      src/sys/compat/pecoff/imgact_pecoff.c
  1.26      of      src/sys/compat/svr4/imgact_svr4.c
  1.660     of      src/sys/i386/i386/machdep.c
  1.596     of      src/sys/i386/i386/pmap.c
  1.68      of      src/sys/i386/ibcs2/imgact_coff.c
  1.56      of      src/sys/i386/linux/imgact_linux.c
  1.226     of      src/sys/ia64/ia64/machdep.c
  1.192     of      src/sys/ia64/ia64/pmap.c
  1.102     of      src/sys/kern/imgact_aout.c
  1.179     of      src/sys/kern/imgact_elf.c
  1.56      of      src/sys/kern/imgact_gzip.c
  1.310     of      src/sys/kern/kern_exec.c
  1.287     of      src/sys/kern/kern_fork.c
  1.236     of      src/sys/kern/kern_kse.c
  1.253     of      src/sys/kern/kern_proc.c
  1.352     of      src/sys/kern/kern_sig.c
  1.63      of      src/sys/kern/kern_thr.c
  1.257     of      src/sys/kern/kern_thread.c
  1.397     of      src/sys/pc98/pc98/machdep.c
  1.104     of      src/sys/powerpc/powerpc/machdep.c
  1.10      of      src/sys/powerpc/powerpc/pmap_dispatch.c
  1.139     of      src/sys/sparc64/sparc64/machdep.c
  1.167     of      src/sys/sparc64/sparc64/pmap.c
  1.16      of      src/sys/sun4v/sun4v/machdep.c
  1.40      of      src/sys/sun4v/sun4v/pmap.c
  1.493     of      src/sys/sys/proc.h
  1.78      of      src/sys/sys/signalvar.h
  1.80      of      src/sys/vm/pmap.h
  1.79      of      src/sys/vm/vm_extern.h
  1.226     of      src/sys/vm/vm_glue.c
  1.390     of       src/sys/vm/vm_map.c

Requested by:	marius
Tested by:	Peter Holm, marius (make universe and sparc64 runs)
Approved by:	re (kensmith)

Revision 1.308.2.2: download - view: text, markup, annotated - select for diffs
Fri Jan 18 10:02:51 2008 UTC (4 years ago) by kib
Branches: RELENG_7
Diff to: previous 1.308.2.1: preferred, colored; branchpoint 1.308: preferred, colored
Changes since revision 1.308.2.1: +3 -1 lines
MFC fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

The reason for MFCing this so late in release cycle is, according to
marius@, because
> it fixes the crashing (though no panic) of the test suite
> of the graphic/OpenEXR port on sparc64. This test suite is run
> (and required to succeed) during the package build and that's
> why portmgr@ bitch about at it as OpenEXR is a dependency of KDE
> which in turn is supposed to end up on the release CD images.

Revisions MFCed:
  1.677     of      src/sys/amd64/amd64/machdep.c
  1.592     of      src/sys/amd64/amd64/pmap.c
  1.88      of      src/sys/arm/arm/pmap.c
  1.27      of      src/sys/arm/at91/kb920x_machdep.c
  1.22      of      src/sys/arm/sa11x0/assabet_machdep.c
  1.8       of      src/sys/arm/xscale/i80321/ep80219_machdep.c
  1.29      of      src/sys/arm/xscale/i80321/iq31244_machdep.c
  1.3       of      src/sys/arm/xscale/i8134x/crb_machdep.c
  1.6       of      src/sys/arm/xscale/ixp425/avila_machdep.c
  1.41      of      src/sys/compat/pecoff/imgact_pecoff.c
  1.26      of      src/sys/compat/svr4/imgact_svr4.c
  1.660     of      src/sys/i386/i386/machdep.c
  1.596     of      src/sys/i386/i386/pmap.c
  1.68      of      src/sys/i386/ibcs2/imgact_coff.c
  1.56      of      src/sys/i386/linux/imgact_linux.c
  1.226     of      src/sys/ia64/ia64/machdep.c
  1.192     of      src/sys/ia64/ia64/pmap.c
  1.102     of      src/sys/kern/imgact_aout.c
  1.179     of      src/sys/kern/imgact_elf.c
  1.56      of      src/sys/kern/imgact_gzip.c
  1.310     of      src/sys/kern/kern_exec.c
  1.287     of      src/sys/kern/kern_fork.c
  1.236     of      src/sys/kern/kern_kse.c
  1.253     of      src/sys/kern/kern_proc.c
  1.352     of      src/sys/kern/kern_sig.c
  1.63      of      src/sys/kern/kern_thr.c
  1.257     of      src/sys/kern/kern_thread.c
  1.397     of      src/sys/pc98/pc98/machdep.c
  1.104     of      src/sys/powerpc/powerpc/machdep.c
  1.10      of      src/sys/powerpc/powerpc/pmap_dispatch.c
  1.139     of      src/sys/sparc64/sparc64/machdep.c
  1.167     of      src/sys/sparc64/sparc64/pmap.c
  1.16      of      src/sys/sun4v/sun4v/machdep.c
  1.40      of      src/sys/sun4v/sun4v/pmap.c
  1.493     of      src/sys/sys/proc.h
  1.78      of      src/sys/sys/signalvar.h
  1.80      of      src/sys/vm/pmap.h
  1.79      of      src/sys/vm/vm_extern.h
  1.226     of      src/sys/vm/vm_glue.c
  1.390     of       src/sys/vm/vm_map.c

Requested by:	marius
Tested by:	Peter Holm, marius (make universe and sparc64 runs)
Approved by:	re (kensmith)

Revision 1.315: download - view: text, markup, annotated - select for diffs
Sun Jan 13 14:44:08 2008 UTC (4 years ago) by attilio
Branches: MAIN
Diff to: previous 1.314: preferred, colored
Changes since revision 1.314: +3 -3 lines
VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in
conjuction with 'thread' argument passing which is always curthread.
Remove the unuseful extra-argument and pass explicitly curthread to lower
layer functions, when necessary.

KPI results broken by this change, which should affect several ports, so
version bumping and manpage update will be further committed.

Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>

Revision 1.314: download - view: text, markup, annotated - select for diffs
Thu Jan 10 01:10:52 2008 UTC (4 years, 1 month ago) by attilio
Branches: MAIN
Diff to: previous 1.313: preferred, colored
Changes since revision 1.313: +4 -4 lines
vn_lock() is currently only used with the 'curthread' passed as argument.
Remove this argument and pass curthread directly to underlying
VOP_LOCK1() VFS method. This modify makes the code cleaner and in
particular remove an annoying dependence helping next lockmgr() cleanup.
KPI results, obviously, changed.

Manpage and FreeBSD_version will be updated through further commits.

As a side note, would be valuable to say that next commits will address
a similar cleanup about VFS methods, in particular vop_lock1 and
vop_unlock.

Tested by:	Diego Sardina <siarodx at gmail dot com>,
		Andrea Di Pasquale <whyx dot it at gmail dot com>

Revision 1.313: download - view: text, markup, annotated - select for diffs
Sat Dec 29 19:53:04 2007 UTC (4 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.312: preferred, colored
Changes since revision 1.312: +8 -1 lines
Add the superpage reservation system.  This is "part 2 of 2" of the
machine-independent support for superpages.  (The earlier part was
the rewrite of the physical memory allocator.)  The remainder of the
code required for superpages support is machine-dependent and will
be added to the various pmap implementations at a later date.

Initially, I am only supporting one large page size per architecture.
Moreover, I am only enabling the reservation system on amd64.  (In
an emergency, it can be disabled by setting VM_NRESERVLEVELS to 0
in amd64/include/vmparam.h or your kernel configuration file.)

Revision 1.308.2.1: download - view: text, markup, annotated - select for diffs
Thu Dec 6 14:19:42 2007 UTC (4 years, 2 months ago) by kib
Branches: RELENG_7
CVS tags: RELENG_7_0_BP
Branch point for: RELENG_7_0
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +1 -0 lines
MFC
rev 1.182 of src/sys/kern/imgact_elf.c
rev 1.288 of src/sys/kern/init_main.c
rev 1.312 of src/sys/kern/kern_exec.c
rev 1.85 of src/sys/kern/kern_mib.c
rev 1.496 of src/sys/sys/proc.h
rev 1.262 of src/sys/sys/systm.h

Implement fetching of the __FreeBSD_version from the ELF ABI-tag note.
The value is read into the p_osrel member of the struct proc. p_osrel
is set to 0 for the binaries without the note.

Approved by:	re (kensmith)

Revision 1.312: download - view: text, markup, annotated - select for diffs
Tue Dec 4 12:28:07 2007 UTC (4 years, 2 months ago) by kib
Branches: MAIN
Diff to: previous 1.311: preferred, colored
Changes since revision 1.311: +1 -0 lines
Implement fetching of the __FreeBSD_version from the ELF ABI-tag note.
The value is read into the p_osrel member of the struct proc. p_osrel
is set to 0 for the binaries without the note.

MFC after:	3 days

Revision 1.311: download - view: text, markup, annotated - select for diffs
Wed Nov 14 06:04:57 2007 UTC (4 years, 2 months ago) by julian
Branches: MAIN
Diff to: previous 1.310: preferred, colored
Changes since revision 1.310: +1 -0 lines
Make sure there is a good default thread name for all threads.

Revision 1.310: download - view: text, markup, annotated - select for diffs
Mon Nov 5 11:36:13 2007 UTC (4 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.309: preferred, colored
Changes since revision 1.309: +3 -1 lines
Fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

As consequence, vmspace_exec() and vmspace_unshare() returns the errno
int. struct vmspace arg was added to vm_forkproc() to avoid dealing
with failed allocation when most of the fork1() job is already done.

The kernel stack for the thread is now set up in the thread_alloc(),
that itself may return NULL. Also, allocation of the first process
thread is performed in the fork1() to properly deal with stack
allocation failure. proc_linkup() is separated into proc_linkup()
called from fork1(), and proc_linkup0(), that is used to set up the
kernel process (was known as swapper).

In collaboration with:	Peter Holm
Reviewed by:	jhb

Revision 1.309: download - view: text, markup, annotated - select for diffs
Wed Oct 24 19:03:54 2007 UTC (4 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.308: preferred, colored
Changes since revision 1.308: +4 -4 lines
Merge first in a series of TrustedBSD MAC Framework KPI changes
from Mac OS X Leopard--rationalize naming for entry points to
the following general forms:

  mac_<object>_<method/action>
  mac_<object>_check_<method/action>

The previous naming scheme was inconsistent and mostly
reversed from the new scheme.  Also, make object types more
consistent and remove spaces from object types that contain
multiple parts ("posix_sem" -> "posixsem") to make mechanical
parsing easier.  Introduce a new "netinet" object type for
certain IPv4/IPv6-related methods.  Also simplify, slightly,
some entry point names.

All MAC policy modules will need to be recompiled, and modules
not updates as part of this commit will need to be modified to
conform to the new KPI.

Sponsored by:	SPARTA (original patches against Mac OS X)
Obtained from:	TrustedBSD Project, Apple Computer

Revision 1.308: download - view: text, markup, annotated - select for diffs
Tue Sep 25 06:25:05 2007 UTC (4 years, 4 months ago) by alc
Branches: MAIN
CVS tags: RELENG_7_BP
Branch point for: RELENG_7
Diff to: previous 1.307: preferred, colored
Changes since revision 1.307: +1 -1 lines
Change the management of cached pages (PQ_CACHE) in two fundamental
ways:

(1) Cached pages are no longer kept in the object's resident page
splay tree and memq.  Instead, they are kept in a separate per-object
splay tree of cached pages.  However, access to this new per-object
splay tree is synchronized by the _free_ page queues lock, not to be
confused with the heavily contended page queues lock.  Consequently, a
cached page can be reclaimed by vm_page_alloc(9) without acquiring the
object's lock or the page queues lock.

This solves a problem independently reported by tegge@ and Isilon.
Specifically, they observed the page daemon consuming a great deal of
CPU time because of pages bouncing back and forth between the cache
queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE).  The source of
this problem turned out to be a deadlock avoidance strategy employed
when selecting a cached page to reclaim in vm_page_select_cache().
However, the root cause was really that reclaiming a cached page
required the acquisition of an object lock while the page queues lock
was already held.  Thus, this change addresses the problem at its
root, by eliminating the need to acquire the object's lock.

Moreover, keeping cached pages in the object's primary splay tree and
memq was, in effect, optimizing for the uncommon case.  Cached pages
are reclaimed far, far more often than they are reactivated.  Instead,
this change makes reclamation cheaper, especially in terms of
synchronization overhead, and reactivation more expensive, because
reactivated pages will have to be reentered into the object's primary
splay tree and memq.

(2) Cached pages are now stored alongside free pages in the physical
memory allocator's buddy queues, increasing the likelihood that large
allocations of contiguous physical memory (i.e., superpages) will
succeed.

Finally, as a result of this change long-standing restrictions on when
and where a cached page can be reclaimed and returned by
vm_page_alloc(9) are eliminated.  Specifically, calls to
vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and
return a formerly cached page.  Consequently, a call to malloc(9)
specifying M_NOWAIT is less likely to fail.

Discussed with: many over the course of the summer, including jeff@,
   Justin Husted @ Isilon, peter@, tegge@
Tested by: an earlier version by kris@
Approved by: re (kensmith)

Revision 1.307: download - view: text, markup, annotated - select for diffs
Thu Jul 12 18:01:31 2007 UTC (4 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.306: preferred, colored
Changes since revision 1.306: +9 -4 lines
Fix a couple of issues with the stack limit for 32-bit processes on 64-bit
kernels exposed by the recent fixes to resource limits for 32-bit processes
on 64-bit kernels:
- Let ABIs expose their maximum stack size via a new pointer in sysentvec
  and use that in preference to maxssiz during exec() rather than always
  using maxssiz for all processses.
- Apply the ABI's limit fixup to the previous stack size when adjusting
  RLIMIT_STACK to determine if the existing mapping for the stack needs to
  be grown or shrunk (as well as how much it should be grown or shrunk).

Approved by:	re (kensmith)

Revision 1.275.2.8: download - view: text, markup, annotated - select for diffs
Mon Jun 25 23:58:46 2007 UTC (4 years, 7 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE
Branch point for: RELENG_6_4, RELENG_6_3
Diff to: previous 1.275.2.7: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.7: +6 -1 lines
MFC 1.306: Conditionally acquire Giant when dropping a reference on the
ktrace vnode during execve().

Revision 1.306: download - view: text, markup, annotated - select for diffs
Wed Jun 13 19:41:47 2007 UTC (4 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.305: preferred, colored
Changes since revision 1.305: +6 -1 lines
Conditionally acquire Giant when dropping a reference on the ktrace vnode
during execve() when turning off tracing due to executing a setuid binary
as non-root.  Previously this could fail to acquire Giant and fail an
assertion if the ktrace file was on a non-MPSAFE filesystem and the
executable was on an MPSAFE filesystem.

MFC after:	3 days
Reported by:	kris

Revision 1.305: download - view: text, markup, annotated - select for diffs
Tue Jun 12 00:11:59 2007 UTC (4 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.304: preferred, colored
Changes since revision 1.304: +1 -2 lines
Eliminate now-unused SUSER_ALLOWJAIL arguments to priv_check_cred(); in
some cases, move to priv_check() if it was an operation on a thread and
no other flags were present.

Eliminate caller-side jail exception checking (also now-unused); jail
privilege exception code now goes solely in kern_jail.c.

We can't yet eliminate suser() due to some cases in the KAME code where
a privilege check is performed and then used in many different deferred
paths.  Do, however, move those prototypes to priv.h.

Reviewed by:	csjp
Obtained from:	TrustedBSD Project

Revision 1.304: download - view: text, markup, annotated - select for diffs
Thu May 31 11:51:51 2007 UTC (4 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.303: preferred, colored
Changes since revision 1.303: +1 -1 lines
Revert UF_OPENING workaround for CURRENT.
Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation
argument from being file descriptor index into the pointer to struct file.

Proposed and reviewed by:	jhb
Reviewed by:	daichi (unionfs)
Approved by:	re (kensmith)

Revision 1.275.2.7: download - view: text, markup, annotated - select for diffs
Wed May 23 18:24:43 2007 UTC (4 years, 8 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.275.2.6: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.6: +0 -9 lines
MFC: Rework the support used by ABIs to override resource limits so that
a 64-bit process exec'd by a 32-bit process doesn't end up with 32-bit
limits.

This doesn't break the ABI as neither of the 32-bit ABIs (COMPAT_LINUX32
and COMPAT_IA32) are buildable as modules on 6.x/amd64 and none of the
other ABIs use this hook.

Revision 1.303: download - view: text, markup, annotated - select for diffs
Mon May 14 22:40:04 2007 UTC (4 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.302: preferred, colored
Changes since revision 1.302: +0 -9 lines
Rework the support for ABIs to override resource limits (used by 32-bit
processes under 64-bit kernels).  Previously, each 32-bit process overwrote
its resource limits at exec() time.  The problem with this approach is that
the new limits affect all child processes of the 32-bit process, including
if the child process forks and execs a 64-bit process.  To fix this, don't
ovewrite the resource limits during exec().  Instead, sv_fixlimits() is
now replaced with a different function sv_fixlimit() which asks the ABI to
sanitize a single resource limit.  We then use this when querying and
setting resource limits.  Thus, if a 32-bit process sets a limit, then
that new limit will be inherited by future children.  However, if the
32-bit process doesn't change a limit, then a future 64-bit child will
see the "full" 64-bit limit rather than the 32-bit limit.

MFC is tentative since it will break the ABI of old linux.ko modules (no
other modules are affected).

MFC after:	1 week

Revision 1.302: download - view: text, markup, annotated - select for diffs
Sun Mar 25 10:05:44 2007 UTC (4 years, 10 months ago) by kris
Branches: MAIN
Diff to: previous 1.301: preferred, colored
Changes since revision 1.301: +1 -1 lines
Update a comment: we usually call exec_vmspace_new with Giant not held,
but sometimes it is.

Revision 1.301: download - view: text, markup, annotated - select for diffs
Mon Mar 5 13:10:57 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.300: preferred, colored
Changes since revision 1.300: +10 -10 lines
Further system call comment cleanup:

- Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde)
- Remove extra blank lines in some cases.
- Add extra blank lines in some cases.
- Remove no-op comments consisting solely of the function name, the word
  "syscall", or the system call name.
- Add punctuation.
- Re-wrap some comments.

Revision 1.300: download - view: text, markup, annotated - select for diffs
Sun Mar 4 22:36:45 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.299: preferred, colored
Changes since revision 1.299: +0 -8 lines
Remove 'MPSAFE' annotations from the comments above most system calls: all
system calls now enter without Giant held, and then in some cases, acquire
Giant explicitly.

Remove a number of other MPSAFE annotations in the credential code and
tweak one or two other adjacent comments.

Revision 1.299: download - view: text, markup, annotated - select for diffs
Mon Nov 6 13:42:00 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.298: preferred, colored
Changes since revision 1.298: +5 -1 lines
Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges.  These may
require some future tweaking.

Sponsored by:           nCircle Network Security, Inc.
Obtained from:          TrustedBSD Project
Discussed on:           arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
                        Alex Lyashkov <umka at sevcity dot net>,
                        Skip Ford <skip dot ford at verizon dot net>,
                        Antoine Brodin <antoine dot brodin at laposte dot net>

Revision 1.298: download - view: text, markup, annotated - select for diffs
Sun Oct 22 21:18:47 2006 UTC (5 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.297: preferred, colored
Changes since revision 1.297: +1 -3 lines
The page queues lock is no longer required by vm_page_busy() or
vm_page_wakeup().  Reduce or eliminate its use accordingly.

Revision 1.297: download - view: text, markup, annotated - select for diffs
Sun Oct 22 11:52:12 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.296: preferred, colored
Changes since revision 1.296: +1 -1 lines
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h
begun with a repo-copy of mac.h to mac_framework.h.  sys/mac.h now
contains the userspace and user<->kernel API and definitions, with all
in-kernel interfaces moved to mac_framework.h, which is now included
across most of the kernel instead.

This change is the first step in a larger cleanup and sweep of MAC
Framework interfaces in the kernel, and will not be MFC'd.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA

Revision 1.296: download - view: text, markup, annotated - select for diffs
Sun Oct 22 04:28:13 2006 UTC (5 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.295: preferred, colored
Changes since revision 1.295: +1 -1 lines
Replace PG_BUSY with VPO_BUSY.  In other words, changes to the page's
busy flag, i.e., VPO_BUSY, are now synchronized by the per-vm object
lock instead of the global page queues lock.

Revision 1.275.2.6: download - view: text, markup, annotated - select for diffs
Sun Sep 3 09:21:59 2006 UTC (5 years, 5 months ago) by rwatson
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Diff to: previous 1.275.2.5: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.5: +11 -2 lines
Merge kern_exec.c:1.293,1.295, kern_acct.c:1.82, vfs_mount.c:1.227 from
HEAD to RELENG_6:

  In execve(), audit the path name being executed.  In the future, it
  would also be good to audit the interpreter pathname, if any.

  Audit the argv and env vectors passed in on exec:
    Add the argument auditing functions for argv and env.
    Add kernel-specific versions of the tokenizer functions for the
    arg and env represented as a char array.
    Implement the AUDIT_ARGV and AUDIT_ARGE audit policy commands to
    enable/disable argv/env auditing.
    Call the argument auditing from the exec system calls.

  Audit path passed to the acct() system call.

  Audit some arguments to nmount(), mount(), umount().

Obtained from:	TrustedBSD Project

Revision 1.295: download - view: text, markup, annotated - select for diffs
Fri Sep 1 11:45:39 2006 UTC (5 years, 5 months ago) by wsalamon
Branches: MAIN
Diff to: previous 1.294: preferred, colored
Changes since revision 1.294: +9 -0 lines
Audit the argv and env vectors passed in on exec:
  Add the argument auditing functions for argv and env.
  Add kernel-specific versions of the tokenizer functions for the
  arg and env represented as a char array.
  Implement the AUDIT_ARGV and AUDIT_ARGE audit policy commands to
  enable/disable argv/env auditing.
  Call the argument auditing from the exec system calls.

Obtained from: TrustedBSD Project
Approved by: rwatson (mentor)

Revision 1.294: download - view: text, markup, annotated - select for diffs
Tue Aug 15 12:10:57 2006 UTC (5 years, 5 months ago) by netchild
Branches: MAIN
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +2 -1 lines
- Change process_exec function handlers prototype to include struct
  image_params arg.
- Change struct image_params to include struct sysentvec pointer and
  initialize it.
- Change all consumers of process_exit/process_exec eventhandlers to
  new prototypes (includes splitting up into distinct exec/exit functions).
- Add eventhandler to userret.

Sponsored by:		Google SoC 2006
Submitted by:		rdivacky
Parts suggested by:	jhb (on hackers@)

Revision 1.293: download - view: text, markup, annotated - select for diffs
Sun May 28 08:28:47 2006 UTC (5 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.292: preferred, colored
Changes since revision 1.292: +2 -2 lines
In execve(), audit the path name being executed.  In the future, it
would also be good to audit the interpreter pathname, if any.

Obtained from:	TrustedBSD Project

Revision 1.275.2.5: download - view: text, markup, annotated - select for diffs
Sun May 14 00:46:13 2006 UTC (5 years, 8 months ago) by tegge
Branches: RELENG_6
Diff to: previous 1.275.2.4: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.4: +6 -0 lines
MFC: Temporarily unlock vnode for new image being executed to avoid lock
     order reversals that can lead to deadlocks.  Normally vn_close(),
     namei() or vrele() should not be called while holding vnode locks.

Revision 1.292: download - view: text, markup, annotated - select for diffs
Fri May 5 20:25:05 2006 UTC (5 years, 9 months ago) by tegge
Branches: MAIN
Diff to: previous 1.291: preferred, colored
Changes since revision 1.291: +6 -0 lines
Temporarily unlock vnode for new image being executed to avoid lock order
reversals that can lead to deadlocks.  Normally vn_close(), namei() or vrele()
should not be called while holding vnode locks.

Revision 1.291: download - view: text, markup, annotated - select for diffs
Mon Apr 3 21:16:08 2006 UTC (5 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.290: preferred, colored
Changes since revision 1.290: +1 -2 lines
Remove the unused sva and eva arguments from pmap_remove_pages().

Revision 1.275.2.4: download - view: text, markup, annotated - select for diffs
Mon Mar 13 03:05:42 2006 UTC (5 years, 11 months ago) by jeff
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.275.2.3: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.3: +6 -1 lines
MFC Rev 1.288
VFS SMP fixes, stack api, softupdates fixes.

Sponsored by:	Isilon Systems, Inc.
Approved by:	re (scottl)

Revision 1.290: download - view: text, markup, annotated - select for diffs
Wed Mar 8 20:21:54 2006 UTC (5 years, 11 months ago) by ups
Branches: MAIN
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +19 -10 lines
Fix exec_map resource leaks.

Tested by: kris@

Revision 1.289: download - view: text, markup, annotated - select for diffs
Mon Feb 6 22:06:54 2006 UTC (6 years ago) by jhb
Branches: MAIN
Diff to: previous 1.288: preferred, colored
Changes since revision 1.288: +9 -22 lines
- Always call exec_free_args() in kern_execve() instead of doing it in all
  the callers if the exec either succeeds or fails early.
- Move the code to call exit1() if the exec fails after the vmspace is
  gone to the bottom of kern_execve() to cut down on some code duplication.

Revision 1.288: download - view: text, markup, annotated - select for diffs
Thu Feb 2 08:39:39 2006 UTC (6 years ago) by jeff
Branches: MAIN
Diff to: previous 1.287: preferred, colored
Changes since revision 1.287: +6 -1 lines
 - textvp may have been from a different mountpoint than ndp->ni_vp and
   we may need to acquire giant to vrele it.

Found by:	mjacob
MFC After:	3 days

Revision 1.275.2.3: download - view: text, markup, annotated - select for diffs
Mon Dec 26 13:47:19 2005 UTC (6 years, 1 month ago) by dds
Branches: RELENG_6
Diff to: previous 1.275.2.2: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.2: +2 -12 lines
MFC changes from 2005.10.26:
Move execve's access time update functionality into a
new vfs_mark_atime() function, and use the new function
for performing efficient atime updates in mmap().

Revision 1.287: download - view: text, markup, annotated - select for diffs
Sun Dec 11 22:06:57 2005 UTC (6 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.286: preferred, colored
Changes since revision 1.286: +0 -1 lines
Remove unneeded calls to pmap_remove_all().  The given page is not mapped.

Reviewed by: tegge

Revision 1.286: download - view: text, markup, annotated - select for diffs
Fri Dec 9 05:43:26 2005 UTC (6 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.285: preferred, colored
Changes since revision 1.285: +0 -4 lines
Register itimers_event_hook as a kernel event handler, so I don't
have to duplicate code to call it in exec() and exit1().

Revision 1.285: download - view: text, markup, annotated - select for diffs
Tue Dec 6 07:39:36 2005 UTC (6 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.284: preferred, colored
Changes since revision 1.284: +2 -4 lines
Reduce the scope of the page queues lock in exec_map_first_page().  The vm
object lock is sufficient for reading a page's PG_BUSY and busy flags.

MFC after: 1 week

Revision 1.284: download - view: text, markup, annotated - select for diffs
Thu Nov 3 04:49:16 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.283: preferred, colored
Changes since revision 1.283: +1 -1 lines
Cleanup some signal interfaces. Now the tdsignal function accepts
both proc pointer and thread pointer, if thread pointer is NULL,
tdsignal automatically finds a thread, otherwise it sends signal
to given thread.
Add utility function psignal_event to send a realtime sigevent
to a process according to the delivery requirement specified in
struct sigevent.

Revision 1.283: download - view: text, markup, annotated - select for diffs
Wed Nov 2 21:18:07 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.282: preferred, colored
Changes since revision 1.282: +1 -1 lines
Calling setrlimit from 32bit apps could potentially increase certain
limits beyond what should be capiable in a 32bit process, so we
must fixup the limits.

Reviewed by:	jhb

Revision 1.282: download - view: text, markup, annotated - select for diffs
Sun Oct 23 12:19:08 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.281: preferred, colored
Changes since revision 1.281: +1 -0 lines
Make p_itimers as a pointer, so file sys/proc.h does not need to include
sys/timers.h.

Revision 1.281: download - view: text, markup, annotated - select for diffs
Sun Oct 23 04:22:55 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.280: preferred, colored
Changes since revision 1.280: +3 -0 lines
Implement POSIX timers. Current only CLOCK_REALTIME and CLOCK_MONOTONIC
clock are supported. I have plan to merge XSI timer ITIMER_REAL and other
two CPU timers into the new code, current three slots are available for
the XSI timers.
The SIGEV_THREAD notification type is not supported yet because our
sigevent struct lacks of two member fields:
sigev_notify_function
sigev_notify_attributes
I have found the sigevent is used in AIO, so I won't add the two members
unless the AIO code is adjusted.

Revision 1.280: download - view: text, markup, annotated - select for diffs
Fri Oct 14 12:43:46 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.279: preferred, colored
Changes since revision 1.279: +1 -1 lines
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most
   changes in MD code are trivial, before this change, trapsignal and
   sendsig use discrete parameters, now they uses member fields of
   ksiginfo_t structure. For sendsig, this change allows us to pass
   POSIX realtime signal value to user code.

2. Remove cpu_thread_siginfo, it is no longer needed because we now always
   generate ksiginfo_t data and feed it to libpthread.

3. Add p_sigqueue to proc structure to hold shared signals which were
   blocked by all threads in the proc.

4. Add td_sigqueue to thread structure to hold all signals delivered to
   thread.

5. i386 and amd64 now return POSIX standard si_code, other arches will
   be fixed.

6. In this sigqueue implementation, pending signal set is kept as before,
   an extra siginfo list holds additional siginfo_t data for signals.
   kernel code uses psignal() still behavior as before, it won't be failed
   even under memory pressure, only exception is when deleting a signal,
   we should call sigqueue_delete to remove signal from sigqueue but
   not SIGDELSET. Current there is no kernel code will deliver a signal
   with additional data, so kernel should be as stable as before,
   a ksiginfo can carry more information, for example, allow signal to
   be delivered but throw away siginfo data if memory is not enough.
   SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can
   not be caught or masked.
   The sigqueue() syscall allows user code to queue a signal to target
   process, if resource is unavailable, EAGAIN will be returned as
   specification said.
   Just before thread exits, signal queue memory will be freed by
   sigqueue_flush.
   Current, all signals are allowed to be queued, not only realtime signals.

Earlier patch reviewed by: jhb, deischen
Tested on: i386, amd64

Revision 1.279: download - view: text, markup, annotated - select for diffs
Wed Oct 12 06:55:59 2005 UTC (6 years, 4 months ago) by dds
Branches: MAIN
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +2 -12 lines
Move execve's access time update functionality into a new
vfs_mark_atime() function, and use the new function for
performing efficient atime updates in mmap().

Reviewed by:	bde
MFC after:	2 weeks

Revision 1.275.2.2: download - view: text, markup, annotated - select for diffs
Sun Oct 9 17:28:12 2005 UTC (6 years, 4 months ago) by ps
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.275.2.1: preferred, colored; branchpoint 1.275: preferred, colored
Changes since revision 1.275.2.1: +8 -0 lines
MFC:
> revision 1.277
> date: 2005/10/03 12:49:54;  author: cperciva;  state: Exp;  lines: +8 -0
> If sufficiently bad things happen during a call to kern_execve(), it is
> possible for do_execve() to call exit1() rather than returning.  As a
> result, the sequence "allocate memory; call kern_execve; free memory"
> can end up leaking memory.
>
> This commit documents this astonishing behaviour and adds a call to
> exec_free_args() before the exit1() call in do_execve().  Since all
> the users of kern_execve() in the tree use exec_free_args() to free
> the command-line arguments after kern_execve() returns, this should
> be safe, and it fixes the memory leak which can otherwise occur.
>
> Submitted by:   Peter Holm
> MFC after:      3 days
> Security:       Local denial of service

Approved by:	re (scottl)

Revision 1.249.2.6: download - view: text, markup, annotated - select for diffs
Sat Oct 8 20:35:26 2005 UTC (6 years, 4 months ago) by truckman
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.249.2.5: preferred, colored; branchpoint 1.249: preferred, colored; next MAIN 1.250: preferred, colored
Changes since revision 1.249.2.5: +10 -10 lines
MFC kern_exec.c 1.276 (and 1.278)

Original commit messages:

  truckman    2005-10-01 08:33:57 UTC

    FreeBSD src repository

    Modified files:
      sys/kern             kern_exec.c
    Log:
    Copy new process argument list in do_execve() before grabbing PROC_LOCK
    to avoid touching pageable memory while holding a mutex.

    Simplify argument list replacement logic.

    PR:            kern/84935
    Submitted by:  "Antoine Pelisse" apelisse AT gmail.com (in a different form)
    MFC after:     3 days

    Revision  Changes    Path
    1.276     +10 -10    src/sys/kern/kern_exec.c

  truckman    2005-10-04 04:02:33 UTC

    FreeBSD src repository

    Modified files:
      sys/kern             kern_exec.c
    Log:
    Add missing word to comment.

    Revision  Changes    Path
    1.278     +1 -1      src/sys/kern/kern_exec.c

PR:		kern/84935
Submitted by:	"Antoine Pelisse" apelisse AT gmail.com (in a different form)

Revision 1.275.2.1: download - view: text, markup, annotated - select for diffs
Tue Oct 4 04:29:08 2005 UTC (6 years, 4 months ago) by truckman
Branches: RELENG_6
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +10 -10 lines
MFC kern_exec.c 1.276 (and 1.278)

Original commit messages:

  truckman    2005-10-01 08:33:57 UTC

    FreeBSD src repository

    Modified files:
      sys/kern             kern_exec.c
    Log:
    Copy new process argument list in do_execve() before grabbing PROC_LOCK
    to avoid touching pageable memory while holding a mutex.

    Simplify argument list replacement logic.

    PR:            kern/84935
    Submitted by:  "Antoine Pelisse" apelisse AT gmail.com (in a different form)
    MFC after:     3 days

    Revision  Changes    Path
    1.276     +10 -10    src/sys/kern/kern_exec.c

  truckman    2005-10-04 04:02:33 UTC

    FreeBSD src repository

    Modified files:
      sys/kern             kern_exec.c
    Log:
    Add missing word to comment.

    Revision  Changes    Path
    1.278     +1 -1      src/sys/kern/kern_exec.c

PR:		kern/84935
Submitted by:	"Antoine Pelisse" apelisse AT gmail.com (in a different form)
Approved by:	re (scottl)

Revision 1.278: download - view: text, markup, annotated - select for diffs
Tue Oct 4 04:02:33 2005 UTC (6 years, 4 months ago) by truckman
Branches: MAIN
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +1 -1 lines
Add missing word to comment.

Revision 1.277: download - view: text, markup, annotated - select for diffs
Mon Oct 3 12:49:54 2005 UTC (6 years, 4 months ago) by cperciva
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +8 -0 lines
If sufficiently bad things happen during a call to kern_execve(), it is
possible for do_execve() to call exit1() rather than returning.  As a
result, the sequence "allocate memory; call kern_execve; free memory"
can end up leaking memory.

This commit documents this astonishing behaviour and adds a call to
exec_free_args() before the exit1() call in do_execve().  Since all
the users of kern_execve() in the tree use exec_free_args() to free
the command-line arguments after kern_execve() returns, this should
be safe, and it fixes the memory leak which can otherwise occur.

Submitted by:	Peter Holm
MFC after:	3 days
Security:	Local denial of service

Revision 1.276: download - view: text, markup, annotated - select for diffs
Sat Oct 1 08:33:56 2005 UTC (6 years, 4 months ago) by truckman
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +10 -10 lines
Copy new process argument list in do_execve() before grabbing PROC_LOCK
to avoid touching pageable memory while holding a mutex.

Simplify argument list replacement logic.

PR:		kern/84935
Submitted by:	"Antoine Pelisse" apelisse AT gmail.com (in a different form)
MFC after:	3 days

Revision 1.275: download - view: text, markup, annotated - select for diffs
Thu Jun 30 19:01:26 2005 UTC (6 years, 7 months ago) by jkoshy
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +7 -2 lines
MFP4:

- pmcstat(8) gprof output mode fixes:

  lib/libpmc/pmclog.{c,h}, sys/sys/pmclog.h:
  + Add a 'is_usermode' field to the PMCLOG_PCSAMPLE event
  + Add an 'entryaddr' field to the PMCLOG_PROCEXEC event,
    so that pmcstat(8) can determine where the runtime loader
    /libexec/ld-elf.so.1 is getting loaded.

  sys/kern/kern_exec.c:
  + Use a local struct to group the entry address of the image being
    exec()'ed and the process credential changed flag to the exec
    handling hook inside hwpmc(4).

  usr.sbin/pmcstat/*:
  + Support "-k kernelpath", "-D sampledir".
  + Implement the ELF bits of 'gmon.out' profile generation in a new
    file "pmcstat_log.c".  Move all log related functions to this
    file.
  + Move local definitions and prototypes to "pmcstat.h"

- Other bug fixes:
  + lib/libpmc/pmclog.c: correctly handle EOF in pmclog_read().
  + sys/dev/hwpmc_mod.c: unconditionally log a PROCEXIT event to all
    attached PMCs when a process exits.
  + sys/sys/pmc.h: correct a function prototype.
  + Improve usage checks in pmcstat(8).

Approved by:	re (blanket hwpmc)

Revision 1.274: download - view: text, markup, annotated - select for diffs
Fri Jun 24 00:16:57 2005 UTC (6 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +1 -0 lines
Move HWPMC_HOOKS into its own opt_hwpmc_hooks.h file.  It doesn't merit
being in opt_global.h and forcing a global recompile when only a few files
reference it.

Approved by:  re

Revision 1.273: download - view: text, markup, annotated - select for diffs
Thu Jun 9 19:45:08 2005 UTC (6 years, 8 months ago) by jkoshy
Branches: MAIN
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +3 -2 lines
MFP4:

- Implement sampling modes and logging support in hwpmc(4).

- Separate MI and MD parts of hwpmc(4) and allow sharing of
  PMC implementations across different architectures.
  Add support for P4 (EMT64) style PMCs to the amd64 code.

- New pmcstat(8) options: -E (exit time counts) -W (counts
  every context switch), -R (print log file).

- pmc(3) API changes, improve our ability to keep ABI compatibility
  in the future.  Add more 'alias' names for commonly used events.

- bug fixes & documentation.

Revision 1.272: download - view: text, markup, annotated - select for diffs
Tue May 31 19:39:52 2005 UTC (6 years, 8 months ago) by kensmith
Branches: MAIN
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +13 -1 lines
This patch addresses a standards violation issue.  The standards say a
file's access time should be updated when it gets executed.  A while
ago the mechanism used to exec was changed to use a more mmap based
mechanism and this behavior was broken as a side-effect of that.

A new vnode flag is added that gets set when the file gets executed,
and the VOP_SETATTR() vnode operation gets called.  The underlying
filesystem is expected to handle it based on its own semantics, some
filesystems don't support access time at all.  Those that do should
handle it in a way that does not block, does not generate I/O if possible,
etc.  In particular vn_start_write() has not been called.  The UFS code
handles it the same way as it would normally handle the access time if
a file was read - the IN_ACCESS flag gets set in the inode but no other
action happens at this point.  The actual time update will happen later
during a sync (which handles all the necessary locking).

Got me into this:	cperciva
Discussed with:		a lot with bde, a little with kan
Showed patches to:	phk, jeffr, standards@, arch@
Minor discussion on:	arch@

Revision 1.271: download - view: text, markup, annotated - select for diffs
Tue May 3 16:24:59 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +4 -5 lines
 - Initialize vfslocked correctly early enough for MAC to compile.
 - Fix one place where we explicitly drop Giant!

Pointy hat to:	me
Submitted by:	Max Laier
Warned by:	Tinderbox

Revision 1.270: download - view: text, markup, annotated - select for diffs
Tue May 3 10:55:05 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +7 -9 lines
 - Use namei to acquire Giant for VFS if it is necessary.  Drop the explicit
   Giant acquisition.
 - Remove GIANT_REQUIRED in the few remaining cases; the vm and vfs have
   both been locked.

Revision 1.269: download - view: text, markup, annotated - select for diffs
Sun May 1 00:58:19 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +2 -0 lines
 - Return EACCES if we're trying to exec on a vp with no object.

Errno supplied by:	cperciva

Revision 1.268: download - view: text, markup, annotated - select for diffs
Wed Apr 27 09:05:19 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +1 -1 lines
 - Pass the ISOPEN flag to namei so filesystems will know we're about to
   open them or otherwise access the data.

Revision 1.267: download - view: text, markup, annotated - select for diffs
Tue Apr 19 04:01:24 2005 UTC (6 years, 9 months ago) by jkoshy
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +22 -0 lines
Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.

Bump FreeBSD_version.

Reviewed by:	alc, jhb (kernel changes)

Revision 1.249.2.5: download - view: text, markup, annotated - select for diffs
Sun Feb 27 02:40:09 2005 UTC (6 years, 11 months ago) by jeff
Branches: RELENG_5
CVS tags: RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.249.2.4: preferred, colored; branchpoint 1.249: preferred, colored
Changes since revision 1.249.2.4: +1 -10 lines
MFC revisions 1.257 - 1.258, 1.260
 - filedesc locking cleanup.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Fri Feb 25 11:49:42 2005 UTC (6 years, 11 months ago) by sobomax
Branches: MAIN
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +9 -5 lines
Welcome to the 21st century: increase MAXSHELLCMDLEN from 128 bytes to
PAGE_SIZE.

Unlike originator of the PR suggests retain MAXSHELLCMDLEN definition
(he has been proposing to replace it with PAGE_SIZE everywhere), not only
this reduced the diff significantly, but prevents code obfuscation and also
allows to increase/decrease this parameter easily if needed.

PR:		kern/64196
Submitted by:	Magnus Bäckström <b@etek.chalmers.se>

Revision 1.249.2.4: download - view: text, markup, annotated - select for diffs
Sat Feb 5 01:02:50 2005 UTC (7 years ago) by das
Branches: RELENG_5
Diff to: previous 1.249.2.3: preferred, colored; branchpoint 1.249: preferred, colored
Changes since revision 1.249.2.3: +1 -1 lines
MFC:

  2004-11-27 06:51:39 UTC
  Don't include sys/user.h merely for its side-effect of recursively
  including other headers.

Revision 1.249.2.3: download - view: text, markup, annotated - select for diffs
Mon Jan 31 23:26:15 2005 UTC (7 years ago) by imp
Branches: RELENG_5
Diff to: previous 1.249.2.2: preferred, colored; branchpoint 1.249: preferred, colored
Changes since revision 1.249.2.2: +1 -1 lines
MFC: /*- and related license changes

Revision 1.265: download - view: text, markup, annotated - select for diffs
Sat Jan 29 23:51:05 2005 UTC (7 years ago) by sobomax
Branches: MAIN
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +0 -3 lines
Grrr, this committer needs to have a sleep. Remove lines from the previous
delta not intended for public consumption.

MFC after:	2 weeks

Revision 1.264: download - view: text, markup, annotated - select for diffs
Sat Jan 29 23:47:36 2005 UTC (7 years ago) by sobomax
Branches: MAIN
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +4 -4 lines
Fix small non-conformance introduced in the previous commit: execve() is
expected to return ENAMETOOLONG, not E2BIG if first argument doesn't
fit into {PATH_MAX} bytes.

MFC after:	2 weeks

Revision 1.263: download - view: text, markup, annotated - select for diffs
Sat Jan 29 23:11:59 2005 UTC (7 years ago) by sobomax
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +112 -96 lines
o Split out kernel part of execve(2) syscall into two parts: one that
  copies arguments into the kernel space and one that operates
  completely in the kernel space;

o use kernel-only version of execve(2) to kill another stackgap in
  linuxlator/i386.

Obtained from:  DragonFlyBSD (partially)
MFC after:      2 weeks

Revision 1.262: download - view: text, markup, annotated - select for diffs
Tue Jan 25 00:39:00 2005 UTC (7 years ago) by phk
Branches: MAIN
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +3 -2 lines
Don't use VOP_GETVOBJECT, use vp->v_object directly.

Revision 1.261: download - view: text, markup, annotated - select for diffs
Thu Jan 6 23:35:38 2005 UTC (7 years, 1 month ago) by imp
Branches: MAIN
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +1 -1 lines
/* -> /*- for copyright notices, minor format tweaks as necessary

Revision 1.260: download - view: text, markup, annotated - select for diffs
Tue Dec 14 07:20:03 2004 UTC (7 years, 1 month ago) by phk
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +1 -10 lines
Add new function fdunshare() which encapsulates the necessary light magic
for ensuring that a process' filedesc is not shared with anybody.

Use it in the two places which previously had private implmentations.

This collects all fd_refcnt handling in kern_descrip.c

Revision 1.259: download - view: text, markup, annotated - select for diffs
Sat Nov 27 06:51:37 2004 UTC (7 years, 2 months ago) by das
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +1 -1 lines
Don't include sys/user.h merely for its side-effect of recursively
including other headers.

Revision 1.258: download - view: text, markup, annotated - select for diffs
Sat Nov 13 11:53:01 2004 UTC (7 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +3 -3 lines
Introduce an alias for FILEDESC_{UN}LOCK() with the suffix _FAST.

Use this in all the places where sleeping with the lock held is not
an issue.

The distinction will become significant once we finalize the exact
lock-type to use for this kind of case.

Revision 1.257: download - view: text, markup, annotated - select for diffs
Mon Nov 8 12:43:22 2004 UTC (7 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +1 -1 lines
Use more intuitive pointer for fdinit() and fdcopy().

Change fdcopy() to take unlocked filedesc.

Revision 1.256: download - view: text, markup, annotated - select for diffs
Mon Oct 11 22:04:15 2004 UTC (7 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +4 -4 lines
Put on my peril sensitive sunglasses and add a flags field to the internal
sysctl routines and state.  Add some code to use it for signalling the need
to downconvert a data structure to 32 bits on a 64 bit OS when requested by
a 32 bit app.

I tried to do this in a generic abi wrapper that intercepted the sysctl
oid's, or looked up the format string etc, but it was a real can of worms
that turned into a fragile mess before I even got it partially working.

With this, we can now run 'sysctl -a' on a 32 bit sysctl binary and have
it not abort.  Things like netstat, ps, etc have a long way to go.

This also fixes a bug in the kern.ps_strings and kern.usrstack hacks.
These do matter very much because they are used by libc_r and other things.

Revision 1.249.2.2: download - view: text, markup, annotated - select for diffs
Sat Oct 9 04:33:02 2004 UTC (7 years, 4 months ago) by julian
Branches: RELENG_5
CVS tags: RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Diff to: previous 1.249.2.1: preferred, colored; branchpoint 1.249: preferred, colored
Changes since revision 1.249.2.1: +46 -13 lines
MFC:
 1.254     +46 -12    src/sys/kern/kern_exec.c
 1.203     +60 -23    src/sys/kern/kern_thread.c
 1.409     +5 -3      src/sys/sys/proc.h

 In original kern_execve() code, at the start of the function, it forces
 all other threads to suicide, problem is execve() could be failed, and
 a failed execve() would change threaded process to unthreaded, this side
 effect is unexpected.
 The new code introduces a new single threading mode SINGLE_BOUNDARY, in
 the mode, all threads should suspend themself at user boundary except
 the singler. we can not use SINGLE_NO_EXIT because we want to start from
 a clean state if execve() is successful, suspending other threads at unknown
 point and later resuming them from there and forcing them to exit at user
 boundary may cause the process to start from a dirty state. If execve() is
 successful, current thread upgrades to SINGLE_EXIT mode and forces other
 threads to suicide at user boundary, otherwise, other threads will be resumed
 and their interrupted syscall will be restarted.

Submitted by:	davidxu
Approved by:	re (scottl)

Revision 1.255: download - view: text, markup, annotated - select for diffs
Thu Oct 7 13:50:10 2004 UTC (7 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +2 -3 lines
Add an execve command for kse_thr_interrupt to allow libpthread to
restore signal mask correctly, this is required by POSIX.

Reviewed by: deischen

Revision 1.254: download - view: text, markup, annotated - select for diffs
Wed Oct 6 00:40:41 2004 UTC (7 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +46 -12 lines
In original kern_execve() code, at the start of the function, it forces
all other threads to suicide, problem is execve() could be failed, and
a failed execve() would change threaded process to unthreaded, this side
effect is unexpected.
The new code introduces a new single threading mode SINGLE_BOUNDARY, in
the mode, all threads should suspend themself at user boundary except
the singler. we can not use SINGLE_NO_EXIT because we want to start from
a clean state if execve() is successful, suspending other threads at unknown
point and later resuming them from there and forcing them to exit at user
boundary may cause the process to start from a dirty state. If execve() is
successful, current thread upgrades to SINGLE_EXIT mode and forces other
threads to suicide at user boundary, otherwise, other threads will be resumed
and their interrupted syscall will be restarted.

Reviewed by: julian

Revision 1.253: download - view: text, markup, annotated - select for diffs
Thu Sep 23 21:01:50 2004 UTC (7 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +1 -1 lines
- Don't try to unlock Giant if single threading fails since we don't have
  it locked.
- Unlock Giant before calling exit1() since exit1() does not require Giant.

Revision 1.252: download - view: text, markup, annotated - select for diffs
Wed Sep 22 01:30:23 2004 UTC (7 years, 4 months ago) by julian
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +11 -17 lines
Revert the last change..
Better to kill all other threads than to panic the system if 2 threads call
execve() at the same time. A better fix will be committed later.

Note that this only affects the case where the execve fails.

Revision 1.251: download - view: text, markup, annotated - select for diffs
Tue Sep 21 21:05:13 2004 UTC (7 years, 4 months ago) by julian
Branches: MAIN
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +17 -11 lines
In a threaded process, don't kill off all the other threads until we have a
reasonable chance that the eceve() is going to succeeed. I.e.
wait until we've done the permission checks etc.

MFC after:	1 week

Revision 1.249.2.1: download - view: text, markup, annotated - select for diffs
Thu Sep 9 10:03:19 2004 UTC (7 years, 5 months ago) by julian
Branches: RELENG_5
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +2 -6 lines
MFC of:
  Refactor a bunch of scheduler code to give basically the same behaviour
  but with slightly cleaned up interfaces.
(2004-09-05 02:09:54 UTC)
  see version 1.16 of sched.h for the original commit message.

Approved by: re (scottl)

Revision 1.250: download - view: text, markup, annotated - select for diffs
Sun Sep 5 02:09:53 2004 UTC (7 years, 5 months ago) by julian
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +2 -6 lines
Refactor a bunch of scheduler code to give basically the same behaviour
but with slightly cleaned up interfaces.

The KSE structure has become the same as the "per thread scheduler
private data" structure. In order to not make the diffs too great
one is #defined as the other at this time.

The KSE (or td_sched) structure is  now allocated per thread and has no
allocation code of its own.

Concurrency for a KSEGRP is now kept track of via a simple pair of counters
rather than using KSE structures as tokens.

Since the KSE structure is different in each scheduler, kern_switch.c
is now included at the end of each scheduler. Nothing outside the
scheduler knows the contents of the KSE (aka td_sched) structure.

The fields in the ksegrp structure that are to do with the scheduler's
queueing mechanisms are now moved to the kg_sched structure.
(per ksegrp scheduler private data structure). In other words how the
scheduler queues and keeps track of threads is no-one's business except
the scheduler's. This should allow people to write experimental
schedulers with completely different internal structuring.

A scheduler call sched_set_concurrency(kg, N) has been added that
notifies teh scheduler that no more than N threads from that ksegrp
should be allowed to be on concurrently scheduled. This is also
used to enforce 'fainess' at this time so that a ksegrp with
10000 threads can not swamp a the run queue and force out a process
with 1 thread, since the current code will not set the concurrency above
NCPU, and both schedulers will not allow more than that many
onto the system run queue at a time. Each scheduler should eventualy develop
their own methods to do this now that they are effectively separated.

Rejig libthr's kernel interface to follow the same code paths as
linkse for scope system threads. This has slightly hurt libthr's performance
but I will work to recover as much of it as I can.

Thread exit code has been cleaned up greatly.
exit and exec code now transitions a process back to
'standard non-threaded mode' before taking the next step.
Reviewed by:	scottl, peter
MFC after:	1 week

Revision 1.249: download - view: text, markup, annotated - select for diffs
Sun Aug 15 06:24:41 2004 UTC (7 years, 5 months ago) by jmg
Branches: MAIN
CVS tags: RELENG_5_BP
Branch point for: RELENG_5
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +1 -1 lines
Add locking to the kqueue subsystem.  This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers.  Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.

Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks.  Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).

Reviewed by:	green, rwatson (both earlier versions)

Revision 1.248: download - view: text, markup, annotated - select for diffs
Mon Jul 26 07:24:03 2004 UTC (7 years, 6 months ago) by cperciva
Branches: MAIN
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +1 -1 lines
Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL.  This is
somewhat clearer, but more importantly allows for a consistent naming
scheme for suser_cred flags.

The old name is still defined, but will be removed in a few days (unless I
hear any complaints...)

Discussed with:	rwatson, scottl
Requested by:	jhb

Revision 1.247: download - view: text, markup, annotated - select for diffs
Sat Jul 24 04:57:41 2004 UTC (7 years, 6 months ago) by julian
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +3 -3 lines
White space fix..
diff reduction for upcoming commit.

Revision 1.246: download - view: text, markup, annotated - select for diffs
Tue Jul 13 02:49:22 2004 UTC (7 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +0 -2 lines
Push down the acquisition and release of the page queues lock into
pmap_remove_pages().  (The implementation of pmap_remove_pages() is
optional.  If pmap_remove_pages() is unimplemented, the acquisition and
release of the page queues lock is unnecessary.)

Remove spl calls from the alpha, arm, and ia64 pmap_remove_pages().

Revision 1.245: download - view: text, markup, annotated - select for diffs
Wed Jun 2 07:52:34 2004 UTC (7 years, 8 months ago) by tjr
Branches: MAIN
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +1 -3 lines
Move TDF_SA from td_flags to td_pflags (and rename it accordingly)
so that it is no longer necessary to hold sched_lock while
manipulating it.

Reviewed by:	davidxu

Revision 1.244: download - view: text, markup, annotated - select for diffs
Fri May 21 14:50:23 2004 UTC (7 years, 8 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +3 -0 lines
Clear KSE thread flags after KSE thread mode is ended. The side effect
of not clearing the flags for execv() syscall will result that a new
program runs in KSE thread mode without enabling it.

Submitted by: tjr
Modified by: davidxu

Revision 1.243: download - view: text, markup, annotated - select for diffs
Fri Apr 23 03:01:39 2004 UTC (7 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +12 -10 lines
Utilize sf_buf_alloc() rather than pmap_qenter() (and sometimes
kmem_alloc_wait()) for mapping the image header.  On all machines with a
direct virtual-to-physical mapping and SMP/HTT i386s, this is a clear win.

Revision 1.242: download - view: text, markup, annotated - select for diffs
Sun Apr 11 19:57:11 2004 UTC (7 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +2 -2 lines
Use vm_page_hold() rather than vm_page_wire() for short-duration page
wiring.  The reason being that vm_page_hold() is cheaper.

Revision 1.241: download - view: text, markup, annotated - select for diffs
Thu Apr 1 00:10:44 2004 UTC (7 years, 10 months ago) by pjd
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +0 -3 lines
Remove sysctl kern.ps_argsopen, it is not very useful, one should use
security.bsd.see_other_uids instead.

Discussed with:	phk, rwatson

Revision 1.240: download - view: text, markup, annotated - select for diffs
Sun Mar 14 02:06:27 2004 UTC (7 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +1 -0 lines
Make the process_exit eventhandler run without Giant.  Add Giant hooks
in the two consumers that need it.. processes using AIO and netncp.
Update docs.  Say that process_exec is called with Giant, but not to
depend on it.  All our consumers can handle it without Giant.

Revision 1.239: download - view: text, markup, annotated - select for diffs
Sat Mar 13 22:31:38 2004 UTC (7 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +0 -2 lines
Push Giant down a little further:
- no longer serialize on Giant for thread_single*() and family in fork,
  exit and exec
- thread_wait() is mpsafe, assert no Giant
- reduce scope of Giant in exit to not cover thread_wait and just do
  vm_waitproc().
- assert that thread_single() family are not called with Giant
- remove the DROP/PICKUP_GIANT macros from thread_single() family
- assert that thread_suspend_check() s not called with Giant
- remove manual drop_giant hack in thread_suspend_check since we know it
  isn't held.
- remove the DROP/PICKUP_GIANT macros from thread_suspend_check() family
- mark kse_create() mpsafe

Revision 1.238: download - view: text, markup, annotated - select for diffs
Fri Mar 12 21:06:20 2004 UTC (7 years, 11 months ago) by ru
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +2 -1 lines
Do what the execve(2) manpage says and enforce what a Strictly
Conforming POSIX application should do by disallowing the argv
argument to be NULL.

PR:		kern/33738
Submitted by:	Marc Olzheim, Serge van den Boom
OK'ed by:	nectar

Revision 1.237: download - view: text, markup, annotated - select for diffs
Fri Mar 5 22:38:26 2004 UTC (7 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +3 -0 lines
Lock Giant around the single threading code in exec() to satisfy an
assertion in the single threading code.

Revision 1.236: download - view: text, markup, annotated - select for diffs
Wed Feb 18 00:54:17 2004 UTC (7 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +22 -4 lines
Checkpoint a hack to enable running i386 libc_r binaries on a 64 bit
kernel.  I'm not happy with it yet - refinements are to come.
This hack allows the kern.ps_strings and kern.usrstack sysctls to respond
to a 32 bit request, such as those coming from emulated i386 binaries.

Revision 1.235: download - view: text, markup, annotated - select for diffs
Sun Dec 28 04:37:59 2003 UTC (8 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +7 -8 lines
Fixed some style bugs (mainly, try to always use explicit comparisons with
NULL when checking for null pointers).

Revision 1.234: download - view: text, markup, annotated - select for diffs
Sun Dec 28 04:18:13 2003 UTC (8 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +55 -55 lines
Fixed some disordering in revs.1.194 and 1,196.  Moved the exceve() syscall
function back to near the beginning of the file.  Rev.1.194 moved it into
the middle of auxiliary functions following kern_execve().  Moved the
__mac_execve() syscall function up together with execve().  It was new in
rev1.1.196 and perfectly misplaced after execve().

Revision 1.233: download - view: text, markup, annotated - select for diffs
Sat Dec 27 19:40:03 2003 UTC (8 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +0 -1 lines
Remove GIANT_REQUIRED from exec_unmap_first_page().

Revision 1.232: download - view: text, markup, annotated - select for diffs
Wed Nov 12 03:14:29 2003 UTC (8 years, 3 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +11 -13 lines
Modify the MAC Framework so that instead of embedding a (struct label)
in various kernel objects to represent security data, we embed a
(struct label *) pointer, which now references labels allocated using
a UMA zone (mac_label.c).  This allows the size and shape of struct
label to be varied without changing the size and shape of these kernel
objects, which become part of the frozen ABI with 5-STABLE.  This opens
the door for boot-time selection of the number of label slots, and hence
changes to the bound on the number of simultaneous labeled policies
at boot-time instead of compile-time.  This also makes it easier to
embed label references in new objects as required for locking/caching
with fine-grained network stack locking, such as inpcb structures.

This change also moves us further in the direction of hiding the
structure of kernel objects from MAC policy modules, not to mention
dramatically reducing the number of '&' symbols appearing in both the
MAC Framework and MAC policy modules, and improving readability.

While this results in minimal performance change with MAC enabled, it
will observably shrink the size of a number of critical kernel data
structures for the !MAC case, and should have a small (but measurable)
performance benefit (i.e., struct vnode, struct socket) do to memory
conservation and reduced cost of zeroing memory.

NOTE: Users of MAC must recompile their kernel and all MAC modules as a
result of this change.  Because this is an API change, third party
MAC modules will also need to be updated to make less use of the '&'
symbol.

Suggestions from:	bmilekic
Obtained from:		TrustedBSD Project
Sponsored by:		DARPA, Network Associates Laboratories

Revision 1.231: download - view: text, markup, annotated - select for diffs
Tue Oct 21 01:13:49 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +0 -1 lines
Remove md_bspstore from the MD fields of struct thread. Now that
the backing store is at a fixed address, there's no need for a
per-thread variable.

Revision 1.230: download - view: text, markup, annotated - select for diffs
Mon Oct 20 05:34:10 2003 UTC (8 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +1 -1 lines
Put the RSE backing store at a fixed address. This change is triggered
by libguile that needs to know the base of the RSE backing store. We
currently do not export the fixed address to userland by means of a
sysctl so user code needs to hardcode it for now. This will be revisited
later.

The RSE backing store is now at the bottom of region 4. The memory stack
is at the top of region 4. This means that the whole region is usable
for the stacks, giving a 61-bit stack space.

Port: lang/guile (depended of x11/gnome2)

Revision 1.229: download - view: text, markup, annotated - select for diffs
Sat Oct 4 22:47:20 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +6 -9 lines
Eliminate some unnecessary uses of the vm page queues lock around the
vm page's valid field.  This field is being synchronized using the
containing vm object's lock.

Revision 1.228: download - view: text, markup, annotated - select for diffs
Sat Sep 27 23:07:47 2003 UTC (8 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +0 -6 lines
Remove the regstkpages sysctl variable. We have a growable register
stack now.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Sat Sep 27 22:28:13 2003 UTC (8 years, 4 months ago) by marcel
Branches: MAIN
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +9 -15 lines
Part 2 of implementing rstacks: add the ability to create rstacks and
use the ability on ia64 to map the register stack. The orientation of
the stack (i.e. its grow direction) is passed to vm_map_stack() in the
overloaded cow argument. Since the grow direction is represented by
bits, it is possible and allowed to create bi-directional stacks.
This is not an advertised feature, more of a side-effect.

Fix a bug in vm_map_growstack() that's specific to rstacks and which
we could only find by having the ability to create rstacks: when
the mapped stack ends at the faulting address, we have not actually
mapped the faulting address. we need to include or cover the faulting
address.

Note that at this time mmap(2) has not been extended to allow the
creation of rstacks by processes. If such a need arises, this can
be done.

Tested on: alpha, i386, ia64, sparc64

Revision 1.226: download - view: text, markup, annotated - select for diffs
Thu Sep 25 01:10:25 2003 UTC (8 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +9 -0 lines
Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bit
systems where the data/stack/etc limits are too big for a 32 bit process.

Move the 5 or so identical instances of ELF_RTLD_ADDR() into imgact_elf.c.

Supply an ia32_fixlimits function.  Export the clip/default values to
sysctl under the compat.ia32 heirarchy.

Have mmap(0, ...) respect the current p->p_limits[RLIMIT_DATA].rlim_max
value rather than the sysctl tweakable variable.  This allows mmap to
place mappings at sensible locations when limits have been reduced.

Have the imgact_elf.c ld-elf.so.1 placement algorithm use the same
method as mmap(0, ...) now does.

Note that we cannot remove all references to the sysctl tweakable
maxdsiz etc variables because /etc/login.conf specifies a datasize
of 'unlimited'.  And that causes exec etc to fail since it can no
longer find space to mmap things.

Revision 1.225: download - view: text, markup, annotated - select for diffs
Sat Jul 26 07:32:22 2003 UTC (8 years, 6 months ago) by phk
Branches: MAIN
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +1 -1 lines
Add a "int fd" argument to VOP_OPEN() which in the future will
contain the filedescriptor number on opens from userland.

The index is used rather than a "struct file *" since it conveys a bit
more information, which may be useful to in particular fdescfs and /dev/fd/*

For now pass -1 all over the place.

Revision 1.224: download - view: text, markup, annotated - select for diffs
Sun Jun 15 00:31:23 2003 UTC (8 years, 7 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +2 -2 lines
Rename P_THREADED to P_SA. P_SA means a process is using scheduler
activations.

Revision 1.223: download - view: text, markup, annotated - select for diffs
Fri Jun 13 03:02:27 2003 UTC (8 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +0 -2 lines
Add vm object locking to various pagers' "get pages" methods, i386 stack
management functions, and a u area management function.

Revision 1.222: download - view: text, markup, annotated - select for diffs
Wed Jun 11 00:56:55 2003 UTC (8 years, 8 months ago) by obrien
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +3 -2 lines
Use __FBSDID().

Revision 1.221: download - view: text, markup, annotated - select for diffs
Mon Jun 9 19:37:14 2003 UTC (8 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +15 -9 lines
Update the vm object and page locking in exec_map_first_page().  Mark the
one still anticipated change with XXX.  Otherwise, this function is done.

Revision 1.220: download - view: text, markup, annotated - select for diffs
Sun Jun 8 07:14:30 2003 UTC (8 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +2 -2 lines
Lock the vm object when performing vm_page_grab().

Revision 1.219: download - view: text, markup, annotated - select for diffs
Tue May 13 20:35:59 2003 UTC (8 years, 9 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +10 -15 lines
- Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
  M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
  sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
  that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
  and thread_stopped() are now MP safe.

Reviewed by:	arch@
Approved by:	re (rwatson)

Revision 1.218: download - view: text, markup, annotated - select for diffs
Tue Apr 1 01:26:20 2003 UTC (8 years, 10 months ago) by jeff
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +1 -1 lines
 - Borrow the KSE single threading code for exec and exit.  We use the check
   if (p->p_numthreads > 1) and not a flag because action is only necessary
   if there are other threads.  The rest of the system has no need to
   identify thr threaded processes.
 - In kern_thread.c use thr_exit1() instead of thread_exit() if P_THREADED
   is not set.

Revision 1.217: download - view: text, markup, annotated - select for diffs
Mon Mar 24 21:15:34 2003 UTC (8 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +2 -59 lines
Replace the at_fork, at_exec, and at_exit functions with the slightly more
flexible process_fork, process_exec, and process_exit eventhandlers.  This
reduces code duplication and also means that I don't have to go duplicate
the eventhandler locking three more times for each of at_fork, at_exec, and
at_exit.

Reviewed by:	phk, jake, almost complete silence on arch@

Revision 1.216: download - view: text, markup, annotated - select for diffs
Thu Mar 13 18:24:22 2003 UTC (8 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +8 -3 lines
- Cache a reference to the credential of the thread that starts a ktrace in
  struct proc as p_tracecred alongside the current cache of the vnode in
  p_tracep.  This credential is then used for all later ktrace operations on
  this file rather than using the credential of the current thread at the
  time of each ktrace event.
- Now that we have multiple ktrace-related items in struct proc that are
  pointers, rename p_tracep to p_tracevp to make it less ambiguous.

Requested by:	rwatson (1)

Revision 1.215: download - view: text, markup, annotated - select for diffs
Thu Feb 27 02:05:17 2003 UTC (8 years, 11 months ago) by julian
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +2 -2 lines
Change the process flags P_KSES to be P_THREADED.
This is just a cosmetic change but I've been meaning to do it for about a year.

Revision 1.214: download - view: text, markup, annotated - select for diffs
Wed Feb 19 05:47:25 2003 UTC (8 years, 11 months ago) by imp
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +3 -3 lines
Back out M_* changes, per decision of the TRB.

Approved by: trb

Revision 1.213: download - view: text, markup, annotated - select for diffs
Mon Feb 17 05:14:25 2003 UTC (8 years, 11 months ago) by jeff
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +0 -3 lines
 - Split the struct kse into struct upcall and struct kse.  struct kse will
   soon be visible only to schedulers.  This greatly simplifies much the
   KSE code.

Submitted by:	davidxu

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sat Feb 1 12:17:07 2003 UTC (9 years ago) by julian
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +3 -0 lines
Reversion of commit by Davidxu plus fixes since applied.

I'm not convinced there is anything major wrong with the patch but
them's the rules..

I am using my "David's mentor" hat to revert this as he's
offline for a while.

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sun Jan 26 11:41:34 2003 UTC (9 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +0 -3 lines
Move UPCALL related data structure out of kse, introduce a new
data structure called kse_upcall to manage UPCALL. All KSE binding
and loaning code are gone.

A thread owns an upcall can collect all completed syscall contexts in
its ksegrp, turn itself into UPCALL mode, and takes those contexts back
to userland. Any thread without upcall structure has to export their
contexts and exit at user boundary.

Any thread running in user mode owns an upcall structure, when it enters
kernel, if the kse mailbox's current thread pointer is not NULL, then
when the thread is blocked in kernel, a new UPCALL thread is created and
the upcall structure is transfered to the new UPCALL thread. if the kse
mailbox's current thread pointer is NULL, then when a thread is blocked
in kernel, no UPCALL thread will be created.

Each upcall always has an owner thread. Userland can remove an upcall by
calling kse_exit, when all upcalls in ksegrp are removed, the group is
atomatically shutdown. An upcall owner thread also exits when process is
in exiting state. when an owner thread exits, the upcall it owns is also
removed.

KSE is a pure scheduler entity. it represents a virtual cpu. when a thread
is running, it always has a KSE associated with it. scheduler is free to
assign a KSE to thread according thread priority, if thread priority is changed,
KSE can be moved from one thread to another.

When a ksegrp is created, there is always N KSEs created in the group. the
N is the number of physical cpu in the current system. This makes it is
possible that even an userland UTS is single CPU safe, threads in kernel still
can execute on different cpu in parallel. Userland calls kse_create to add more
upcall structures into ksegrp to increase concurrent in userland itself, kernel
is not restricted by number of upcalls userland provides.

The code hasn't been tested under SMP by author due to lack of hardware.

Reviewed by: julian

Revision 1.210: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:55:54 2003 UTC (9 years ago) by alfred
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +3 -3 lines
Remove M_TRYWAIT/M_WAITOK/M_WAIT.  Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.

Revision 1.209: download - view: text, markup, annotated - select for diffs
Tue Jan 21 03:26:28 2003 UTC (9 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +5 -5 lines
Perform VOP_GETATTR() before mac_check_vnode_exec() so that
the cached attributes are available to MAC modules.

Submitted by:   mike halderman <mrh@nosc.mil>
Obtained from:	TrustedBSD Project

Revision 1.208: download - view: text, markup, annotated - select for diffs
Mon Jan 13 23:04:31 2003 UTC (9 years ago) by dillon
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +1 -2 lines
It is possible for an active aio to prevent shared memory from being
dereferenced when a process exits due to the vmspace ref-count being
bumped.  Change shmexit() and shmexit_myhook() to take a vmspace instead
of a process and call it in vmspace_dofree().  This way if it is missed
in exit1()'s early-resource-free it will still be caught when the zombie is
reaped.

Also fix a potential race in shmexit_myhook() by NULLing out
vmspace->vm_shm prior to calling shm_delete_mapping() and free().

MFC after:	7 days

Revision 1.207: download - view: text, markup, annotated - select for diffs
Tue Jan 7 06:56:43 2003 UTC (9 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +3 -0 lines
Clear some KSE fields after kse mode was turned off.

Revision 1.206: download - view: text, markup, annotated - select for diffs
Sat Jan 4 07:54:23 2003 UTC (9 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +14 -0 lines
Add a sysctl to get the vm protections for the stack of the current process.
On architectures with a non-executable stack, eg sparc64, this is used by
libgcc to determine at runtime if its necessary to enable execute permissions
on a region of the stack which will be used to execute code, allowing the
call to mprotect to be avoided if the kernel is configured to map the stack
executable.

Revision 1.205: download - view: text, markup, annotated - select for diffs
Wed Jan 1 01:19:31 2003 UTC (9 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +1 -1 lines
fdcopy() only needs a filedesc pointer.

Revision 1.202.2.1: download - view: text, markup, annotated - select for diffs
Thu Dec 19 09:40:10 2002 UTC (9 years, 1 month ago) by alfred
Branches: RELENG_5_0
CVS tags: RELENG_5_0_0_RELEASE
Diff to: previous 1.202: preferred, colored; next MAIN 1.203: preferred, colored
Changes since revision 1.202: +7 -7 lines
MFC: SCARGS and syscallargs removal.

Approved by: re@ (rwatson)

Revision 1.204: download - view: text, markup, annotated - select for diffs
Wed Dec 18 20:16:22 2002 UTC (9 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +2 -0 lines
Hold the page queues lock when performing vm_page_busy().

Revision 1.203: download - view: text, markup, annotated - select for diffs
Sat Dec 14 02:07:32 2002 UTC (9 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +7 -7 lines
remove syscallarg().

Suggested by: peter

Revision 1.202: download - view: text, markup, annotated - select for diffs
Tue Nov 26 17:30:55 2002 UTC (9 years, 2 months ago) by robert
Branches: MAIN
CVS tags: RELENG_5_0_BP
Branch point for: RELENG_5_0
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +7 -3 lines
To avoid sleeping with all sorts of resources acquired (the reported
problem was a locked directory vnode), do not give the process a chance
to sleep in state "stopevent" (depends on the S_EXEC bit being set in
p_stops) until most resources have been released again.

Approved by:	re

Revision 1.201: download - view: text, markup, annotated - select for diffs
Mon Nov 25 04:37:44 2002 UTC (9 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +2 -0 lines
Acquire and release the page queues lock around pmap_remove_pages() because
it updates several of vm_page's fields.

Revision 1.200: download - view: text, markup, annotated - select for diffs
Sun Nov 17 09:33:00 2002 UTC (9 years, 2 months ago) by jeff
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +4 -4 lines
 - Release the imgp vnode prior to freeing exec_map resources to avoid
   deadlock.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Sat Nov 16 07:44:25 2002 UTC (9 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +1 -1 lines
Now that pmap_remove_all() is exported by our pmap implementations
use it directly.

Revision 1.198: download - view: text, markup, annotated - select for diffs
Sun Nov 10 07:12:04 2002 UTC (9 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +1 -1 lines
When prot is VM_PROT_NONE, call pmap_page_protect() directly rather than
indirectly through vm_page_protect().  The one remaining page flag that
is updated by vm_page_protect() is already being updated by our various
pmap implementations.

Note: A later commit will similarly change the VM_PROT_READ case and
eliminate vm_page_protect().

Revision 1.197: download - view: text, markup, annotated - select for diffs
Tue Nov 5 18:04:50 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +4 -4 lines
Correct merge-o: disable the right execve() variation if !MAC

Revision 1.196: download - view: text, markup, annotated - select for diffs
Tue Nov 5 17:51:55 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +72 -8 lines
Bring in two sets of changes:

(1) Permit userland applications to request a change of label atomic
    with an execve() via mac_execve().  This is required for the
    SEBSD port of SELinux/FLASK.  Attempts to invoke this without
    MAC compiled in result in ENOSYS, as with all other MAC system
    calls.  Complexity, if desired, is present in policy modules,
    rather than the framework.

(2) Permit policies to have access to both the label of the vnode
    being executed as well as the interpreter if it's a shell
    script or related UNIX nonsense.  Because we can't hold both
    vnode locks at the same time, cache the interpreter label.
    SEBSD relies on this because it supports secure transitioning
    via shell script executables.  Other policies might want to
    take both labels into account during an integrity or
    confidentiality decision at execve()-time.

Approved by:	re
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.195: download - view: text, markup, annotated - select for diffs
Tue Nov 5 14:57:49 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +15 -0 lines
Hook up the mac_will_execve_transition() and mac_execve_transition()
entrypoints, #ifdef MAC.  The supporting logic already existed in
kern_mac.c, so no change there.  This permits MAC policies to cause
a process label change as the result of executing a binary --
typically, as a result of executing a specially labeled binary.

For example, the SEBSD port of SELinux/FLASK uses this functionality
to implement TE type transitions on processes using transitioning
binaries, in a manner similar to setuid.  Policies not implementing
a notion of transition (all the ones in the tree right now) require
no changes, since the old label data is copied to the new label
via mac_create_cred() even if a transition does occur.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.194: download - view: text, markup, annotated - select for diffs
Tue Nov 5 01:59:56 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +39 -17 lines
Remove reference to struct execve_args from struct imgact, which
describes an image activation instance.  Instead, make use of the
existing fname structure entry, and introduce two new entries,
userspace_argv, and userspace_envv.  With the addition of
mac_execve(), this divorces the image structure from the specifics
of the execve() system call, removes a redundant pointer, etc.
No semantic change from current behavior, but it means that the
structure doesn't depend on syscalls.master-generated includes.

There seems to be some redundant initialization of imgact entries,
which I have maintained, but which could probably use some cleaning
up at some point.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.193: download - view: text, markup, annotated - select for diffs
Fri Oct 11 21:04:01 2002 UTC (9 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +9 -10 lines
- Move the 'done1' label down below the unlock of the proc lock and move
  the locking of the proc lock after the goto to done1 to avoid locking
  the lock in an error case just so we can turn around and unlock it.
- Move the exec_setregs() stuff out from under the proc lock and after
  the p_args stuff.  This allows exec_setregs() to be able to sleep or
  write things out to userland, etc. which ia64 does.

Tested by:	peter

Revision 1.192: download - view: text, markup, annotated - select for diffs
Sat Sep 21 22:07:16 2002 UTC (9 years, 4 months ago) by jake
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +46 -20 lines
Use the fields in the sysentvec and in the vm map header in place of the
constants VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK and PS_STRINGS.
This is mainly so that they can be variable even for the native abi, based
on different machine types.  Get stack protections from the sysentvec too.
This makes it trivial to map the stack non-executable for certain abis, on
machines that support it.

Revision 1.191: download - view: text, markup, annotated - select for diffs
Sat Sep 14 18:55:11 2002 UTC (9 years, 4 months ago) by njl
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +5 -3 lines
Move setugidsafety() call outside of process lock.  This prevents a lock
recursion when closef() calls pfind() which also wants the proc lock.
This case only occurred when setugidsafety() needed to close unsafe files.

Reviewed by:	truckman

Revision 1.190: download - view: text, markup, annotated - select for diffs
Fri Sep 13 09:31:56 2002 UTC (9 years, 4 months ago) by truckman
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +8 -1 lines
Drop the proc lock while calling fdcheckstd() which may block to allocate
memory.

Reviewed by:	jhb

Revision 1.189: download - view: text, markup, annotated - select for diffs
Thu Sep 5 07:30:14 2002 UTC (9 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +1 -1 lines
s/SGNL/SIG/
s/SNGL/SINGLE/
s/SNGLE/SINGLE/

Fix abbreviation for P_STOPPED_* etc flags, in original code they were
inconsistent and difficult to distinguish between them.

Approved by: julian (mentor)

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sun Sep 1 21:41:23 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +0 -2 lines
Added fields for VM_MIN_ADDRESS, PS_STRINGS and stack protections to
sysentvec.  Initialized all fields of all sysentvecs, which will allow
them to be used instead of constants in more places.  Provided stack
fixup routines for emulations that previously used the default.

Revision 1.187: download - view: text, markup, annotated - select for diffs
Thu Aug 29 06:17:47 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +2 -2 lines
Renamed poorly named setregs to exec_setregs.  Moved its prototype to
imgact.h with the other exec support functions.

Revision 1.186: download - view: text, markup, annotated - select for diffs
Thu Aug 29 01:28:27 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +7 -3 lines
Don't require that sysentvec.sv_szsigcode be non-NULL.

Revision 1.185: download - view: text, markup, annotated - select for diffs
Sun Aug 25 22:36:52 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +6 -7 lines
Fixed most indentation bugs.

Revision 1.184: download - view: text, markup, annotated - select for diffs
Sun Aug 25 20:48:45 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +15 -11 lines
Fixed placement of operators.  Wrapped long lines.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Sat Aug 24 22:55:16 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +8 -9 lines
Fixed white space around operators, casts and reserved words.

Reviewed by:	md5

Revision 1.182: download - view: text, markup, annotated - select for diffs
Sat Aug 24 22:01:40 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +11 -11 lines
return x; -> return (x);
return(x); -> return (x);

Reviewed by:	md5

Revision 1.181: download - view: text, markup, annotated - select for diffs
Thu Aug 22 21:45:58 2002 UTC (9 years, 5 months ago) by julian
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +12 -4 lines
slight cleanup of single-threading code for KSE processes

Revision 1.180: download - view: text, markup, annotated - select for diffs
Tue Aug 13 06:55:28 2002 UTC (9 years, 6 months ago) by jeff
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +36 -11 lines
 - Hold the vnode lock throughout execve.
 - Set VV_TEXT in the top level execve code.
 - Fixup the image activators to deal with the newly locked vnode.

Revision 1.179: download - view: text, markup, annotated - select for diffs
Thu Aug 1 14:31:58 2002 UTC (9 years, 6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +9 -0 lines
Introduce support for Mandatory Access Control and extensible
kernel access control.

Invoke an appropriate MAC entry point to authorize execution of
a file by a process.  The check is placed slightly differently
than it appears in the trustedbsd_mac tree so that it prevents
a little more information leakage about the target of the execve()
operation.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.107.2.8.2.3: download - view: text, markup, annotated - select for diffs
Tue Jul 30 15:43:17 2002 UTC (9 years, 6 months ago) by nectar
Branches: RELENG_4_4
Diff to: previous 1.107.2.8.2.2: preferred, colored; branchpoint 1.107.2.8: preferred, colored; next MAIN 1.107.2.9: preferred, colored
Changes since revision 1.107.2.8.2.2: +2 -1 lines
MFC sys/kern/kern_exec.c 1.178: Fix ordering of set-(user|group)-ID checks.

Revision 1.107.2.13.2.2: download - view: text, markup, annotated - select for diffs
Tue Jul 30 15:42:46 2002 UTC (9 years, 6 months ago) by nectar
Branches: RELENG_4_5
Diff to: previous 1.107.2.13.2.1: preferred, colored; branchpoint 1.107.2.13: preferred, colored; next MAIN 1.107.2.14: preferred, colored
Changes since revision 1.107.2.13.2.1: +2 -1 lines
MFC sys/kern/kern_exec.c 1.178: Fix ordering of set-(user|group)-ID checks.

Revision 1.107.2.14.2.1: download - view: text, markup, annotated - select for diffs
Tue Jul 30 15:42:11 2002 UTC (9 years, 6 months ago) by nectar
Branches: RELENG_4_6
CVS tags: RELENG_4_6_2_RELEASE
Diff to: previous 1.107.2.14: preferred, colored; next MAIN 1.107.2.15: preferred, colored
Changes since revision 1.107.2.14: +2 -1 lines
MFC sys/kern/kern_exec.c 1.178: Fix ordering of set-(user|group)-ID checks.

Revision 1.107.2.15: download - view: text, markup, annotated - select for diffs
Tue Jul 30 15:40:46 2002 UTC (9 years, 6 months ago) by nectar
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7, RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.107.2.14: preferred, colored; branchpoint 1.107: preferred, colored; next MAIN 1.108: preferred, colored
Changes since revision 1.107.2.14: +2 -1 lines
MFC 1.178: Fix ordering of set-(user|group)-ID checks.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Tue Jul 30 15:38:29 2002 UTC (9 years, 6 months ago) by nectar
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +2 -1 lines
For processes which are set-user-ID or set-group-ID, the kernel performs a few
special actions for safety.  One of these is to make sure that file descriptors
0..2 are in use, by opening /dev/null for those that are not already open.
Another is to close any file descriptors 0..2 that reference procfs.  However,
these checks were made out of order, so that it was still possible for a
set-user-ID or set-group-ID process to be started with some of the file
descriptors 0..2 unused.

Submitted by:	Georgi Guninski <guninski@guninski.com>

Revision 1.177: download - view: text, markup, annotated - select for diffs
Sat Jul 27 18:06:49 2002 UTC (9 years, 6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +8 -2 lines
Slight restructuring of the logic for credential change case identification
during execve() to use a 'credential_changing' variable.  This makes it
easier to have outstanding patchsets against this code, as well as to
add conditionally defined clauses.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs

Revision 1.176: download - view: text, markup, annotated - select for diffs
Sat Jul 20 02:56:11 2002 UTC (9 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +20 -9 lines
Infrastructure tweaks to allow having both an Elf32 and an Elf64 executable
handler in the kernel at the same time.  Also, allow for the
exec_new_vmspace() code to build a different sized vmspace depending on
the executable environment.  This is a big help for execing i386 binaries
on ia64.   The ELF exec code grows the ability to map partial pages when
there is a page size difference, eg: emulating 4K pages on 8K or 16K
hardware pages.

Flesh out the i386 emulation support for ia64.  At this point, the only
binary that I know of that fails is cvsup, because the cvsup runtime
tries to execute code in pages not marked executable.

Obtained from:  dfr (mostly, many tweaks from me).

Revision 1.175: download - view: text, markup, annotated - select for diffs
Sun Jul 14 17:58:35 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +2 -2 lines
In execve(), delay the acquisition of Giant until after kmem_alloc_wait().
(Operations on the exec_map don't require Giant.)

Revision 1.174: download - view: text, markup, annotated - select for diffs
Sat Jul 13 03:13:15 2002 UTC (9 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +1 -3 lines
We don't need to clear oldcred here since newcred is not NULL yet.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Thu Jul 11 18:48:05 2002 UTC (9 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +6 -1 lines
 o Lock accesses to the page queues.

Revision 1.172: download - view: text, markup, annotated - select for diffs
Sat Jul 6 07:00:01 2002 UTC (9 years, 7 months ago) by jeff
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +8 -0 lines
Clean up execve locking:

 - Grab the vnode object early in exec when we still have the vnode lock.
 - Cache the object in the image_params.
 - Make use of the cached object in imgact_*.c

Revision 1.171: download - view: text, markup, annotated - select for diffs
Mon Jul 1 23:18:08 2002 UTC (9 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +3 -0 lines
#include <sys/ktrace.h> would be useful too.  (for ktrace_mtx)

Revision 1.170: download - view: text, markup, annotated - select for diffs
Mon Jul 1 19:49:04 2002 UTC (9 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +2 -0 lines
Add #include "opt_ktrace.h"

Revision 1.169: download - view: text, markup, annotated - select for diffs
Sat Jun 29 17:26:18 2002 UTC (9 years, 7 months ago) by julian
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +6 -4 lines
Part 1 of KSE-III

The ability to schedule multiple threads per process
(one one cpu) by making ALL system calls optionally asynchronous.
to come: ia64 and power-pc patches, patches for gdb, test program (in tools)

Reviewed by:	Almost everyone who counts
	(at various times, peter, jhb, matt, alfred, mini, bernd,
	and a cast of thousands)

	NOTE: this is still Beta code, and contains lots of debugging stuff.
	expect slight instability in signals..

Revision 1.168: download - view: text, markup, annotated - select for diffs
Sat Jun 29 01:50:24 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +1 -1 lines
More caddr_t removal, make fo_ioctl take a void * instead of a caddr_t.

Revision 1.167: download - view: text, markup, annotated - select for diffs
Tue Jun 25 18:14:38 2002 UTC (9 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +0 -1 lines
 o Eliminate vmspace::vm_minsaddr.  It's initialized but never used.
 o Replace stale comments in vmspace by "const until freed" annotations
   on some fields.

Revision 1.166: download - view: text, markup, annotated - select for diffs
Thu Jun 20 17:27:28 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +10 -5 lines
Don't leak resources if fdcheckstd() fails during exec.

Submitted by: Mike Makonnen <makonnen@pacbell.net>

Revision 1.165: download - view: text, markup, annotated - select for diffs
Wed Jun 19 06:39:24 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +4 -1 lines
Squish the "could sleep with process lock" messages caused by calling
uifind() with a proc lock held.

change_ruid() and change_euid() have been modified to take a uidinfo
structure which will be pre-allocated by callers, they will then
call uihold() on the uidinfo structure so that the caller's logic
is simplified.

This allows one to call uifind() before locking the proc struct and
thereby avoid a potential blocking allocation with the proc lock
held.

This may need revisiting, perhaps keeping a spare uidinfo allocated
per process to handle this situation or re-examining if the proc
lock needs to be held over the entire operation of changing real
or effective user id.

Submitted by: Don Lewis <dl-freebsd@catspoiler.org>

Revision 1.164: download - view: text, markup, annotated - select for diffs
Fri Jun 7 05:41:27 2002 UTC (9 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +10 -1 lines
Properly lock accesses to p_tracep and p_traceflag.  Also make a few
ktrace-only things #ifdef KTRACE that were not before.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Thu May 2 15:00:14 2002 UTC (9 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +73 -61 lines
- Reorder execve() so that it performs blocking operations before it
  locks the process.
- Defer other blocking operations such as vrele()'s until after we
  release locks.
- execsigs() now requires the proc lock to be held when it is called
  rather than locking the process internally.

Revision 1.107.2.8.2.2: download - view: text, markup, annotated - select for diffs
Sun Apr 21 13:10:50 2002 UTC (9 years, 9 months ago) by nectar
Branches: RELENG_4_4
Diff to: previous 1.107.2.8.2.1: preferred, colored; branchpoint 1.107.2.8: preferred, colored
Changes since revision 1.107.2.8.2.1: +4 -0 lines
MFC 1.137 src/sys/kern/kern_descrip.c
    1.162 src/sys/kern/kern_exec.c
    1.41  src/sys/sys/filedesc.h

When exec'ing a set[ug]id program, make sure that the stdio file descriptors
(0, 1, 2) are allocated by opening /dev/null for any which are not already
open.

Revision 1.107.2.13.2.1: download - view: text, markup, annotated - select for diffs
Sun Apr 21 13:08:56 2002 UTC (9 years, 9 months ago) by nectar
Branches: RELENG_4_5
Diff to: previous 1.107.2.13: preferred, colored
Changes since revision 1.107.2.13: +4 -0 lines
MFC 1.137 src/sys/kern/kern_descrip.c
    1.162 src/sys/kern/kern_exec.c
    1.41  src/sys/sys/filedesc.h

When exec'ing a set[ug]id program, make sure that the stdio file descriptors
(0, 1, 2) are allocated by opening /dev/null for any which are not already
open.

Revision 1.107.2.14: download - view: text, markup, annotated - select for diffs
Sun Apr 21 13:06:23 2002 UTC (9 years, 9 months ago) by nectar
Branches: RELENG_4
CVS tags: RELENG_4_6_BP, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE
Branch point for: RELENG_4_6
Diff to: previous 1.107.2.13: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.13: +4 -0 lines
MFC 1.137 src/sys/kern/kern_descrip.c
    1.162 src/sys/kern/kern_exec.c
    1.41  src/sys/sys/filedesc.h

When exec'ing a set[ug]id program, make sure that the stdio file descriptors
(0, 1, 2) are allocated by opening /dev/null for any which are not already
open.

Revision 1.162: download - view: text, markup, annotated - select for diffs
Fri Apr 19 00:45:26 2002 UTC (9 years, 9 months ago) by nectar
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +4 -0 lines
When exec'ing a set[ug]id program, make sure that the stdio file descriptors
(0, 1, 2) are allocated by opening /dev/null for any which are not already
open.

Reviewed by:	alfred, phk
MFC after:	2 days

Revision 1.161: download - view: text, markup, annotated - select for diffs
Fri Apr 5 01:57:45 2002 UTC (9 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +7 -1 lines
Increase the size of the register stack storage on ia64 from 32K to 2MB so
that we can compile gcc.  This is a hack because it adds a fixed 2MB to
each process's VSIZE regardless of how much is really being used since
there is no grow-up stack support.  At least it isn't physical memory.
Sigh.

Add a sysctl to enable tweaking it for new processes.

Revision 1.160: download - view: text, markup, annotated - select for diffs
Mon Apr 1 21:30:48 2002 UTC (9 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +1 -1 lines
Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sun Mar 31 00:05:30 2002 UTC (9 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +7 -6 lines
Add a local proc *p in exec_new_vmspace() to avoid repeated dereferencing
to obtain it.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Wed Mar 27 21:36:18 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +2 -6 lines
Make the reference counting of 'struct pargs' SMP safe.

There is still some locations where the PROC lock should be held
in order to prevent inconsistent views from outside (like the
proc->p_fd fix for kern/vfs_syscalls.c:checkdirs()) that can be
fixed later.

Submitted by: Jonathan Mini <mini@haikugeek.com>

Revision 1.157: download - view: text, markup, annotated - select for diffs
Tue Mar 26 19:20:04 2002 UTC (9 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +1 -3 lines
Remove an unnecessary and inconsistently used variable from exec_new_vmspace().

Revision 1.156: download - view: text, markup, annotated - select for diffs
Tue Mar 19 21:24:06 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +2 -2 lines
Remove __P.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Sun Mar 17 00:56:40 2002 UTC (9 years, 10 months ago) by jake
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +2 -2 lines
Convert all pmap_kenter/pmap_kremove pairs in MI code to use pmap_qenter/
pmap_qremove.  pmap_kenter is not safe to use in MI code because it is not
guaranteed to flush the mapping from the tlb on all cpus.  If the process
in question is preempted and migrates cpus between the call to pmap_kenter
and pmap_kremove, the original cpu will be left with stale mappings in its
tlb.  This is currently not a problem for i386 because we do not use PG_G on
SMP, and thus all mappings are flushed from the tlb on context switches, not
just user mappings.  This is not the case on all architectures, and if PG_G
is to be used with SMP on i386 it will be a problem.  This was committed by
peter earlier as part of his fine grained tlb shootdown work for i386, which
was backed out for other reasons.

Reviewed by:	peter

Revision 1.154: download - view: text, markup, annotated - select for diffs
Wed Feb 27 20:57:57 2002 UTC (9 years, 11 months ago) by imp
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +0 -1 lines
Remove now unused struct proc *p.

Approved by: jhb

Revision 1.153: download - view: text, markup, annotated - select for diffs
Wed Feb 27 18:32:12 2002 UTC (9 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +7 -9 lines
Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Wed Feb 27 09:51:33 2002 UTC (9 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +2 -2 lines
Back out all the pmap related stuff I've touched over the last few days.
There is some unresolved badness that has been eluding me, particularly
affecting uniprocessor kernels.  Turning off PG_G helped (which is a bad
sign) but didn't solve it entirely.  Userland programs still crashed.

Revision 1.151: download - view: text, markup, annotated - select for diffs
Wed Feb 27 02:14:56 2002 UTC (9 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +2 -2 lines
Jake further reduced IPI shootdowns on sparc64 in loops by using ranged
shootdowns in a couple of key places.  Do the same for i386.  This also
hides some physical addresses from higher levels and has it use the
generic vm_page_t's instead.  This will help for PAE down the road.

Obtained from:	jake (MI code, suggestions for MD part)

Revision 1.150: download - view: text, markup, annotated - select for diffs
Thu Feb 7 20:58:44 2002 UTC (10 years ago) by julian
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +1 -1 lines
Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,

Revision 1.107.2.5.2.2: download - view: text, markup, annotated - select for diffs
Wed Jan 23 23:05:54 2002 UTC (10 years ago) by nectar
Branches: RELENG_4_3
Diff to: previous 1.107.2.5.2.1: preferred, colored; branchpoint 1.107.2.5: preferred, colored; next MAIN 1.107.2.6: preferred, colored
Changes since revision 1.107.2.5.2.1: +17 -4 lines
Eliminate ptrace/exec race.

MFC 1.191 src/sys/sys/proc.h
MFC 1.44  src/sys/kern/kern_exec.c (execve)
   Add P_INEXEC flag to indicate that a process is currently exec'ing.

sys/kern/sys_process.c (ptrace)
sys/miscfs/procfs/...
   Do not allow debugging of a process during exec.

Revision 1.107.2.8.2.1: download - view: text, markup, annotated - select for diffs
Wed Jan 23 23:05:00 2002 UTC (10 years ago) by nectar
Branches: RELENG_4_4
Diff to: previous 1.107.2.8: preferred, colored
Changes since revision 1.107.2.8: +17 -4 lines
Eliminate ptrace/exec race.

MFC 1.191 src/sys/sys/proc.h
MFC 1.44  src/sys/kern/kern_exec.c (execve)
   Add P_INEXEC flag to indicate that a process is currently exec'ing.

sys/kern/sys_process.c (ptrace)
sys/miscfs/procfs/...
   Do not allow debugging of a process during exec.

Revision 1.107.2.13: download - view: text, markup, annotated - select for diffs
Tue Jan 22 17:22:59 2002 UTC (10 years ago) by nectar
Branches: RELENG_4
CVS tags: RELENG_4_5_BP, RELENG_4_5_0_RELEASE
Branch point for: RELENG_4_5
Diff to: previous 1.107.2.12: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.12: +16 -3 lines
Eliminate ptrace/exec race.

MFC 1.191 src/sys/sys/proc.h
MFC 1.44  src/sys/kern/kern_exec.c (execve)
   Add P_INEXEC flag to indicate that a process is currently exec'ing.

sys/kern/sys_process.c (ptrace)
sys/miscfs/procfs/...
   Do not allow debugging of a process during exec.

Submitted by:	tegge
Approved by:	re

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sun Jan 13 19:36:35 2002 UTC (10 years ago) by alc
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +7 -4 lines
 o Call the functions registered with at_exec() from exec_new_vmspace()
   instead of execve().  Otherwise, the possibility still exists
   for a pending AIO to modify the new address space.

Reviewed by:	alfred

Revision 1.148: download - view: text, markup, annotated - select for diffs
Sun Jan 13 11:57:59 2002 UTC (10 years ago) by alfred
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +4 -1 lines
SMP Lock struct file, filedesc and the global file list.

Seigo Tanimura (tanimura) posted the initial delta.

I've polished it quite a bit reducing the need for locking and
adapting it for KSE.

Locks:

1 mutex in each filedesc
   protects all the fields.
   protects "struct file" initialization, while a struct file
     is being changed from &badfileops -> &pipeops or something
     the filedesc should be locked.

1 mutex in each struct file
   protects the refcount fields.
   doesn't protect anything else.
   the flags used for garbage collection have been moved to
     f_gcflag which was the FILLER short, this doesn't need
     locking because the garbage collection is a single threaded
     container.
  could likely be made to use a pool mutex.

1 sx lock for the global filelist.

struct file *	fhold(struct file *fp);
        /* increments reference count on a file */

struct file *	fhold_locked(struct file *fp);
        /* like fhold but expects file to locked */

struct file *	ffind_hold(struct thread *, int fd);
        /* finds the struct file in thread, adds one reference and
                returns it unlocked */

struct file *	ffind_lock(struct thread *, int fd);
        /* ffind_hold, but returns file locked */

I still have to smp-safe the fget cruft, I'll get to that asap.

Revision 1.107.2.12: download - view: text, markup, annotated - select for diffs
Tue Jan 8 04:13:21 2002 UTC (10 years, 1 month ago) by alc
Branches: RELENG_4
Diff to: previous 1.107.2.11: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.11: +6 -0 lines
MFC
 Call aio_proc_rundown() from exec_new_vmspace() to prevent a pending AIO
 from modifying the new address space.  (This is the one-line version
 of the patch that is a part of Revision 1.147.)

Reviewed by:	tegge
Approved by:	re

Revision 1.147: download - view: text, markup, annotated - select for diffs
Sat Dec 29 07:13:44 2001 UTC (10 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +58 -0 lines
Make AIO a loadable module.

Remove the explicit call to aio_proc_rundown() from exit1(), instead AIO
will use at_exit(9).

Add functions at_exec(9), rm_at_exec(9) which function nearly the
same as at_exec(9) and rm_at_exec(9), these functions are called
on behalf of modules at the time of execve(2) after the image
activator has run.

Use a modified version of tegge's suggestion via at_exec(9) to close
an exploitable race in AIO.

Fix SYSCALL_MODULE_HELPER such that it's archetecuterally neutral,
the problem was that one had to pass it a paramater indicating the
number of arguments which were actually the number of "int".  Fix
it by using an inline version of the AS macro against the syscall
arguments.  (AS should be available globally but we'll get to that
later.)

Add a primative system for dynamically adding kqueue ops, it's really
not as sophisticated as it should be, but I'll discuss with jlemon when
he's around.

Revision 1.146: download - view: text, markup, annotated - select for diffs
Mon Dec 10 05:40:12 2001 UTC (10 years, 2 months ago) by obrien
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +1 -1 lines
Repeat after me -- "Use of ANSI string concatenation can be bad."
In this case, C99's __func__ is properly defined as:

	static const char __func__[] = "function-name";

and GCC 3.1 will not allow it to be used in bogus string concatenation.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Thu Nov 8 00:24:48 2001 UTC (10 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +1 -1 lines
For what its worth, sync up the type of ps_arg_cache_max (unsigned long)
with the sysctl type (signed long).

Revision 1.107.2.11: download - view: text, markup, annotated - select for diffs
Sat Nov 3 01:41:08 2001 UTC (10 years, 3 months ago) by ps
Branches: RELENG_4
Diff to: previous 1.107.2.10: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.10: +5 -5 lines
MFC:
- Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader
  tunable.
- Change TUNABLE_*_FETCH to have a return value of 0 if the variable
  was not found or successfully converted and true otherwise.
- Use vm_offset_t instead of caddr_t to fix a warning and remove
  two casts in kern_exec.c.

Revision 1.144: download - view: text, markup, annotated - select for diffs
Sat Oct 27 11:11:25 2001 UTC (10 years, 3 months ago) by des
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +25 -15 lines
Add a P_INEXEC flag that indicates that the process has called execve() and
it has not yet returned.  Use this flag to deny debugging requests while
the process is execve()ing, and close once and for all any race conditions
that might occur between execve() and various debugging interfaces.

Reviewed by:	jhb, rwatson

Revision 1.107.2.10: download - view: text, markup, annotated - select for diffs
Wed Oct 24 19:14:51 2001 UTC (10 years, 3 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.107.2.9: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.9: +7 -3 lines
MFC ktrace race fixes for vnode ref count panic.

Revision 1.143: download - view: text, markup, annotated - select for diffs
Wed Oct 24 14:15:28 2001 UTC (10 years, 3 months ago) by robert
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +3 -3 lines
Use vm_offset_t instead of caddr_t to fix a warning and remove
two casts.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Wed Oct 24 01:05:38 2001 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +8 -4 lines
Fix ktrace enablement/disablement races that can result in a vnode
ref count panic.

Bug noticed by:	ps
Reviewed by:	ps
MFC after:	1 day

Revision 1.107.2.9: download - view: text, markup, annotated - select for diffs
Mon Oct 15 13:40:26 2001 UTC (10 years, 3 months ago) by dd
Branches: RELENG_4
Diff to: previous 1.107.2.8: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.8: +3 -3 lines
MFC 1.135: correct spelling error in comment and remove trailing
newline from panic() message.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Wed Oct 10 23:06:53 2001 UTC (10 years, 4 months ago) by ps
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +6 -6 lines
Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader
tunable.

Reviewed by:	peter
MFC after:	2 weeks

Revision 1.140: download - view: text, markup, annotated - select for diffs
Wed Oct 10 20:04:57 2001 UTC (10 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +5 -5 lines
Move setregs() out from under the PROC_LOCK so that it can use functions
list suword() which may trap.

Revision 1.139: download - view: text, markup, annotated - select for diffs
Tue Oct 9 17:25:30 2001 UTC (10 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +2 -2 lines
proces -> process in a comment.

Revision 1.138: download - view: text, markup, annotated - select for diffs
Wed Sep 12 08:37:43 2001 UTC (10 years, 5 months ago) by julian
Branches: MAIN
CVS tags: KSE_MILESTONE_2
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +25 -20 lines
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha

Revision 1.137: download - view: text, markup, annotated - select for diffs
Sat Sep 1 03:04:31 2001 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +11 -6 lines
Pushdown Giant for acct(), kqueue(), kevent(), execve(), fork(),
vfork(), rfork(), jail().

Revision 1.136: download - view: text, markup, annotated - select for diffs
Wed Aug 22 19:12:24 2001 UTC (10 years, 5 months ago) by alex
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +2 -2 lines
Fix a simple typo I just happened to find.

Revision 1.93.2.6: download - view: text, markup, annotated - select for diffs
Wed Jul 11 23:04:37 2001 UTC (10 years, 7 months ago) by dd
Branches: RELENG_3
Diff to: previous 1.93.2.5: preferred, colored; branchpoint 1.93: preferred, colored; next MAIN 1.94: preferred, colored
Changes since revision 1.93.2.5: +24 -2 lines
MFC 1.134, 1.135: don't share sig handlers after an exec.

Approved by:	kris

Revision 1.135: download - view: text, markup, annotated - select for diffs
Wed Jul 11 02:04:43 2001 UTC (10 years, 7 months ago) by dd
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +3 -3 lines
Correct spelling in a comment and remove trailing newline from a
panic() call (panic() adds it itself).

Revision 1.107.2.5.2.1: download - view: text, markup, annotated - select for diffs
Tue Jul 10 08:18:03 2001 UTC (10 years, 7 months ago) by imp
Branches: RELENG_4_3
Diff to: previous 1.107.2.5: preferred, colored
Changes since revision 1.107.2.5: +26 -3 lines
MFS: don't share shared signal handlers accross the exec

Revision 1.107.2.8: download - view: text, markup, annotated - select for diffs
Mon Jul 9 19:03:13 2001 UTC (10 years, 7 months ago) by guido
Branches: RELENG_4
CVS tags: RELENG_4_4_BP, RELENG_4_4_0_RELEASE
Branch point for: RELENG_4_4
Diff to: previous 1.107.2.7: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.7: +26 -3 lines
MFC: do not share sigs after an exec

Revision 1.134: download - view: text, markup, annotated - select for diffs
Mon Jul 9 19:01:42 2001 UTC (10 years, 7 months ago) by guido
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +24 -2 lines
Don't share sig handlers after an exec

Reviewed by:	Alfred Perlstein

Revision 1.133: download - view: text, markup, annotated - select for diffs
Wed Jul 4 16:20:12 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +5 -7 lines
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Wed Jun 20 23:10:06 2001 UTC (10 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +12 -10 lines
Fix some lock order reversals where we called free() while holding a proc
lock.  We now use temporary variables to save the process argument pointer
and just update the pointer while holding the lock.  We then perform the
free on the cached pointer after releasing the lock.

Revision 1.47.2.15: download - view: text, markup, annotated - select for diffs
Sat Jun 16 23:43:32 2001 UTC (10 years, 7 months ago) by peter
Branches: RELENG_2_2
Diff to: previous 1.47.2.14: preferred, colored; branchpoint 1.47: preferred, colored; next MAIN 1.48: preferred, colored
Changes since revision 1.47.2.14: +4 -3 lines
For what its worth:
MFC: rev 1.131: set P_SUGID before releasing ptrace and block opportunities

Revision 1.93.2.5: download - view: text, markup, annotated - select for diffs
Sat Jun 16 23:41:58 2001 UTC (10 years, 7 months ago) by peter
Branches: RELENG_3
Diff to: previous 1.93.2.4: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.4: +4 -3 lines
MFC: rev 1.131: set P_SUGID before releasing ptrace and block opportunities

Revision 1.107.2.7: download - view: text, markup, annotated - select for diffs
Sat Jun 16 23:39:08 2001 UTC (10 years, 7 months ago) by peter
Branches: RELENG_4
Diff to: previous 1.107.2.6: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.6: +4 -3 lines
MFC: rev 1.131: set P_SUGID before releasing ptrace and block opportunities

Revision 1.131: download - view: text, markup, annotated - select for diffs
Sat Jun 16 23:34:23 2001 UTC (10 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +4 -3 lines
Move setugid() a little sooner to before we release tracing in case
crdup() or change_e*id() block on malloc() or mutex.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Sat May 26 19:59:44 2001 UTC (10 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +9 -8 lines
o pcred-removal changes included modifications to optimize the setting of
  the saved uid and gid during execve().  Unfortunately, the optimizations
  were incorrect in the case where the credential was updated, skipping
  the setting of the saved uid and gid when new credentials were generated.
  This change corrects that problem by handling the newcred!=NULL case
  correctly.

Reported/tested by:	David Malone <dwmalone@maths.tcd.ie>

Obtained from:	TrustedBSD Project

Revision 1.129: download - view: text, markup, annotated - select for diffs
Fri May 25 16:59:06 2001 UTC (10 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +47 -11 lines
o Merge contents of struct pcred into struct ucred.  Specifically, add the
  real uid, saved uid, real gid, and saved gid to ucred, as well as the
  pcred->pc_uidinfo, which was associated with the real uid, only rename
  it to cr_ruidinfo so as not to conflict with cr_uidinfo, which
  corresponds to the effective uid.
o Remove p_cred from struct proc; add p_ucred to struct proc, replacing
  original macro that pointed.
  p->p_ucred to p->p_cred->pc_ucred.
o Universally update code so that it makes use of ucred instead of pcred,
  p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo,
  cr_{r,sv}{u,g}id instead of p_*, etc.
o Remove pcred0 and its initialization from init_main.c; initialize
  cr_ruidinfo there.
o Restruction many credential modification chunks to always crdup while
  we figure out locking and optimizations; generally speaking, this
  means moving to a structure like this:
        newcred = crdup(oldcred);
        ...
        p->p_ucred = newcred;
        crfree(oldcred);
  It's not race-free, but better than nothing.  There are also races
  in sys_process.c, all inter-process authorization, fork, exec, and
  exit.
o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid;
  remove comments indicating that the old arrangement was a problem.
o Restructure exec1() a little to use newcred/oldcred arrangement, and
  use improved uid management primitives.
o Clean up exit1() so as to do less work in credential cleanup due to
  pcred removal.
o Clean up fork1() so as to do less work in credential cleanup and
  allocation.
o Clean up ktrcanset() to take into account changes, and move to using
  suser_xxx() instead of performing a direct uid==0 comparision.
o Improve commenting in various kern_prot.c credential modification
  calls to better document current behavior.  In a couple of places,
  current behavior is a little questionable and we need to check
  POSIX.1 to make sure it's "right".  More commenting work still
  remains to be done.
o Update credential management calls, such as crfree(), to take into
  account new ruidinfo reference.
o Modify or add the following uid and gid helper routines:
      change_euid()
      change_egid()
      change_ruid()
      change_rgid()
      change_svuid()
      change_svgid()
  In each case, the call now acts on a credential not a process, and as
  such no longer requires more complicated process locking/etc.  They
  now assume the caller will do any necessary allocation of an
  exclusive credential reference.  Each is commented to document its
  reference requirements.
o CANSIGIO() is simplified to require only credentials, not processes
  and pcreds.
o Remove lots of (p_pcred==NULL) checks.
o Add an XXX to authorization code in nfs_lock.c, since it's
  questionable, and needs to be considered carefully.
o Simplify posix4 authorization code to require only credentials, not
  processes and pcreds.  Note that this authorization, as well as
  CANSIGIO(), needs to be updated to use the p_cansignal() and
  p_cansched() centralized authorization routines, as they currently
  do not take into account some desirable restrictions that are handled
  by the centralized routines, as well as being inconsistent with other
  similar authorization instances.
o Update libkvm to take these changes into account.

Obtained from:	TrustedBSD Project
Reviewed by:	green, bde, jhb, freebsd-arch, freebsd-audit

Revision 1.128: download - view: text, markup, annotated - select for diffs
Mon May 21 18:30:50 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +2 -5 lines
Axe unneeded spl()'s.

Revision 1.127: download - view: text, markup, annotated - select for diffs
Sat May 19 01:28:02 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +8 -1 lines
Introduce a global lock for the vm subsystem (vm_mtx).

vm_mtx does not recurse and is required for most low level
vm operations.

faults can not be taken without holding Giant.

Memory subsystems can now call the base page allocators safely.

Almost all atomic ops were removed as they are covered under the
vm mutex.

Alpha and ia64 now need to catch up to i386's trap handlers.

FFS and NFS have been tested, other filesystems will need minor
changes (grabbing the vm lock when twiddling page properties).

Reviewed (partially) by: jake, jhb

Revision 1.107.2.6: download - view: text, markup, annotated - select for diffs
Fri May 18 09:58:41 2001 UTC (10 years, 8 months ago) by bp
Branches: RELENG_4
Diff to: previous 1.107.2.5: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.5: +2 -2 lines
MFC: introduce VOP_CREATEVOBJECT(), VOP_GETVOBJECT and VOP_DESTROYVOBJECT()
which help to get proper reference to VM backing object.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Tue May 1 08:12:56 2001 UTC (10 years, 9 months ago) by markm
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +3 -3 lines
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)

Revision 1.125: download - view: text, markup, annotated - select for diffs
Sun Apr 29 02:44:48 2001 UTC (10 years, 9 months ago) by grog
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +1 -3 lines
Revert consequences of changes to mount.h, part 2.

Requested by:	bde

Revision 1.124: download - view: text, markup, annotated - select for diffs
Mon Apr 23 08:50:34 2001 UTC (10 years, 9 months ago) by grog
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +3 -1 lines
Correct #includes to work with fixed sys/mount.h.

Revision 1.123: download - view: text, markup, annotated - select for diffs
Wed Mar 7 03:27:32 2001 UTC (10 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +10 -4 lines
Proc locking.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Tue Feb 6 11:20:36 2001 UTC (11 years ago) by asmodai
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +2 -2 lines
Fix typo: seperate -> separate.

Seperate does not exist in the english language.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Sat Dec 23 19:43:09 2000 UTC (11 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +3 -1 lines
Protect proc.p_pptr and proc.p_children/p_sibling with the
proctree_lock.

linprocfs not locked pending response from informal maintainer.

Reviewed by:	jhb, -smp@

Revision 1.120: download - view: text, markup, annotated - select for diffs
Thu Nov 30 21:06:05 2000 UTC (11 years, 2 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +2 -1 lines
o Add a comment to exec_check_permissions() to indicate that the
  passed vnode must be locked; this is the case because of calls
  to VOP_GETATTR(), VOP_ACCESS(), and VOP_OPEN().  This becomes
  more of an issue when VOP_ACCESS() gets a bit more complicated,
  which it does when you introduce ACL, Capability, and MAC
  support.

Obtained from:	TrustedBSD Project

Revision 1.119: download - view: text, markup, annotated - select for diffs
Fri Oct 20 07:58:02 2000 UTC (11 years, 3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +2 -2 lines
Catch up to moving headers:
- machine/ipl.h -> sys/ipl.h
- machine/mutex.h -> sys/mutex.h

Revision 1.118: download - view: text, markup, annotated - select for diffs
Thu Oct 12 14:24:03 2000 UTC (11 years, 4 months ago) by dfr
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +17 -1 lines
Add a gross hack for ia64 to allocate the backing store for a new program.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Tue Sep 26 05:09:21 2000 UTC (11 years, 4 months ago) by takawata
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +23 -15 lines
Make size of dynamic loader argument variable to support
various executable file format.

Reviewed by:	peter

Revision 1.107.2.5: download - view: text, markup, annotated - select for diffs
Thu Sep 21 09:06:43 2000 UTC (11 years, 4 months ago) by truckman
Branches: RELENG_4
CVS tags: RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_2_0_RELEASE, RELENG_4_1_1_RELEASE
Branch point for: RELENG_4_3
Diff to: previous 1.107.2.4: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.4: +1 -2 lines
MFC:	1.116
Remove an unneeded #include.

Found by:	phk

Revision 1.116: download - view: text, markup, annotated - select for diffs
Thu Sep 21 09:04:17 2000 UTC (11 years, 4 months ago) by truckman
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +1 -2 lines
Remove unneeded #include that was a remnant of an earlier version of
my uidinfo patch.

Found by:	phk

Revision 1.115: download - view: text, markup, annotated - select for diffs
Sun Sep 17 12:20:49 2000 UTC (11 years, 4 months ago) by bde
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +2 -1 lines
Added used include of <sys/mutex.h> (don't depend on pollution in
<sys/signalvar.h>).

Revision 1.114: download - view: text, markup, annotated - select for diffs
Tue Sep 12 09:49:05 2000 UTC (11 years, 5 months ago) by bp
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +2 -2 lines
Add three new VOPs: VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT and VOP_GETVOBJECT.
They will be used by nullfs and other stacked filesystems to support full
cache coherency.

Reviewed in general by:	mckusick, dillon

Revision 1.107.2.4: download - view: text, markup, annotated - select for diffs
Thu Sep 7 19:13:36 2000 UTC (11 years, 5 months ago) by truckman
Branches: RELENG_4
Diff to: previous 1.107.2.3: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.3: +3 -2 lines
MFC:

Remove hash table lookups and maintenance from chgproccnt() and chgsbsize()
and chase pointers stored in pcred and ucred instead for better performance
and to avoid these operations in interrupt context which could possibly
cause panics.

Because the pcred and ucred structures changed size, libkvm and friends
will need to be rebuilt.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Tue Sep 5 22:10:22 2000 UTC (11 years, 5 months ago) by truckman
Branches: MAIN
CVS tags: PRE_SMPNG
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +3 -2 lines
Remove uidinfo hash table lookup and maintenance out of chgproccnt() and
chgsbsize(), which are called rather frequently and may be called from an
interrupt context in the case of chgsbsize().  Instead, do the hash table
lookup and maintenance when credentials are changed, which is a lot less
frequent.  Add pointers to the uidinfo structures to the ucred and pcred
structures for fast access.  Pass a pointer to the credential to chgproccnt()
and chgsbsize() instead of passing the uid.  Add a reference count to the
uidinfo structure and use it to decide when to free the structure rather
than freeing the structure when the resource consumption drops to zero.
Move the resource tracking code from kern_proc.c to kern_resource.c.  Move
some duplicate code sequences in kern_prot.c to separate helper functions.
Change KASSERTs in this code to unconditional tests and calls to panic().

Revision 1.107.2.3: download - view: text, markup, annotated - select for diffs
Wed Jul 19 06:23:56 2000 UTC (11 years, 6 months ago) by kbyanc
Branches: RELENG_4
CVS tags: RELENG_4_1_0_RELEASE
Diff to: previous 1.107.2.2: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.2: +9 -7 lines
MFC: merge in various cosmetic cleanups:
	Add unsigned sysctl types; change certain existing sysctl oids to
	utilize the new types. Teach sysctl(8) about these types.

	Convert SYSCTL_LONG to accept a val parameter like all of the other
	SYSCTL_XXX macros.

	Add support to sysctl(8) for arrays of longs.

	Make sysctl(8) display dev_t's the same way as ls(1).

Revision 1.112: download - view: text, markup, annotated - select for diffs
Wed Jul 5 07:46:40 2000 UTC (11 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +9 -7 lines
Support for unsigned integer and long sysctl variables.  Update the
SYSCTL_LONG macro to be consistent with other integer sysctl variables
and require an initial value instead of assuming 0.  Update several
sysctl variables to use the unsigned types.

PR:		15251
Submitted by:	Kelly Yancey <kbyanc@posi.net>

Revision 1.107.2.2: download - view: text, markup, annotated - select for diffs
Tue May 9 17:41:23 2000 UTC (11 years, 9 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.107.2.1: preferred, colored; branchpoint 1.107: preferred, colored
Changes since revision 1.107.2.1: +38 -29 lines
    MFC i386/linux/imgact_linux.c 1.36 and friends - fix #! script exec
    under linux emulation to look for script binary in /compat/linux first.

Revision 1.107.2.1: download - view: text, markup, annotated - select for diffs
Fri May 5 03:49:54 2000 UTC (11 years, 9 months ago) by jlemon
Branches: RELENG_4
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +6 -3 lines
MFC: kqueue() and kevent()

Revision 1.111: download - view: text, markup, annotated - select for diffs
Sun Apr 30 18:51:41 2000 UTC (11 years, 9 months ago) by phk
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +1 -2 lines
Remove unneeded #include <vm/vm_zone.h>

Generated by:	src/tools/tools/kerninclude

Revision 1.110: download - view: text, markup, annotated - select for diffs
Wed Apr 26 20:58:39 2000 UTC (11 years, 9 months ago) by dillon
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +38 -29 lines
    Fix #! script exec under linux emulation.  If a script is exec'd from a
    program running under linux emulation, the script binary is checked for
    in /compat/linux first.  Without this patch the wrong script binary
    (i.e. the FreeBSD binary) will be run instead of the linux binary.
    For example, #!/bin/sh, thus breaking out of linux compatibility mode.

    This solves a number of problems people have had installing linux
    software on FreeBSD boxes.

Revision 1.109: download - view: text, markup, annotated - select for diffs
Tue Apr 18 15:15:18 2000 UTC (11 years, 9 months ago) by phk
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +1 -2 lines
Remove unneeded <sys/buf.h> includes.

Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sun Apr 16 18:53:09 2000 UTC (11 years, 9 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +6 -1 lines
Introduce kqueue() and kevent(), a kernel event notification facility.

Revision 1.47.2.14: download - view: text, markup, annotated - select for diffs
Tue Jan 25 18:09:09 2000 UTC (12 years ago) by dillon
Branches: RELENG_2_2
Diff to: previous 1.47.2.13: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.13: +2 -1 lines
    MFC kern/kern_descrip.c 1.78, kern/kern_exec.c 1.107, and
    sys/filedesc.h 1.19.  Backport fix for procfs security hole in 2.2.x.

Tested by: Michael Oswell <oswell@xcert.com>, Jeremy Chadwick <jdc@best.net>

Revision 1.93.2.4: download - view: text, markup, annotated - select for diffs
Thu Jan 20 22:01:56 2000 UTC (12 years ago) by imp
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE
Diff to: previous 1.93.2.3: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.3: +2 -1 lines
Backport procfs special case code.

Revision 1.107: download - view: text, markup, annotated - select for diffs
Thu Jan 20 07:12:52 2000 UTC (12 years ago) by imp
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_0_0_RELEASE
Branch point for: RELENG_4
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +2 -1 lines
When we are execing a setugid program, and we have a procfs filesystem
file open in one of the special file descriptors (0, 1, or 2), close
it before completing the exec.

Submitted by: nergal@idea.avet.com.pl
Constructive comments: deraadt@openbsd.org, sef, peter, jkh

Revision 1.106: download - view: text, markup, annotated - select for diffs
Mon Dec 27 10:42:55 1999 UTC (12 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +6 -6 lines
Changed the type used to represent the user stack pointer from `long *'
to `register_t *'.  This fixes bugs like misplacement of argc and argv
on the user stack on i386's with 64-bit longs.  We still use longs to
represent "words" like argc and argv, and assume that they are on the
stack (and that there is stack).  The suword() and fuword() families
should also use register_t.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Wed Dec 15 23:01:54 1999 UTC (12 years, 1 month ago) by eivind
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +4 -4 lines
Introduce NDFREE (and remove VOP_ABORTOP)

Revision 1.104: download - view: text, markup, annotated - select for diffs
Fri Nov 26 08:27:10 1999 UTC (12 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +4 -1 lines
Add a sysctl to control if argv is disclosed to the world:
	kern.ps_argsopen
It defaults to 1 which means that all users can see all argvs in ps(1).

Reviewed by:	Warner

Revision 1.103: download - view: text, markup, annotated - select for diffs
Tue Nov 16 20:31:51 1999 UTC (12 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +24 -1 lines
Introduce commandline caching in the kernel.

This fixes some nasty procfs problems for SMP, makes ps(1) run much faster,
and makes ps(1) even less dependent on /proc which will aid chroot and
jails alike.

To disable this facility and revert to previous behaviour:
        sysctl -w kern.ps_arg_cache_limit=0

For full details see the current@FreeBSD.org mail-archives.

Revision 1.102: download - view: text, markup, annotated - select for diffs
Fri Oct 29 18:08:50 1999 UTC (12 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +1 -2 lines
useracc() the prequel:

Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>.  This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.

This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.

Revision 1.21.4.9: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:32:07 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.8: preferred, colored; branchpoint 1.21: preferred, colored; next MAIN 1.22: preferred, colored
Changes since revision 1.21.4.8: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.47.2.13: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:14:52 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_2
Diff to: previous 1.47.2.12: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.12: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.93.2.3: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:25:58 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
CVS tags: RELENG_3_4_0_RELEASE, RELENG_3_3_0_RELEASE
Diff to: previous 1.93.2.2: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.2: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.101: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:46:12 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.93.2.2: download - view: text, markup, annotated - select for diffs
Sun Aug 22 08:19:57 1999 UTC (12 years, 5 months ago) by imp
Branches: RELENG_3
Diff to: previous 1.93.2.1: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.1: +4 -1 lines
MFC: stop profiling on exec

Revision 1.100: download - view: text, markup, annotated - select for diffs
Wed Aug 11 20:35:38 1999 UTC (12 years, 6 months ago) by imp
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +4 -1 lines
Stop profiling on exec.

Obtained from: NetBSD

Revision 1.99: download - view: text, markup, annotated - select for diffs
Tue Apr 27 11:15:55 1999 UTC (12 years, 9 months ago) by phk
Branches: MAIN
CVS tags: PRE_VFS_BIO_NFS_PATCH, PRE_SMP_VMSHARE, POST_VFS_BIO_NFS_PATCH, POST_SMP_VMSHARE
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +2 -2 lines
Suser() simplification:

1:
  s/suser/suser_xxx/

2:
  Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
  s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Mon Apr 19 14:14:09 1999 UTC (12 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +1 -18 lines
unifdef -DVM_STACK - it's been on for a while for x86 and was checked
and appeared to be working for the Alpha some time ago.

Revision 1.93.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 14 04:55:23 1999 UTC (12 years, 10 months ago) by jdp
Branches: RELENG_3
CVS tags: RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +5 -3 lines
MFC (3 April 1999): Enable BSD/OS binaries to run in configurations
that have a large kernel virtual address space.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:20:01 1999 UTC (12 years, 10 months ago) by jdp
Branches: MAIN
CVS tags: PRE_NEWBUS, POST_NEWBUS
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +5 -3 lines
Restore support for executing BSD/OS binaries on the i386 by passing
the address of the ps_strings structure to the process via %ebx.
For other kinds of binaries, %ebx is still zeroed as before.

Submitted by:	Thomas Stephens <tas@stephens.org>
Reviewed by:	jdp

Revision 1.96: download - view: text, markup, annotated - select for diffs
Fri Feb 19 14:25:34 1999 UTC (12 years, 11 months ago) by luoqi
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +2 -2 lines
Hide access to vmspace:vm_pmap with inline function vmspace_pmap(). This
is the preparation step for moving pmap storage out of vmspace proper.

Reviewed by:	Alan Cox	<alc@cs.rice.edu>
		Matthew Dillion	<dillon@apollo.backplane.com>

Revision 1.95: download - view: text, markup, annotated - select for diffs
Thu Jan 28 00:57:47 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +3 -3 lines
    Fix warnings in preparation for adding -Wall -Wcast-qual to the
    kernel compile

Revision 1.94: download - view: text, markup, annotated - select for diffs
Wed Jan 27 21:49:55 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +2 -2 lines
        Fix warnings in preparation for adding -Wall -Wcast-qual to the
        kernel compile

Revision 1.93: download - view: text, markup, annotated - select for diffs
Wed Jan 6 23:05:38 1999 UTC (13 years, 1 month ago) by julian
Branches: MAIN
CVS tags: RELENG_3_BP, RELENG_3_1_0_RELEASE
Branch point for: RELENG_3
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +19 -1 lines
Add (but don't activate) code for a special VM option to make
downward growing stacks more general.
Add (but don't activate) code to use the new stack facility
when running threads, (specifically the linux threads support).
This allows people to use both linux compiled linuxthreads, and also the
native FreeBSD linux-threads port.

The code is conditional on VM_STACK. Not using this will
produce the old heavily tested system.

Submitted by: Richard Seaman <dick@tar.com>

Revision 1.92: download - view: text, markup, annotated - select for diffs
Wed Dec 30 10:38:59 1998 UTC (13 years, 1 month ago) by dfr
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +6 -5 lines
Various changes to support OSF1 emulation:

* Move the user stack from VM_MAXUSER_ADDRESS to a place below the 32bit
  boundary (needed to support 32bit OSF programs).  This should also save
  one pagetable per process.
* Add cvtqlsv to the set of instructions handled by the floating point
  software completion code.
* Disable all floating point exceptions by default.
* A minor change to execve to allow the OSF1 image activator to support
  dynamic loading.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Sun Dec 27 18:03:29 1998 UTC (13 years, 1 month ago) by dfr
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +6 -3 lines
Fix some 64bit truncation problems which crept into SYSCTL_LONG() with the
last cleanup.  Since the oid_arg2 field of struct sysctl_oid is not wide
enough to hold a long, the SYSCTL_LONG() macro has been modified to only
support exporting long variables by pointer instead of by value.

Reviewed by: bde

Revision 1.90: download - view: text, markup, annotated - select for diffs
Wed Dec 16 16:28:57 1998 UTC (13 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +3 -4 lines
Removed the cast to a pointer in the definition of PS_STRINGS and
adjusted related casts to match (only in the kernel in this commit).
The pointer was only wanted in one place in kern_exec.c.  Applications
should use the kern.ps_strings sysctl instead of PS_STRINGS, so they
shouldn't notice this change.

Revision 1.89: download - view: text, markup, annotated - select for diffs
Wed Dec 16 16:06:27 1998 UTC (13 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +4 -5 lines
Removed all traces of SYSCTL_INTPTR().  Pointers can't really be passed
across the kernel -> application interface, and for the one sysctl where
they were passed and actually used (kern.ps_strings), the applications
want addresses represented as u_longs anyway (the other sysctl that
passed them, kern.usrstack, has never been used).

Agreed to by:	dfr, phk

Revision 1.88: download - view: text, markup, annotated - select for diffs
Wed Oct 28 13:36:58 1998 UTC (13 years, 3 months ago) by dg
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +2 -2 lines
Added a second argument, "activate" to the vm_page_unwire() call so that
the caller can select either inactive or active queue to put the page on.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Fri Oct 16 03:55:00 1998 UTC (13 years, 3 months ago) by peter
Branches: MAIN
CVS tags: RELENG_3_0_0_RELEASE
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +66 -5 lines
*gulp*.  Jordan specifically OK'ed this..

This is the bulk of the support for doing kld modules.  Two linker_sets
were replaced by SYSINIT()'s.  VFS's and exec handlers are self registered.
kld is now a superset of lkm.  I have converted most of them, they will
follow as a seperate commit as samples.
This all still works as a static a.out kernel using LKM's.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Fri Sep 4 08:06:55 1998 UTC (13 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +3 -3 lines
Cosmetic changes to the PAGE_XXX macros to make them consistent with
the other objects in vm.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Mon Aug 24 08:39:38 1998 UTC (13 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +4 -9 lines
Change various syscalls to use size_t arguments instead of u_int.

Add some overflow checks to read/write (from bde).

Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags
and vm_object::paging_in_progress to use operations which are not
interruptable.

Reviewed by: Bruce Evans <bde@zeta.org.au>

Revision 1.84: download - view: text, markup, annotated - select for diffs
Wed Jul 15 06:19:33 1998 UTC (13 years, 6 months ago) by bde
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +9 -9 lines
Cast between longs and pointers via intptr_t.  The results of fuword()
should be checked before casting.  The results of suword() should be
checked.

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sun Jun 7 17:11:33 1998 UTC (13 years, 8 months ago) by dfr
Branches: MAIN
CVS tags: PRE_NOBDEV
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +16 -13 lines
This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Fri Apr 17 22:36:50 1998 UTC (13 years, 9 months ago) by des
Branches: MAIN
CVS tags: PRE_DEVFS_SLICE, POST_DEVFS_SLICE
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +2 -2 lines
Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Sun Mar 8 06:21:33 1998 UTC (13 years, 11 months ago) by dyson
Branches: MAIN
CVS tags: PRE_SOFTUPDATE, POST_SOFTUPDATE
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +2 -2 lines
Free the first page also if it is not valid.

Revision 1.80: download - view: text, markup, annotated - select for diffs
Sat Mar 7 21:35:17 1998 UTC (13 years, 11 months ago) by dyson
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +2 -3 lines
This mega-commit is meant to fix numerous interrelated problems.  There
has been some bitrot and incorrect assumptions in the vfs_bio code.  These
problems have manifest themselves worse on NFS type filesystems, but can
still affect local filesystems under certain circumstances.  Most of
the problems have involved mmap consistancy, and as a side-effect broke
the vfs.ioopt code.  This code might have been committed seperately, but
almost everything is interrelated.

1)	Allow (pmap_object_init_pt) prefaulting of buffer-busy pages that
	are fully valid.
2)	Rather than deactivating erroneously read initial (header) pages in
	kern_exec, we now free them.
3)	Fix the rundown of non-VMIO buffers that are in an inconsistent
	(missing vp) state.
4)	Fix the disassociation of pages from buffers in brelse.  The previous
	code had rotted and was faulty in a couple of important circumstances.
5)	Remove a gratuitious buffer wakeup in vfs_vmio_release.
6)	Remove a crufty and currently unused cluster mechanism for VBLK
	files in vfs_bio_awrite.  When the code is functional, I'll add back
	a cleaner version.
7)	The page busy count wakeups assocated with the buffer cache usage were
	incorrectly cleaned up in a previous commit by me.  Revert to the
	original, correct version, but with a cleaner implementation.
8)	The cluster read code now tries to keep data associated with buffers
	more aggressively (without breaking the heuristics) when it is presumed
	that the read data (buffers) will be soon needed.
9)	Change to filesystem lockmgr locks so that they use LK_NOPAUSE.  The
	delay loop waiting is not useful for filesystem locks, due to the
	length of the time intervals.
10)	Correct and clean-up spec_getpages.
11)	Implement a fully functional nfs_getpages, nfs_putpages.
12)	Fix nfs_write so that modifications are coherent with the NFS data on
	the server disk (at least as well as NFS seems to allow.)
13)	Properly support MS_INVALIDATE on NFS.
14)	Properly pass down MS_INVALIDATE to lower levels of the VM code from
	vm_map_clean.
15)	Better support the notion of pages being busy but valid, so that
	fewer in-transit waits occur.  (use p->busy more for pageouts instead
	of PG_BUSY.)  Since the page is fully valid, it is still usable for
	reads.
16)	It is possible (in error) for cached pages to be busy.  Make the
	page allocation code handle that case correctly.  (It should probably
	be a printf or panic, but I want the system to handle coding errors
	robustly.  I'll probably add a printf.)
17)	Correct the design and usage of vm_page_sleep.  It didn't handle
	consistancy problems very well, so make the design a little less
	lofty.  After vm_page_sleep, if it ever blocked, it is still important
	to relookup the page (if the object generation count changed), and
	verify it's status (always.)
18)	In vm_pageout.c, vm_pageout_clean had rotted, so clean that up.
19)	Push the page busy for writes and VM_PROT_READ into vm_pageout_flush.
20)	Fix vm_pager_put_pages and it's descendents to support an int flag
	instead of a boolean, so that we can pass down the invalidate bit.

Revision 1.47.2.12: download - view: text, markup, annotated - select for diffs
Mon Mar 2 08:54:56 1998 UTC (13 years, 11 months ago) by jkh
Branches: RELENG_2_2
CVS tags: RELENG_2_2_8_RELEASE, RELENG_2_2_7_RELEASE, RELENG_2_2_6_RELEASE
Diff to: previous 1.47.2.11: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.11: +6 -2 lines
Yikes, I thought I committed this already.  More support for CODA
filesystems - does nothing if you don't have CFS defined.

Approved by:	davidg

Revision 1.79: download - view: text, markup, annotated - select for diffs
Mon Mar 2 05:47:55 1998 UTC (13 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +2 -7 lines
Update the ELF image activator to use some of the exec resources rather
than rolling it's own.  This means that it now uses the "safe"
exec_map_first_page() to get the ld.so headers rather than risking a panic
on a page fault failure (eg: NFS server goes down).
Since all the ELF tools go to a lot of trouble to make sure everything
lives in the first page for executables, this is a win.  I have not seen
any ELF executable on any system where all the headers didn't fit in the
first page with lots of room to spare.
I have been running variations of this code for some time on my pure ELF
systems.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Wed Feb 25 13:08:06 1998 UTC (13 years, 11 months ago) by bde
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +1 -3 lines
Removed unused #includes.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Fri Feb 6 12:13:23 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +1 -3 lines
Back out DIAGNOSTIC changes.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Thu Feb 5 03:32:04 1998 UTC (14 years ago) by dyson
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +34 -28 lines
1)	Start using a cleaner and more consistant page allocator instead
	of the various ad-hoc schemes.
2)	When bringing in UPAGES, the pmap code needs to do another vm_page_lookup.
3)	When appropriate, set the PG_A or PG_M bits a-priori to both avoid some
	processor errata, and to minimize redundant processor updating of page
	tables.
4)	Modify pmap_protect so that it can only remove permissions (as it
	originally supported.)  The additional capability is not needed.
5)	Streamline read-only to read-write page mappings.
6)	For pmap_copy_page, don't enable write mapping for source page.
7)	Correct and clean-up pmap_incore.
8)	Cluster initial kern_exec pagin.
9)	Removal of some minor lint from kern_malloc.
10)	Correct some ioopt code.
11)	Remove some dead code from the MI swapout routine.
12)	Correct vm_object_deallocate (to remove backing_object ref.)
13)	Fix dead object handling, that had problems under heavy memory load.
14)	Add minor vm_page_lookup improvements.
15)	Some pages are not in objects, and make sure that the vm_page.c can
	properly support such pages.
16)	Add some more page deficit handling.
17)	Some minor code readability improvements.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Wed Feb 4 22:32:31 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +3 -1 lines
Turn DIAGNOSTIC into a new-style option.

Revision 1.74: download - view: text, markup, annotated - select for diffs
Sun Jan 11 21:35:38 1998 UTC (14 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +94 -62 lines
Implement the first page access for object type determination more
VM clean.  Also, use vm_map_insert instead of vm_mmap.
Reviewed by:	dg@freebsd.org

Revision 1.73: download - view: text, markup, annotated - select for diffs
Tue Jan 6 05:15:34 1998 UTC (14 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +4 -3 lines
Make our v_usecount vnode reference count work identically to the
original BSD code.  The association between the vnode and the vm_object
no longer includes reference counts.  The major difference is that
vm_object's are no longer freed gratuitiously from the vnode, and so
once an object is created for the vnode, it will last as long as the
vnode does.

When a vnode object reference count is incremented, then the underlying
vnode reference count is incremented also.  The two "objects" are now
more intimately related, and so the interactions are now much less
complex.

When vnodes are now normally placed onto the free queue with an object still
attached.  The rundown of the object happens at vnode rundown time, and
happens with exactly the same filesystem semantics of the original VFS
code.  There is absolutely no need for vnode_pager_uncache and other
travesties like that anymore.

A side-effect of these changes is that SMP locking should be much simpler,
the I/O copyin/copyout optimizations work, NFS should be more ponderable,
and further work on layered filesystems should be less frustrating, because
of the totally coherent management of the vnode objects and vnodes.

Please be careful with your system while running this code, but I would
greatly appreciate feedback as soon a reasonably possible.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Sat Dec 27 02:56:21 1997 UTC (14 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +2 -1 lines
Unspammed nested include of <vm/vm_zone.h>.

Revision 1.71: download - view: text, markup, annotated - select for diffs
Sat Dec 20 03:05:45 1997 UTC (14 years, 1 month ago) by sef
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +2 -2 lines
Clear the p_stops field on change of user/group id, unless the correct
flag is set in the p_pfsflags field.  This, essentially, prevents an SUID
proram from hanging after being traced.  (E.g., "truss /usr/bin/rlogin" would
fail, but leave rlogin in a stopevent state.)  Yet another case where procctl
is (hopefully ;)) no longer needed in the general case.

Reviewed by:	bde (thanks bruce :))

Revision 1.47.2.11: download - view: text, markup, annotated - select for diffs
Tue Dec 16 15:47:03 1997 UTC (14 years, 1 month ago) by davidg
Branches: RELENG_2_2
Diff to: previous 1.47.2.10: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.10: +3 -4 lines
Brought in fix from rev 1.70: don't accidently free() struct buf's.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Tue Dec 16 15:40:29 1997 UTC (14 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +3 -4 lines
Fix bug where a struct buf was free()'d back to the system malloc pool.
Quite amazing that the system runs at all with this bug. Also present in
2.2.5. The bug appears to have come in with changes in rev 1.53.

PR:		might fix PR#5313
Submitted by:	bde

Revision 1.69: download - view: text, markup, annotated - select for diffs
Sat Dec 6 04:11:09 1997 UTC (14 years, 2 months ago) by sef
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +4 -1 lines
Changes to allow event-based process monitoring and control.

Revision 1.47.2.10: download - view: text, markup, annotated - select for diffs
Tue Dec 2 09:57:20 1997 UTC (14 years, 2 months ago) by danny
Branches: RELENG_2_2
Diff to: previous 1.47.2.9: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.9: +24 -14 lines
Submitted by:	bde
Merge Bruce's fix for PR bin/5172 from HEAD

Revision 1.68: download - view: text, markup, annotated - select for diffs
Thu Nov 6 19:29:08 1997 UTC (14 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +2 -3 lines
Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.

Revision 1.47.2.9: download - view: text, markup, annotated - select for diffs
Sun Oct 26 20:39:44 1997 UTC (14 years, 3 months ago) by guido
Branches: RELENG_2_2
Diff to: previous 1.47.2.8: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.8: +4 -3 lines
MFC: On execing a sgid program, do not set P_SUGID when  cr_gid and cr)_uid
do not change.
Reviewed by:	 4755

Revision 1.67: download - view: text, markup, annotated - select for diffs
Wed Oct 15 18:28:34 1997 UTC (14 years, 3 months ago) by guido
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +4 -3 lines
On execing a sgid program, do not set P_SUGID when  cr_gid and cr)_uid
do not change.
PR:		4755
Reviewed by:	Bruce Evans

Revision 1.66: download - view: text, markup, annotated - select for diffs
Sun Sep 21 04:22:50 1997 UTC (14 years, 4 months ago) by dyson
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +4 -4 lines
Change the M_NAMEI allocations to use the zone allocator.  This change
plus the previous changes to use the zone allocator decrease the useage
of malloc by half.  The Zone allocator will be upgradeable to be able
to use per CPU-pools, and has more intelligent usage of SPLs.  Additionally,
it has reasonable stats gathering capabilities, while making most calls
inline.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Tue Sep 2 20:05:38 1997 UTC (14 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +1 -4 lines
Removed unused #includes.

Revision 1.47.2.8: download - view: text, markup, annotated - select for diffs
Mon Aug 4 05:40:37 1997 UTC (14 years, 6 months ago) by davidg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_5_RELEASE
Diff to: previous 1.47.2.7: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.7: +18 -10 lines
Brought in fix from rev 1.64: fix for rfork security hole.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Mon Aug 4 05:39:24 1997 UTC (14 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +18 -10 lines
Fixed security hole with sharing the file descriptor table (via rfork)
when execing a setuid/setgid binary. Code submitted by Sean Eric Fagan
(sef@freebsd.org).
Also consolidated the setuid/setgid checks into one place.
Reviewed by:	dyson,sef

Revision 1.63: download - view: text, markup, annotated - select for diffs
Wed Apr 23 22:07:05 1997 UTC (14 years, 9 months ago) by ache
Branches: MAIN
CVS tags: pre_smp_merge, post_smp_merge, WOLLMAN_MBUF, BP_WOLLMAN_MBUF
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +24 -14 lines
Don't clobber user space argv0 memory on shell exec, mainly for vfork()
Fix another bug: if argv[0] is NULL, garbadge args might be added for
shell script
Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> (with yet one fault detect from me)

Revision 1.62: download - view: text, markup, annotated - select for diffs
Fri Apr 18 02:43:05 1997 UTC (14 years, 9 months ago) by davidg
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +14 -3 lines
Brought fix from the 2.2 branch forward (see rev 1.47.2.7): serious bugs
with reading the image header.

Revision 1.47.2.7: download - view: text, markup, annotated - select for diffs
Fri Apr 18 02:37:08 1997 UTC (14 years, 9 months ago) by davidg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_2_RELEASE
Diff to: previous 1.47.2.6: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.6: +14 -7 lines
Fixed two bugs that came into kern_exec just after the 2.2.1 release:

1) I wasn't assuring that the file size was large enough for the data
   to be contained in a FS block. Calling bread for a block when the
   data is in a fragment causes BAD things to happen, including file
   corruption.
2) I was not passing in a residual pointer to vn_rdwr(), and this
   caused "slow" mode image header reads that were less than the
   page size to fail with EIO. I now get the residual and properly
   zero the tail of the image header buffer, too.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Sun Apr 13 03:05:31 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +3 -13 lines
Correct the previous thread-fix commit.  I made a clerical error.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sun Apr 13 01:48:23 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +3 -1 lines
Fully implement vfork.  Vfork is now much much faster than even our
	fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)

Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
	from the other threads of a group.

Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
	possible existing shares with other threads/processes.

Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
	thread from the rest of the group.

Fix the case where a thread does an exec.  It is almost nonsense for a thread
	to modify the other threads address space by an exec, so we
	now automatically divorce the address space before modifying it.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sat Apr 12 04:07:50 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +7 -3 lines
Effectively remove the previous commit to fix threads forking.  The
change was a false-start, and needs more work.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Fri Apr 11 23:37:23 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +24 -7 lines
Allow a kernel-supported process thread to do an exec without blasting
away the VM space of all of the other, associated threads.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Fri Apr 4 09:06:20 1997 UTC (14 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +1 -5 lines
Killed unnecessary vp == NULL check after namei.

Revision 1.21.4.8: download - view: text, markup, annotated - select for diffs
Fri Apr 4 07:43:44 1997 UTC (14 years, 10 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.7: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.7: +4 -3 lines
From -current: be sure not to free cn buffer twice.

Revision 1.47.2.6: download - view: text, markup, annotated - select for diffs
Fri Apr 4 07:30:44 1997 UTC (14 years, 10 months ago) by davidg
Branches: RELENG_2_2
Diff to: previous 1.47.2.5: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.5: +4 -3 lines
From -current (1.56): free cn buffer only once.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Fri Apr 4 07:30:06 1997 UTC (14 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -3 lines
Oops, only free component name buffer if namei() didn't. This bug has
been in here since I wrote the code 3 years ago! Thanks, Bruce!

Submitted by:	bde

Revision 1.47.2.5: download - view: text, markup, annotated - select for diffs
Fri Apr 4 04:18:20 1997 UTC (14 years, 10 months ago) by davidg
Branches: RELENG_2_2
Diff to: previous 1.47.2.4: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.4: +21 -22 lines
Merged from -current: Bruce's fixes.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Fri Apr 4 04:17:11 1997 UTC (14 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +21 -22 lines
Various fixes:

1. imgp->image_header needs to be cleared for the bp == NULL && `goto
   interpret' case, else exec_fail_dealloc would free it twice after
   an error.

2. Moved the vp->v_writecount check in exec_check_permissions() to
   near the end.  This fixes execve("/dev/null", ...) returning the
   bogus errno ETXTBSY.  ETXTBSY is still returned for attempts to
   exec interpreted files that are open for writing.  The man page
   is very old and wrong here.  It says that ETXTBSY is for pure
   procedure (shared text) files that are open for writing or reading.

3. Moved the setuid disabling in exec_check_permissions() to the end.
   Cosmetic.  It's more natural to dispose of all the error cases
   first.

...plus a couple of other cosmetic changes.

Submitted by:	bde

Revision 1.47.2.4: download - view: text, markup, annotated - select for diffs
Fri Apr 4 01:32:09 1997 UTC (14 years, 10 months ago) by davidg
Branches: RELENG_2_2
Diff to: previous 1.47.2.3: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.3: +4 -2 lines
Sort of from -current: lose the vnode lock on a permissions failure.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Fri Apr 4 01:30:33 1997 UTC (14 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +4 -2 lines
Lose the vnode lock on a permissions failure.

Submitted by:	Tor Egge <Tor.Egge@idi.ntnu.no>

Revision 1.47.2.3: download - view: text, markup, annotated - select for diffs
Thu Apr 3 06:37:42 1997 UTC (14 years, 10 months ago) by davidg
Branches: RELENG_2_2
Diff to: previous 1.47.2.2: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.2: +38 -29 lines
Merged from -current: Killed exech_map and do image header reads in a FS-
centric way instead of VM-centric. This appears to fix a hang that Peter
was seeing as well as allowing detection of errors during the header
read (important for NFS).

Revision 1.53: download - view: text, markup, annotated - select for diffs
Mon Mar 31 11:10:55 1997 UTC (14 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +38 -29 lines
Changed the way that the exec image header is read to be filesystem-
centric rather than VM-centric to fix a problem with errors not being
detectable when the header is read.
Killed exech_map as a result of these changes.
There appears to be no performance difference with this change.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:39:04 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.21.4.7: download - view: text, markup, annotated - select for diffs
Wed Feb 19 17:58:29 1997 UTC (14 years, 11 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_7_RELEASE
Diff to: previous 1.21.4.6: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.6: +4 -2 lines
Brought in fix from rev 1.51: don't clear P_SUGID if various {u,g}id don't
match.

Revision 1.47.2.2: download - view: text, markup, annotated - select for diffs
Wed Feb 19 03:53:35 1997 UTC (14 years, 11 months ago) by davidg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_1_RELEASE, RELENG_2_2_0_RELEASE
Diff to: previous 1.47.2.1: preferred, colored; branchpoint 1.47: preferred, colored
Changes since revision 1.47.2.1: +4 -2 lines
Brought in change from rev 1.51: preserve P_SUGID if {u,g}gid != r{u,g}id
Note that this doesn't actually fix any known security holes, it just
protects against sloppy programming.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Wed Feb 19 03:51:34 1997 UTC (14 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +3 -1 lines
Fix from PR #2757:

execve() clears the P_SUGID process flag in execve() if the binary
executed does not have suid or sgid permission bits set.

This also happens when the effective uid is different from the real
uid or the effective gid is different from the real gid. Under
these circumstances, the process still has set id privileges and
the P_SUGID flag should not be cleared.

Submitted by:	Tor Egge <Tor.Egge@idt.ntnu.no>

Revision 1.50: download - view: text, markup, annotated - select for diffs
Mon Feb 10 02:09:21 1997 UTC (15 years ago) by dyson
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +2 -2 lines
This is the kernel Lite/2 commit.  There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>

Revision 1.49: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:43:19 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.47.2.1: download - view: text, markup, annotated - select for diffs
Sat Nov 9 10:42:28 1996 UTC (15 years, 3 months ago) by joerg
Branches: RELENG_2_2
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +2 -2 lines
Merge the fix from rev 1.48: fix an ordering bug.

Requested by:	dyson

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sat Nov 9 03:54:25 1996 UTC (15 years, 3 months ago) by dyson
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +2 -2 lines
Fix an ordering bug -- pmap_remove_pages should be called BEFORE
vm_map_remove, not after...

2.2-RELEASE candidate.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Sat Oct 12 21:35:19 1996 UTC (15 years, 4 months ago) by dyson
Branches: MAIN
CVS tags: RELENG_2_2_BP
Branch point for: RELENG_2_2
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +2 -1 lines
Performance optimizations.  One of which was meant to go in before the
previous snap.  Specifically, kern_exit and kern_exec now makes a
call into the pmap module to do a very fast removal of pages from the
address space.  Additionally, the pmap module now updates the PG_MAPPED
and PG_WRITABLE flags.  This is an optional optimization, but helpful
on the X86.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Tue Jul 30 03:08:34 1996 UTC (15 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +2 -2 lines
Backed out the recent changes/enhancements to the VM code.  The
problem with the 'shell scripts' was found, but there was a 'strange'
problem found with a 486 laptop that we could not find.  This commit
backs the code back to 25-jul, and will be re-entered after the snapshot
in smaller (more easily tested) chunks.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sat Jul 27 03:23:41 1996 UTC (15 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +2 -2 lines
This commit is meant to solve a couple of VM system problems or
performance issues.

	1) The pmap module has had too many inlines, and so the
	   object file is simply bigger than it needs to be.
	   Some common code is also merged into subroutines.
	2) Removal of some *evil* PHYS_TO_VM_PAGE macro calls.
	   Unfortunately, a few have needed to be added also.
	   The removal caused the need for more vm_page_lookups.
	   I added lookup hints to minimize the need for the
	   page table lookup operations.
	3) Removal of some bogus performance improvements, that
	   mostly made the code more complex (tracking individual
	   page table page updates unnecessarily).  Those improvements
	   actually hurt 386 processors perf (not that people who
	   worry about perf use 386 processors anymore :-)).
	4) Changed pv queue manipulations/structures to be TAILQ's.
	5) The pv queue code has had some performance problems since
	   day one.  Some significant scalability issues are resolved
	   by threading the pv entries from the pmap AND the physical
	   address instead of just the physical address.  This makes
	   certain pmap operations run much faster.  This does
	   not affect most micro-benchmarks, but should help loaded system
	   performance *significantly*.  DG helped and came up with most
	   of the solution for this one.
	6) Most if not all pmap bit operations follow the pattern:
		pmap_test_bit();
		pmap_clear_bit();
	   That made for twice the necessary pv list traversal.   The
	   pmap interface now supports only pmap_tc_bit type operations:
	   pmap_[test/clear]_modified, pmap_[test/clear]_referenced.
	   Additionally, the modified routine now takes a vm_page_t arg
	   instead of a phys address.  This eliminates a PHYS_TO_VM_PAGE
	   operation.
	7) Several rewrites of routines that contain redundant code to
	   use common routines, so that there is a greater likelihood of
	   keeping the cache footprint smaller.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Fri Jul 12 04:11:37 1996 UTC (15 years, 7 months ago) by bde
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
Don't use NULL in non-pointer contexts.

Revision 1.21.4.6: download - view: text, markup, annotated - select for diffs
Tue Jun 4 02:11:37 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_6_RELEASE, RELENG_2_1_6_1_RELEASE, RELENG_2_1_5_RELEASE
Diff to: previous 1.21.4.5: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.5: +104 -112 lines
Brought in (most) of the changes in revs 1.24, 1.25 and 1.43: Fix for
set-id ktrace bug, some cosmetic changes (brought in to make the merge of
other fixes possible), and use kmem_alloc_wait/kmem_free_wakeup to
eliminate a transient string space allocation failure due to running out
of map space.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Mon Jun 3 04:12:18 1996 UTC (15 years, 8 months ago) by davidg
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +5 -5 lines
Use kmem_alloc_wait/kmem_free_wakeup() to avoid allocation failures
from running out of string space in the exec_map.

Revision 1.21.4.5: download - view: text, markup, annotated - select for diffs
Mon Jun 3 04:09:36 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.4: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.4: +2 -2 lines
Fix declaration of ps_strings.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Mon Jun 3 04:07:35 1996 UTC (15 years, 8 months ago) by davidg
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +2 -2 lines
Fix declaration of ps_strings.

Revision 1.21.4.4: download - view: text, markup, annotated - select for diffs
Fri May 31 08:04:07 1996 UTC (15 years, 8 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.3: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.3: +7 -1 lines
Add sysctl hooks for user-mode setproctitle() and libkvm to see,
taken from -current, but implemented in old-style sysctl.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat May 18 03:37:01 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +5 -5 lines
This set of commits to the VM system does the following, and contain
contributions or ideas from Stephen McKay <syssgm@devetir.qld.gov.au>,
Alan Cox <alc@cs.rice.edu>, David Greenman <davidg@freebsd.org> and me:

	More usage of the TAILQ macros.  Additional minor fix to queue.h.
	Performance enhancements to the pageout daemon.
		Addition of a wait in the case that the pageout daemon
		has to run immediately.
		Slightly modify the pageout algorithm.
	Significant revamp of the pmap/fork code:
		1) PTE's and UPAGES's are NO LONGER in the process's map.
		2) PTE's and UPAGES's reside in their own objects.
		3) TOTAL elimination of recursive page table pagefaults.
		4) The page directory now resides in the PTE object.
		5) Implemented pmap_copy, thereby speeding up fork time.
		6) Changed the pv entries so that the head is a pointer
		   and not an entire entry.
		7) Significant cleanup of pmap_protect, and pmap_remove.
		8) Removed significant amounts of machine dependent
		   fork code from vm_glue.  Pushed much of that code into
		   the machine dependent pmap module.
		9) Support more completely the reuse of already zeroed
		   pages (Page table pages and page directories) as being
		   already zeroed.
	Performance and code cleanups in vm_map:
		1) Improved and simplified allocation of map entries.
		2) Improved vm_map_copy code.
		3) Corrected some minor problems in the simplify code.
	Implemented splvm (combo of splbio and splimp.)  The VM code now
		seldom uses splhigh.
	Improved the speed of and simplified kmem_malloc.
	Minor mod to vm_fault to avoid using pre-zeroed pages in the case
		of objects with backing objects along with the already
		existant condition of having a vnode.  (If there is a backing
		object, there will likely be a COW...  With a COW, it isn't
		necessary to start with a pre-zeroed page.)
	Minor reorg of source to perhaps improve locality of ref.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Wed May 1 02:42:47 1996 UTC (15 years, 9 months ago) by bde
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +4 -1 lines
Removed unnecessary #includes from <sys/imgact.h> so that it is
self-sufficient and added explicit #includes where required.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Mon Apr 29 15:07:59 1996 UTC (15 years, 9 months ago) by smpatel
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +2 -2 lines
Fixed two typos in the comment.

Pointed out by:	davidg

Revision 1.21.4.3: download - view: text, markup, annotated - select for diffs
Mon Apr 8 01:28:09 1996 UTC (15 years, 10 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.2: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.2: +1 -6 lines
From current: updates to my copyright.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Mon Apr 8 01:21:59 1996 UTC (15 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +1 -6 lines
Killed sections 3 and 4 of my copyright as I don't agree with it (I believe
it to be unnecessarily restrictive). For tty_subr.c, update to my standard
copyright.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Mar 10 08:42:54 1996 UTC (15 years, 11 months ago) by sos
Branches: MAIN
CVS tags: wollman_polling
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +19 -4 lines
First attempt at FreeBSD & Linux ELF support.

Compile and link a new kernel, that will give native ELF support, and
provide the hooks for other ELF interpreters as well.

To make native ELF binaries use John Polstras elf-kit-1.0.1..
For the time being also use his ld-elf.so.1 and put it in
/usr/libexec.

The Linux emulator has been enhanced to also run ELF binaries, it
is however in its very first incarnation.
Just get some Linux ELF libs (Slackware-3.0) and put them in the
prober place (/compat/linux/...).
I've ben able to run all the Slackware-3.0 binaries I've tried
so far.
(No it won't run quake yet :)

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Mar 2 19:38:08 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +12 -2 lines
Mega-commit for Linux emulator update..  This has been stress tested under
netscape-2.0 for Linux running all the Java stuff.  The scrollbars are now
working, at least on my machine. (whew! :-)

I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.

The main changes:

COMPAT_LINUX is *GONE*.  Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself.  The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code.  All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first.  Like IBCS2, you can statically compile it in with "options LINUX".

A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality().  The Linux-ELF libraries want
to use some of these.

linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.

Quite a few bugs removed, including incorrect arguments being used in
syscalls..  eg:  mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.

The build for the code has changed.  i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.

Supporting changes elsewhere in the kernel:

The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS).  This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.

The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only.  This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.

makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code.  It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)

At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area.  This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sat Feb 24 14:32:52 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +12 -1 lines
Add two sysctl variables that can be read by libutil and libkvm so that
they can adapt to simple kernel VM layout changes.

Revision 1.21.4.2: download - view: text, markup, annotated - select for diffs
Thu Feb 22 19:20:47 1996 UTC (15 years, 11 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.21.4.1: preferred, colored; branchpoint 1.21: preferred, colored
Changes since revision 1.21.4.1: +6 -4 lines
Bring my BSD/OS 2.x executable support from -current over..

Note that the user-mode parts of this will follow shortly.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Sat Jan 20 21:36:30 1996 UTC (16 years ago) by bde
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +1 -3 lines
Removed stale #includes of "opt_sysvipc.h".

Revision 1.33: download - view: text, markup, annotated - select for diffs
Fri Jan 19 03:58:01 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +2 -2 lines
Eliminated many redundant vm_map_lookup operations for vm_mmap.
Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish
	overhead for merged cache.
Efficiency improvement for vfs_cluster.  It used to do alot of redundant
	calls to cluster_rbuild.
Correct the ordering for vrele of .text and release of credentials.
Use the selective tlb update for 486/586/P6.
Numerous fixes to the size of objects allocated for files.  Additionally,
	fixes in the various pagers.
Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs.
Fixes in the swap pager for exhausted resources.  The pageout code
	will not as readily thrash.
Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into
	page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE),
	thereby improving efficiency of several routines.
Eliminate even more unnecessary vm_page_protect operations.
Significantly speed up process forks.
Make vm_object_page_clean more efficient, thereby eliminating the pause
	that happens every 30seconds.
Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the
	case of filesystems mounted async.
Fix a panic with busy pages when write clustering is done for non-VMIO
	buffers.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Mon Jan 8 04:30:41 1996 UTC (16 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +1 -3 lines
(gulp!) reran makesyscalls..

sysv_ipc.c: add stub functions that either simply return (for the hooks
in kern_fork/kern_exit) or log() a messgae and call enosys() (for the
syscalls).  sysv_ipc.c will become "standard" in conf/files and has
#ifs for all the permutations.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Jan 4 20:28:45 1996 UTC (16 years, 1 month ago) by wollman
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +3 -1 lines
Convert SYSV IPC to new-style options.  (I hope I got everything...)
The LKMs will need an extra file, to come later.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Thu Dec 14 08:31:20 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +4 -3 lines
A Major staticize sweep.  Generates a couple of warnings that I'll deal
with later.
A number of unused vars removed.
A number of unused procs removed or #ifdefed.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sat Dec 9 04:29:11 1995 UTC (16 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +6 -4 lines
Reorganise ps_strings in order to gain BSD/OS 2.0 binary compatability.
This is now in line with NetBSD as well..

Note that once this series of commits is finished, you must recompile
libkvm, then ps and maybe 'w'.  If you are running the recently imported
sendmail-8.7, you should recompile that too (src/conf.c at least).

Revision 1.28: download - view: text, markup, annotated - select for diffs
Thu Dec 7 12:46:40 1995 UTC (16 years, 2 months ago) by davidg
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +7 -1 lines
Untangled the vm.h include file spaghetti.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Mon Nov 13 10:45:22 1995 UTC (16 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +7 -19 lines
Use kmem_alloc_pageable/kmem_free to allocate memory instead of individual
VM map functions.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Nov 12 06:42:53 1995 UTC (16 years, 3 months ago) by bde
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +4 -1 lines
Included <sys/sysproto.h> to get central declarations for syscall args
structs and prototypes for syscalls.

Ifdefed duplicated decentralized declarations of args structs.  It's
convenient to have this visible but they are hard to maintain.  Some
are already different from the central declarations.  4.4lite2 puts
them in comments in the function headers but I wanted to avoid the
large changes for that.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Mon Nov 6 12:52:32 1995 UTC (16 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +107 -103 lines
All:
   Changed vnodep -> vp for consistency with the rest of the kernel, and
changed iparams -> imgp for brevity.

kern_exec.c:
   Explicitly initialized some additional parts of the image_params struct
to avoid bzeroing it. Rewrote the set-id code to reduce the number of
logical tests. The rewrite exposed a mostly benign bug in the algorithm:
traced set-id images would get ktracing disabled even if the set-id didn't
happen for other reasons.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sat Oct 21 08:38:11 1995 UTC (16 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -2 lines
Killed a few gratuitous #include's.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sun Oct 8 00:06:01 1995 UTC (16 years, 4 months ago) by swallace
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +7 -1 lines
Remove prototype definitions from <sys/systm.h>.
Prototypes are located in <sys/sysproto.h>.

Add appropriate #include <sys/sysproto.h> to files that needed
protos from systm.h.

Add structure definitions to appropriate files that relied on sys/systm.h,
right before system call definition, as in the rest of the kernel source.

In kern_prot.c, instead of using the dummy structure "args", create
individual dummy structures named <syscall>_args.  This makes
life easier for prototype generation.

Revision 1.21.4.1: download - view: text, markup, annotated - select for diffs
Thu Aug 31 10:00:43 1995 UTC (16 years, 5 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_0_RELEASE
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +1 -4 lines
Brought in changes from main branch: fix for "text file busy" bug.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Thu Aug 24 10:32:37 1995 UTC (16 years, 5 months ago) by davidg
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +1 -4 lines
Moved setting of VTEXT flag into the appropriate image activators. This
fixes a bug where linux binaries would get the flag set inappropriately.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Tue May 30 08:05:24 1995 UTC (16 years, 8 months ago) by rgrimes
Branches: MAIN
CVS tags: RELENG_2_1_0_BP, RELENG_2_0_5_RELEASE, RELENG_2_0_5_BP, RELENG_2_0_5
Branch point for: RELENG_2_1_0
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +6 -6 lines
Remove trailing whitespace.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sat Mar 25 01:34:21 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
CVS tags: RELENG_2_0_5_ALPHA
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +3 -3 lines
Use 'p' rather than 'curproc' when appropriate.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sat Mar 25 01:20:38 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +5 -13 lines
Use NDINIT macro to initialize fields for namei.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Mar 19 23:27:57 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +7 -6 lines
Fixed bug introduced in the previous commit - the lock must be held until
after the call to exec_check_permissions().

Revision 1.17: download - view: text, markup, annotated - select for diffs
Sun Mar 19 23:08:12 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +11 -4 lines
Lose the lock on the vnode. Changes to implement proper locking in the
vnode pager now require this.

Submitted by:	John Dyson

Revision 1.16: download - view: text, markup, annotated - select for diffs
Thu Mar 16 18:12:30 1995 UTC (16 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +1 -2 lines
Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'.  Fix all the bugs found.  There were no serious
ones.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Fri Mar 10 08:44:20 1995 UTC (16 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +1 -4 lines
Removed some #include's of unnecessary include files.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Wed Mar 1 04:09:50 1995 UTC (16 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +23 -14 lines
No longer assume that a process's address space can be directly written to.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Mon Feb 20 22:23:11 1995 UTC (16 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +19 -19 lines
Use of vm_allocate() and vm_deallocate() has been deprecated.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Tue Feb 14 19:22:28 1995 UTC (16 years, 11 months ago) by sos
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +10 -4 lines
First attempt to run linux binaries. This is only the changes needed to
the generic kernel. The actual emulator is a separate LKM. (not finished
yet, sorry).
Submitted by:	sos@freebsd.org & sef@kithrup.com

Revision 1.11: download - view: text, markup, annotated - select for diffs
Mon Jan 9 16:04:49 1995 UTC (17 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +5 -5 lines
These changes embody the support of the fully coherent merged VM buffer cache,
much higher filesystem I/O performance, and much better paging performance. It
represents the culmination of over 6 months of R&D.

The majority of the merged VM/cache work is by John Dyson.

The following highlights the most significant changes. Additionally, there are
(mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to
support the new VM/buffer scheme.

vfs_bio.c:
Significant rewrite of most of vfs_bio to support the merged VM buffer cache
scheme.  The scheme is almost fully compatible with the old filesystem
interface.  Significant improvement in the number of opportunities for write
clustering.

vfs_cluster.c, vfs_subr.c
Upgrade and performance enhancements in vfs layer code to support merged
VM/buffer cache.  Fixup of vfs_cluster to eliminate the bogus pagemove stuff.

vm_object.c:
Yet more improvements in the collapse code.  Elimination of some windows that
can cause list corruption.

vm_pageout.c:
Fixed it, it really works better now.  Somehow in 2.0, some "enhancements"
broke the code.  This code has been reworked from the ground-up.

vm_fault.c, vm_page.c, pmap.c, vm_object.c
Support for small-block filesystems with merged VM/buffer cache scheme.

pmap.c vm_map.c
Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of
kernel PTs.

vm_glue.c
Much simpler and more effective swapping code.  No more gratuitous swapping.

proc.h
Fixed the problem that the p_lock flag was not being cleared on a fork.

swap_pager.c, vnode_pager.c
Removal of old vfs_bio cruft to support the past pseudo-coherency.  Now the
code doesn't need it anymore.

machdep.c
Changes to better support the parameter values for the merged VM/buffer cache
scheme.

machdep.c, kern_exec.c, vm_glue.c
Implemented a seperate submap for temporary exec string space and another one
to contain process upages. This eliminates all map fragmentation problems
that previously existed.

ffs_inode.c, ufs_inode.c, ufs_readwrite.c
Changes for merged VM/buffer cache.  Add "bypass" support for sneaking in on
busy buffers.

Submitted by:	John Dyson and David Greenman

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sun Oct 2 17:35:13 1994 UTC (17 years, 4 months ago) by phk
Branches: MAIN
CVS tags: RELEASE_2_0, OLAH_TTCP, BETA_2_0, ALPHA_2_0
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +4 -2 lines
All of this is cosmetic.  prototypes, #includes, printfs and so on.  Makes
GCC a lot more silent.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sun Sep 25 19:33:36 1994 UTC (17 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +10 -12 lines
While in the real world, I had a bad case of being swapped out for a lot of
cycles.  While waiting there I added a lot of the extra ()'s I have, (I have
never used LISP to any extent).  So I compiled the kernel with -Wall and
shut up a lot of "suggest you add ()'s", removed a bunch of unused var's
and added a couple of declarations here and there.  Having a lap-top is
highly recommended.  My kernel still runs, yell at me if you kernel breaks.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat Sep 24 16:58:43 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +9 -1 lines
Added support for p_textvp which stores the vnode pointer of the execed binary.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Wed Sep 14 05:52:13 1994 UTC (17 years, 5 months ago) by davidg
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -1 lines
Added missing #ifdef SYSVSHM.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Tue Sep 13 14:46:50 1994 UTC (17 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +3 -1 lines
Added SYSV ipcs.

Obtained from: NetBSD and FreeBSD-1.1.5

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Aug 24 10:53:53 1994 UTC (17 years, 5 months ago) by davidg
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +16 -8 lines
Pay attention to *all* errors from copyinstr(). This patch fixes a bug
that causes a no-panic instant reboot when bogus argv/envvs are fed to
execve().

Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Aug 18 22:34:59 1994 UTC (17 years, 5 months ago) by wollman
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +4 -3 lines
Fix up some sloppy coding practices:

- Delete redundant declarations.
- Add -Wredundant-declarations to Makefile.i386 so they don't come back.
- Delete sloppy COMMON-style declarations of uninitialized data in
  header files.
- Add a few prototypes.
- Clean up warnings resulting from the above.

NB: ioconf.c will still generate a redundant-declaration warning, which
is unavoidable unless somebody volunteers to make `config' smarter.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sat Aug 6 09:06:31 1994 UTC (17 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +19 -3 lines
Implemented support for the "ps_strings" structure (grrrr...) for use in
the userland library libkvm.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed May 25 09:03:03 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +496 -31 lines
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by:	Rodney W. Grimes
Submitted by:	John Dyson and David Greenman

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Tue May 24 10:04:39 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: CSRG
CVS tags: bsd_44_lite_2, bsd_44_lite, REL_before_johndavid_2_0_0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -0 lines
BSD 4.4 Lite Kernel Sources

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue May 24 10:04:38 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Initial revision

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options