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

CVS log for src/sys/compat/freebsd32/freebsd32_misc.c

[BACK] Up to [FreeBSD] / src / sys / compat / freebsd32

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.122.2.4: download - view: text, markup, annotated - select for diffs
Sun Jan 29 08:03:45 2012 UTC (11 days, 17 hours ago) by mckusick
Branches: RELENG_9
Diff to: previous 1.122.2.3: preferred, colored; branchpoint 1.122: preferred, colored; next MAIN 1.123: preferred, colored
Changes since revision 1.122.2.3: +11 -3 lines
SVN rev 230725 on 2012-01-29 08:03:45Z by mckusick

MFC r230249:

Make sure all intermediate variables holding mount flags (mnt_flag)
and that all internal kernel calls passing mount flags are declared
as uint64_t so that flags in the top 32-bits are not lost.

MFC r230250:

There are several bugs/hangs when trying to take a snapshot on a UFS/FFS
filesystem running with journaled soft updates. Until these problems
have been tracked down, return ENOTSUPP when an attempt is made to
take a snapshot on a filesystem running with journaled soft updates.

Revision 1.130: download - view: text, markup, annotated - select for diffs
Tue Jan 17 01:08:01 2012 UTC (3 weeks, 3 days ago) by mckusick
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +11 -3 lines
SVN rev 230249 on 2012-01-17 01:08:01Z by mckusick

Make sure all intermediate variables holding mount flags (mnt_flag)
and that all internal kernel calls passing mount flags are declared
as uint64_t so that flags in the top 32-bits are not lost.

MFC after: 2 weeks

Revision 1.93.2.21: download - view: text, markup, annotated - select for diffs
Fri Jan 6 19:32:39 2012 UTC (4 weeks, 6 days ago) by jhb
Branches: RELENG_8
Diff to: previous 1.93.2.20: preferred, colored; branchpoint 1.93: preferred, colored; next MAIN 1.94: preferred, colored
Changes since revision 1.93.2.20: +11 -5 lines
SVN rev 229725 on 2012-01-06 19:32:39Z by jhb

MFC 226217,227070,227341,227502:
Add the posix_fadvise(2) system call.  It is somewhat similar to
madvise(2) except that it operates on a file descriptor instead of a
memory region.  It is currently only supported on regular files.

Note that this adds a new VOP, so all filesystem modules must be
recompiled.

Approved by:	re (kib)

Revision 1.122.2.3: download - view: text, markup, annotated - select for diffs
Fri Jan 6 19:29:16 2012 UTC (4 weeks, 6 days ago) by jhb
Branches: RELENG_9
Diff to: previous 1.122.2.2: preferred, colored; branchpoint 1.122: preferred, colored
Changes since revision 1.122.2.2: +11 -5 lines
SVN rev 229723 on 2012-01-06 19:29:16Z by jhb

MFC 227070,227341,227502:
Add the posix_fadvise(2) system call.  It is somewhat similar to
madvise(2) except that it operates on a file descriptor instead of a
memory region.  It is currently only supported on regular files.

Note that this adds a new VOP, so all filesystem modules must be
recompiled.

Approved by:	re (kib)

Revision 1.122.2.2: download - view: text, markup, annotated - select for diffs
Wed Jan 4 16:29:45 2012 UTC (5 weeks, 1 day ago) by jhb
Branches: RELENG_9
Diff to: previous 1.122.2.1: preferred, colored; branchpoint 1.122: preferred, colored
Changes since revision 1.122.2.1: +2 -2 lines
SVN rev 229500 on 2012-01-04 16:29:45Z by jhb

MFC 226364:
Use PAIR32TO64() for the offset and length parameters to
freebsd32_posix_fallocate() to properly handle big-endian platforms.

Revision 1.93.2.20: download - view: text, markup, annotated - select for diffs
Wed Nov 16 18:33:17 2011 UTC (2 months, 3 weeks ago) by jhb
Branches: RELENG_8
Diff to: previous 1.93.2.19: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.19: +12 -0 lines
SVN rev 227573 on 2011-11-16 18:33:17Z by jhb

MFC 220791,220793,220846,221836,226364:
Add the posix_fallocate(2) syscall.  The default implementation in
vop_stdallocate() is filesystem agnostic and will run as slow as a
read/write loop in userspace; however, it serves to correctly
implement the functionality for filesystems that do not implement a
VOP_ALLOCATE.

Allow VOP_ALLOCATE to be iterative, and have kern_posix_fallocate(9)
drive looping and potentially yielding.

Reviewed by:	mdf

Revision 1.129: download - view: text, markup, annotated - select for diffs
Mon Nov 14 18:00:15 2011 UTC (2 months, 3 weeks ago) by jhb
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +4 -11 lines
SVN rev 227502 on 2011-11-14 18:00:15Z by jhb

- Split out a kern_posix_fadvise() from the posix_fadvise() system call so
  it can be used by in-kernel consumers.
- Make kern_posix_fallocate() public.
- Use kern_posix_fadvise() and kern_posix_fallocate() to implement the
  freebsd32 wrappers for the two system calls.

Revision 1.122.2.1.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.122.2.1: preferred, colored; next MAIN 1.122.2.2: preferred, colored
Changes since revision 1.122.2.1: +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.128: download - view: text, markup, annotated - select for diffs
Fri Nov 4 04:02:50 2011 UTC (3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +13 -0 lines
SVN rev 227070 on 2011-11-04 04:02:50Z by jhb

Add the posix_fadvise(2) system call.  It is somewhat similar to
madvise(2) except that it operates on a file descriptor instead of a
memory region.  It is currently only supported on regular files.

Just as with madvise(2), the advice given to posix_fadvise(2) can be
divided into two types.  The first type provide hints about data access
patterns and are used in the file read and write routines to modify the
I/O flags passed down to VOP_READ() and VOP_WRITE().  These modes are
thus filesystem independent.  Note that to ease implementation (and
since this API is only advisory anyway), only a single non-normal
range is allowed per file descriptor.

The second type of hints are used to hint to the OS that data will or
will not be used.  These hints are implemented via a new VOP_ADVISE().
A default implementation is provided which does nothing for the WILLNEED
request and attempts to move any clean pages to the cache page queue for
the DONTNEED request.  This latter case required two other changes.
First, a new V_CLEANONLY flag was added to vinvalbuf().  This requests
vinvalbuf() to only flush clean buffers for the vnode from the buffer
cache and to not remove any backing pages from the vnode.  This is
used to ensure clean pages are not wired into the buffer cache before
attempting to move them to the cache page queue.  The second change adds
a new vm_object_page_cache() method.  This method is somewhat similar to
vm_object_page_remove() except that instead of freeing each page in the
specified range, it attempts to move clean pages to the cache queue if
possible.

To preserve the ABI of struct file, the f_cdevpriv pointer is now reused
in a union to point to the currently active advice region if one is
present for regular files.

Reviewed by:	jilles, kib, arch@
Approved by:	re (kib)
MFC after:	1 month

Revision 1.127: download - view: text, markup, annotated - select for diffs
Sat Oct 15 12:35:18 2011 UTC (3 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +2 -2 lines
SVN rev 226388 on 2011-10-15 12:35:18Z by kib

Control the execution permission of the readable segments for
i386 binaries on the amd64 and ia64 with the sysctl, instead of
unconditionally enabling it.

Reviewed by:	marcel

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri Oct 14 11:46:46 2011 UTC (3 months, 3 weeks ago) by jhb
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +2 -2 lines
SVN rev 226364 on 2011-10-14 11:46:46Z by jhb

Use PAIR32TO64() for the offset and length parameters to
freebsd32_posix_fallocate() to properly handle big-endian platforms.

Reviewed by:	mdf
MFC after:	1 week

Revision 1.125: download - view: text, markup, annotated - select for diffs
Thu Oct 13 22:33:03 2011 UTC (3 months, 3 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +1 -1 lines
SVN rev 226353 on 2011-10-13 22:33:03Z by marcel

Use PTRIN().

Revision 1.124: download - view: text, markup, annotated - select for diffs
Thu Oct 13 18:25:10 2011 UTC (3 months, 4 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +15 -0 lines
SVN rev 226349 on 2011-10-13 18:25:10Z by marcel

Wrap mprotect(2) so that we can add execute permissions when read
permissions are requested. This is needed on amd64 and ia64 for
JDK 1.4.x

Revision 1.123: download - view: text, markup, annotated - select for diffs
Thu Oct 13 18:18:42 2011 UTC (3 months, 4 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +5 -0 lines
SVN rev 226347 on 2011-10-13 18:18:42Z by marcel

In freebsd32_mmap() and when compiling for amd64 or ia64, also
ask for execute permissions when read permissions are wanted.
This is needed for JDK 1.4.x on i386.

Revision 1.122.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
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +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.122: 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.121: preferred, colored
Changes since revision 1.121: +19 -19 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.121: download - view: text, markup, annotated - select for diffs
Thu Jun 16 22:05:56 2011 UTC (7 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +13 -0 lines
SVN rev 223166 on 2011-06-16 22:05:56Z by kib

Implement compat32 for old lseek, for the a.out binaries on amd64.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Mon Apr 18 16:32:22 2011 UTC (9 months, 3 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +12 -0 lines
SVN rev 220791 on 2011-04-18 16:32:22Z by mdf

Add the posix_fallocate(2) syscall.  The default implementation in
vop_stdallocate() is filesystem agnostic and will run as slow as a
read/write loop in userspace; however, it serves to correctly
implement the functionality for filesystems that do not implement a
VOP_ALLOCATE.

Note that __FreeBSD_version was already bumped today to 900036 for any
ports which would like to use this function.

Also reserve space in the syscall table for posix_fadvise(2).

Reviewed by:	-arch (previous version)

Revision 1.93.2.19: download - view: text, markup, annotated - select for diffs
Wed Apr 6 11:12:05 2011 UTC (10 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.18: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.18: +27 -0 lines
SVN rev 220378 on 2011-04-06 11:12:05Z by kib

MFC r220158:
Provide compat32 shims for kldstat(2).

Revision 1.119: download - view: text, markup, annotated - select for diffs
Fri Apr 1 11:16:29 2011 UTC (10 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +97 -3 lines
SVN rev 220238 on 2011-04-01 11:16:29Z by kib

Add support for executing the FreeBSD 1/i386 a.out binaries on amd64.

In particular:
- implement compat shims for old stat(2) variants and ogetdirentries(2);
- implement delivery of signals with ancient stack frame layout and
  corresponding sigreturn(2);
- implement old getpagesize(2);
- provide a user-mode trampoline and LDT call gate for lcall $7,$0;
- port a.out image activator and connect it to the build as a module
  on amd64.

The changes are hidden under COMPAT_43.

MFC after:   1 month

Revision 1.118: download - view: text, markup, annotated - select for diffs
Wed Mar 30 14:46:12 2011 UTC (10 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +27 -0 lines
SVN rev 220158 on 2011-03-30 14:46:12Z by kib

Provide compat32 shims for kldstat(2).

Requested and tested by:	jpaetzel
MFC after:	1 week

Revision 1.93.2.18: download - view: text, markup, annotated - select for diffs
Tue Mar 1 21:51:32 2011 UTC (11 months, 1 week ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.17: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.17: +1 -1 lines
SVN rev 219155 on 2011-03-01 21:51:32Z by kib

MFC r210431:
Remove the linux_exec_copyin_args(), freebsd32_exec_copyin_args() may
serve as well. COMPAT_FREEBSD32 is a prerequisite for COMPAT_LINUX32.

MFC r210451:
Use forward declartion for enum uio_seg in imgact.h. This allows to remove
inclusion of sys/uio.h from the header.

MFC r210498:
Revert r210451, and the similar part of the r210431. The forward-declaration
for the enum tag when enum definition is not complete is not allowed by
C99, and is gcc extension.

MFC r210501:
Remove unneeded includes.

Requested by:	dchagin

Revision 1.117: 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.116: preferred, colored
Changes since revision 1.116: +5 -2 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.67.2.11.4.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.67.2.11: preferred, colored; next MAIN 1.68: preferred, colored
Changes since revision 1.67.2.11: +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.93.2.17.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.93.2.17: preferred, colored; next MAIN 1.93.2.18: preferred, colored
Changes since revision 1.93.2.17: +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.116: download - view: text, markup, annotated - select for diffs
Tue Nov 23 13:49:15 2010 UTC (14 months, 2 weeks ago) by pluknet
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +2 -1 lines
SVN rev 215747 on 2010-11-23 13:49:15Z by pluknet

Update MNT_ROOTFS comments after changes in the root mount logic.

Reported by:	arundel
Suggested by:	marcel (phrasing)
Approved by:	kib (mentor)

Revision 1.115: 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.114: preferred, colored
Changes since revision 1.114: +26 -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.93.2.17: download - view: text, markup, annotated - select for diffs
Sat Aug 14 14:13:58 2010 UTC (17 months, 3 weeks ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_2_BP
Branch point for: RELENG_8_2
Diff to: previous 1.93.2.16: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.16: +2 -1 lines
SVN rev 211302 on 2010-08-14 14:13:58Z by kib

MFC r211006:
Prefer struct sysentvec sv_psstrings to hardcoding FREEBSD32_PS_STRINGS
in the compat32 code. Use sv_usrstack instead of FREEBSD32_USRSTACK as well.

Revision 1.93.2.16: download - view: text, markup, annotated - select for diffs
Wed Aug 11 09:04:36 2010 UTC (18 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.15: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.15: +1 -0 lines
SVN rev 211174 on 2010-08-11 09:04:36Z by kib

MFC r210848:
Copy inode birthtime to the struct stat32.

Revision 1.93.2.15: download - view: text, markup, annotated - select for diffs
Wed Aug 11 08:58:27 2010 UTC (18 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.14: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.14: +2 -1 lines
SVN rev 211173 on 2010-08-11 08:58:27Z by kib

MFC r210847:
Fix style.

Revision 1.93.2.14: download - view: text, markup, annotated - select for diffs
Tue Aug 10 10:15:34 2010 UTC (18 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.13: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.13: +2 -0 lines
SVN rev 211138 on 2010-08-10 10:15:34Z by kib

MFC r210796:
When compat32 recvmsg(2) does not need to copy out control messages, set
msg_controllen to 0.

PR:	kern/149227

Revision 1.114: download - view: text, markup, annotated - select for diffs
Sat Aug 7 11:57:13 2010 UTC (18 months ago) by kib
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +2 -1 lines
SVN rev 211006 on 2010-08-07 11:57:13Z by kib

Prefer struct sysentvec sv_psstrings to hardcoding FREEBSD32_PS_STRINGS
in the compat32 code. Use sv_usrstack instead of FREEBSD32_USRSTACK as well.

MFC after:	1 week

Revision 1.113: download - view: text, markup, annotated - select for diffs
Wed Aug 4 14:38:20 2010 UTC (18 months ago) by kib
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +1 -0 lines
SVN rev 210848 on 2010-08-04 14:38:20Z by kib

Copy inode birthtime to the struct stat32.

MFC after:	1 week

Revision 1.112: download - view: text, markup, annotated - select for diffs
Wed Aug 4 14:35:05 2010 UTC (18 months ago) by kib
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +2 -1 lines
SVN rev 210847 on 2010-08-04 14:35:05Z by kib

Fix style.

MFC after:	1 week

Revision 1.111: download - view: text, markup, annotated - select for diffs
Tue Aug 3 11:23:44 2010 UTC (18 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +2 -0 lines
SVN rev 210796 on 2010-08-03 11:23:44Z by kib

When compat32 recvmsg(2) does not need to copy out control messages, set
msg_controllen to 0.

PR:	kern/149227
Submitted by:	Stef Walter <stef memberwebs com>
MFC after:	1 weeks

Revision 1.110: 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.109: preferred, colored
Changes since revision 1.109: +7 -9 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.109: 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.108: preferred, colored
Changes since revision 1.108: +6 -5 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.108: download - view: text, markup, annotated - select for diffs
Fri Jul 23 21:30:33 2010 UTC (18 months, 2 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +1 -1 lines
SVN rev 210431 on 2010-07-23 21:30:33Z by kib

Remove the linux_exec_copyin_args(), freebsd32_exec_copyin_args() may
server as well. COMPAT_FREEBSD32 is a prerequisite for COMPAT_LINUX32.

Reviewed by:	alc
MFC after:	3 weeks

Revision 1.107: 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.106: preferred, colored
Changes since revision 1.106: +1 -3 lines
SVN rev 210429 on 2010-07-23 18:58:27Z by alc

Eliminate a little bit of duplicated code.

Revision 1.93.2.13: download - view: text, markup, annotated - select for diffs
Sun Jul 11 08:41:30 2010 UTC (19 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.12: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.12: +1 -1 lines
SVN rev 209894 on 2010-07-11 08:41:30Z by kib

MFC r209687:
Constify source argument for siginfo_to_siginfo32().

Revision 1.106: download - view: text, markup, annotated - select for diffs
Sun Jul 4 11:43:53 2010 UTC (19 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +1 -1 lines
SVN rev 209687 on 2010-07-04 11:43:53Z by kib

Constify source argument for siginfo_to_siginfo32().

MFC after:	1 week

Revision 1.93.2.12.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.93.2.12: preferred, colored; next MAIN 1.93.2.13: preferred, colored
Changes since revision 1.93.2.12: +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.93.2.12: download - view: text, markup, annotated - select for diffs
Wed Apr 28 09:59:28 2010 UTC (21 months, 1 week ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_1_BP
Branch point for: RELENG_8_1
Diff to: previous 1.93.2.11: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.11: +24 -32 lines
SVN rev 207316 on 2010-04-28 09:59:28Z by kib

MFC r207007:
Extract the code to copy-out struct rusage32 from struct rusage
into the new function.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Wed Apr 21 19:28:01 2010 UTC (21 months, 2 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +24 -32 lines
SVN rev 207007 on 2010-04-21 19:28:01Z by kib

Extract the code to copy-out struct rusage32 from struct rusage
into the new function.

Reviewed by:	jhb
MFC after:	1 week

Revision 1.93.2.11: download - view: text, markup, annotated - select for diffs
Wed Apr 7 14:52:42 2010 UTC (22 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.10: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.10: +0 -1 lines
SVN rev 206353 on 2010-04-07 14:52:42Z by kib

MFC r205327:
Remove empty line.

Revision 1.93.2.10: download - view: text, markup, annotated - select for diffs
Wed Apr 7 14:46:28 2010 UTC (22 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.9: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.9: +0 -530 lines
SVN rev 206349 on 2010-04-07 14:46:28Z by kib

MFC r205323:
Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding
sysv_{msg,sem,shm}.c files.

Mark SysV IPC freebsd32 syscalls as NOSTD and add required
SYSCALL_INIT_HELPER/SYSCALL32_INIT_HELPERs to provide auto
register/unregister on module load.

This makes COMPAT_FREEBSD32 functional with SysV IPC compiled and loaded
as modules.

Revision 1.93.2.9: download - view: text, markup, annotated - select for diffs
Wed Apr 7 14:35:09 2010 UTC (22 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.8: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.8: +0 -54 lines
SVN rev 206348 on 2010-04-07 14:35:09Z by kib

MFC r205322:
Move SysV IPC freebsd32 compat shims helpers from freebsd32_misc.c to
sysv_ipc.c.

Revision 1.93.2.8: download - view: text, markup, annotated - select for diffs
Wed Apr 7 14:28:47 2010 UTC (22 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.7: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.7: +30 -0 lines
SVN rev 206347 on 2010-04-07 14:28:47Z by kib

MFC r205321:
Introduce SYSCALL_INIT_HELPER and SYSCALL32_INIT_HELPER macros and
neccessary support functions to allow registering dynamically loaded
syscalls from the MOD_LOAD handlers. Helpers handle registration
failures semi-automatically.

Revision 1.93.2.7: download - view: text, markup, annotated - select for diffs
Wed Apr 7 14:09:29 2010 UTC (22 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.6: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.6: +1 -1 lines
SVN rev 206344 on 2010-04-07 14:09:29Z by kib

MFC r205319:
Make freebsd32_copyiniov() available outside of freebsd32_misc.

Revision 1.93.2.6: download - view: text, markup, annotated - select for diffs
Wed Apr 7 02:24:41 2010 UTC (22 months ago) by nwhitehorn
Branches: RELENG_8
Diff to: previous 1.93.2.5: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.5: +158 -27 lines
SVN rev 206336 on 2010-04-07 02:24:41Z by nwhitehorn

MFC r205014,205015:

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

This MFC is required for MFCs of later changes to the freebsd32
compatibility from HEAD.

Requested by:	kib

Revision 1.104: download - view: text, markup, annotated - select for diffs
Sun Mar 28 13:13:22 2010 UTC (22 months, 2 weeks ago) by ed
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +3 -3 lines
SVN rev 205792 on 2010-03-28 13:13:22Z by ed

Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.

A nice thing about POSIX 2008 is that it finally standardizes a way to
obtain file access/modification/change times in sub-second precision,
namely using struct timespec, which we already have for a very long
time. Unfortunately POSIX uses different names.

This commit adds compatibility macros, so existing code should still
build properly. Also change all source code in the kernel to work
without any of the compatibility macros. This makes it all a less
ambiguous.

I am also renaming st_birthtime to st_birthtim, even though it was a
local extension anyway. It seems Cygwin also has a st_birthtim.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Fri Mar 19 11:13:42 2010 UTC (22 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +0 -1 lines
SVN rev 205327 on 2010-03-19 11:13:42Z by kib

Remove empty line.

MFC after:	2 weeks

Revision 1.102: download - view: text, markup, annotated - select for diffs
Fri Mar 19 11:04:42 2010 UTC (22 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +0 -530 lines
SVN rev 205323 on 2010-03-19 11:04:42Z by kib

Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding
sysv_{msg,sem,shm}.c files.

Mark SysV IPC freebsd32 syscalls as NOSTD and add required
SYSCALL_INIT_HELPER/SYSCALL32_INIT_HELPERs to provide auto
register/unregister on module load.

This makes COMPAT_FREEBSD32 functional with SysV IPC compiled and loaded
as modules.

Reviewed by:	jhb
MFC after:	2 weeks

Revision 1.101: download - view: text, markup, annotated - select for diffs
Fri Mar 19 11:01:51 2010 UTC (22 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +0 -54 lines
SVN rev 205322 on 2010-03-19 11:01:51Z by kib

Move SysV IPC freebsd32 compat shims helpers from freebsd32_misc.c to
sysv_ipc.c.

Reviewed by:	jhb
MFC after:	2 weeks

Revision 1.100: download - view: text, markup, annotated - select for diffs
Fri Mar 19 10:56:30 2010 UTC (22 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +30 -0 lines
SVN rev 205321 on 2010-03-19 10:56:30Z by kib

Introduce SYSCALL_INIT_HELPER and SYSCALL32_INIT_HELPER macros and
neccessary support functions to allow registering dynamically loaded
syscalls from the MOD_LOAD handlers. Helpers handle registration
failures semi-automatically.

Reviewed by:	jhb
MFC after:	2 weeks

Revision 1.99: download - view: text, markup, annotated - select for diffs
Fri Mar 19 10:49:03 2010 UTC (22 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +1 -1 lines
SVN rev 205319 on 2010-03-19 10:49:03Z by kib

Make freebsd32_copyiniov() available outside of freebsd32_misc.

MFC after:	2 weeks

Revision 1.98: download - view: text, markup, annotated - select for diffs
Thu Mar 11 14:49:06 2010 UTC (23 months ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +158 -27 lines
SVN rev 205014 on 2010-03-11 14:49:06Z by nwhitehorn

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

Reviewed by:	kib, jhb

Revision 1.67.2.11.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.67.2.11: preferred, colored; next MAIN 1.68: preferred, colored
Changes since revision 1.67.2.11: +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.93.2.5: download - view: text, markup, annotated - select for diffs
Sat Dec 19 11:47:00 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.4: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.4: +35 -0 lines
SVN rev 200725 on 2009-12-19 11:47:00Z by kib

MFC r198508, r198509:
Reimplement pselect() in kernel, making change of sigmask and sleep atomic.

MFC r198538:
Move pselect(3) man page to section 2.

Revision 1.93.2.4: download - view: text, markup, annotated - select for diffs
Sat Dec 19 11:31:28 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.3: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.3: +7 -16 lines
SVN rev 200722 on 2009-12-19 11:31:28Z by kib

MFC r198507:
Use kern_sigprocmask() instead of direct manipulation of td_sigmask to
reschedule newly blocked signals.

MFC r198590:
Trapsignal() calls kern_sigprocmask() when delivering catched signal
with proc lock held.

MFC r198670:
For trapsignal() and postsig(), kern_sigprocmask() is called with
both process lock and curproc->p_sigacts->ps_mtx locked. Prevent lock
recursion on ps_mtx in reschedule_signals().

Revision 1.93.2.3: download - view: text, markup, annotated - select for diffs
Sat Dec 19 11:13:59 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_8
Diff to: previous 1.93.2.2: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.2: +1 -12 lines
SVN rev 200721 on 2009-12-19 11:13:59Z by kib

MFC r198506:
In kern_sigsuspend(), manipulate thread signal mask using
kern_sigprocmask(). Also, do cursig/postsig loop immediately after
waiting for signal, repeating the wait if wakeup was spurious due to
race with other thread fetching signal from the process queue before us.

MFC r199136:
Use cpu_set_syscall_retval(9) to set syscall result, and return
EJUSTRETURN from kern_sigsuspend() to prevent syscall return code from
modifying wrong frame.
Take care of possibility that pending SIGCONT might be cancelled by
SIGSTOP, causing postsig() not to deliver any catched signal.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Tue Oct 27 10:55:34 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +35 -0 lines
SVN rev 198508 on 2009-10-27 10:55:34Z by kib

Current pselect(3) is implemented in usermode and thus vulnerable to
well-known race condition, which elimination was the reason for the
function appearance in first place. If sigmask supplied as argument to
pselect() enables a signal, the signal might be delivered before thread
called select(2), causing lost wakeup. Reimplement pselect() in kernel,
making change of sigmask and sleep atomic.

Since signal shall be delivered to the usermode, but sigmask restored,
set TDP_OLDMASK and save old mask in td_oldsigmask. The TDP_OLDMASK
should be cleared by ast() in case signal was not gelivered during
syscall execution.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month

Revision 1.96: download - view: text, markup, annotated - select for diffs
Tue Oct 27 10:47:58 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +7 -16 lines
SVN rev 198507 on 2009-10-27 10:47:58Z by kib

In r197963, a race with thread being selected for signal delivery
while in kernel mode, and later changing signal mask to block the
signal, was fixed for sigprocmask(2) and ptread_exit(3). The same race
exists for sigreturn(2), setcontext(2) and swapcontext(2) syscalls.

Use kern_sigprocmask() instead of direct manipulation of td_sigmask to
reschedule newly blocked signals, closing the race.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month

Revision 1.95: download - view: text, markup, annotated - select for diffs
Tue Oct 27 10:42:24 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +1 -12 lines
SVN rev 198506 on 2009-10-27 10:42:24Z by kib

In kern_sigsuspend(), better manipulate thread signal mask using
kern_sigprocmask() to properly notify other possible candidate threads
for signal delivery.

Since sigsuspend() shall only return to usermode after a signal was
delivered, do cursig/postsig loop immediately after waiting for
signal, repeating the wait if wakeup was spurious due to race with
other thread fetching signal from the process queue before us. Add
thread_suspend_check() call to allow the thread to be stopped or killed
while in loop.

Modify last argument of kern_sigprocmask() from boolean to flags,
allowing the function to be called with locked proc. Convertion of the
callers that supplied 1 to the old argument will be done in the next
commit, and due to SIGPROCMASK_OLD value equial to 1, code is formally
correct in between.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month

Revision 1.93.2.2.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.93.2.2: preferred, colored; next MAIN 1.93.2.3: preferred, colored
Changes since revision 1.93.2.2: +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.93.2.2: download - view: text, markup, annotated - select for diffs
Wed Sep 16 13:24:37 2009 UTC (2 years, 4 months ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.93.2.1: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.1: +2 -1 lines
SVN rev 197255 on 2009-09-16 13:24:37Z by kib

MFC r197049:
Calculate the amount of bytes to copy for select filedescriptor masks
taking into account size of fd_set for the current process ABI.

Approved by:	re (kensmith)

Revision 1.94: download - view: text, markup, annotated - select for diffs
Wed Sep 9 20:59:01 2009 UTC (2 years, 5 months ago) by kib
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +2 -1 lines
SVN rev 197049 on 2009-09-09 20:59:01Z by kib

kern_select(9) copies fd_set in and out of userspace in quantities of
longs. Since 32bit processes longs are 4 bytes, 64bit kernel may copy in
or out 4 bytes more then the process expected.

Calculate the amount of bytes to copy taking into account size of fd_set
for the current process ABI.

Diagnosed and tested by:	Peter Jeremy <peterjeremy acm org>
Reviewed by:	jhb
MFC after:	1 week

Revision 1.93.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.93: preferred, colored
Changes since revision 1.93: +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.67.2.11: download - view: text, markup, annotated - select for diffs
Fri Jul 31 20:32:55 2009 UTC (2 years, 6 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.67.2.10: preferred, colored; branchpoint 1.67: preferred, colored; next MAIN 1.68: preferred, colored
Changes since revision 1.67.2.10: +239 -35 lines
SVN rev 196006 on 2009-07-31 20:32:55Z by jhb

MFC: Change the ABI of some of the structures used by the SYSV IPC API:
- Various members of struct ipc_perm use appropriate types instead of
  unsigned short.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
  int which should allow for complete support of SYSV SHM regions >= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
  short.
- The existing versions of the __semctl(), msgctl(), and shmctl() system
  calls have been renamed to freebsd7_*() and implement the old ABI. New
  versions of these system calls provide the new ABI.  The new system
  calls also use newer symbol versions in libc so old and new binaries
  will both work under new kernels.
- Specific to 7.x: the kern_msgctl(), kern_semctl(), and kern_shmctl()
  functions now use ABI shims that transparently "rename" the functions
  to kern_new_*() for all new modules.  Existing compat functions under
  the old names remain to provide compatibility for older kernel modules.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Mon Jul 27 16:03:04 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.92: preferred, colored
Changes since revision 1.92: +6 -6 lines
SVN rev 195911 on 2009-07-27 16:03:04Z by jhb

Fix the freebsd32 versions of semsys(), shmsys(), and msgsys() to use the
old ABI versions of the relevant control system call (e.g.
freebsd7_freebsd32_msgctl() instead of freebsd32_msgctl() for msgsys()).

Approved by:	re (kib)

Revision 1.92: 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.91: preferred, colored
Changes since revision 1.91: +1 -1 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.91: download - view: text, markup, annotated - select for diffs
Wed Jun 24 21:10:52 2009 UTC (2 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +260 -29 lines
SVN rev 194910 on 2009-06-24 21:10:52Z by jhb

Change the ABI of some of the structures used by the SYSV IPC API:
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned
  short.
- The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned
  short.
- The mode member of struct ipc_perm is now mode_t instead of unsigned short
  (this is merely a style bug).
- The rather dubious padding fields for ABI compat with SV/I386 have been
  removed from struct msqid_ds and struct semid_ds.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
  int.  This removes the need for the shm_bsegsz member in struct
  shmid_kernel and should allow for complete support of SYSV SHM regions
  >= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
  short.
- The shm_internal member of struct shmid_ds is now gone.  The internal
  VM object pointer for SHM regions has been moved into struct
  shmid_kernel.
- The existing __semctl(), msgctl(), and shmctl() system call entries are
  now marked COMPAT7 and new versions of those system calls which support
  the new ABI are now present.
- The new system calls are assigned to the FBSD-1.1 version in libc.  The
  FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls.
- A simplistic framework for tagging system calls with compatibility
  symbol versions has been added to libc.  Version tags are added to
  system calls by adding an appropriate __sym_compat() entry to
  src/lib/libc/incldue/compat.h. [1]

PR:		kern/16195 kern/113218 bin/129855
Reviewed by:	arch@, rwatson
Discussed with:	kan, kib [1]

Revision 1.90: download - view: text, markup, annotated - select for diffs
Wed May 27 14:11:23 2009 UTC (2 years, 8 months ago) by jamie
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +15 -149 lines
SVN rev 192895 on 2009-05-27 14:11:23Z by jamie

Add hierarchical jails.  A jail may further virtualize its environment
by creating a child jail, which is visible to that jail and to any
parent jails.  Child jails may be restricted more than their parents,
but never less.  Jail names reflect this hierarchy, being MIB-style
dot-separated strings.

Every thread now points to a jail, the default being prison0, which
contains information about the physical system.  Prison0's root
directory is the same as rootvnode; its hostname is the same as the
global hostname, and its securelevel replaces the global securelevel.
Note that the variable "securelevel" has actually gone away, which
should not cause any problems for code that properly uses
securelevel_gt() and securelevel_ge().

Some jail-related permissions that were kept in global variables and
set via sysctls are now per-jail settings.  The sysctls still exist for
backward compatibility, used only by the now-deprecated jail(2) system
call.

Approved by:	bz (mentor)

Revision 1.89: download - view: text, markup, annotated - select for diffs
Wed Apr 29 21:14:15 2009 UTC (2 years, 9 months ago) by jamie
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +200 -15 lines
SVN rev 191673 on 2009-04-29 21:14:15Z by jamie

Introduce the extensible jail framework, using the same "name=value"
interface as nmount(2).  Three new system calls are added:
* jail_set, to create jails and change the parameters of existing jails.
  This replaces jail(2).
* jail_get, to read the parameters of existing jails.  This replaces the
  security.jail.list sysctl.
* jail_remove to kill off a jail's processes and remove the jail.
Most jail parameters may now be changed after creation, and jails may be
set to exist without any attached processes.  The current jail(2) system
call still exists, though it is now a stub to jail_set(2).

Approved by:	bz (mentor)

Revision 1.67.2.10.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.67.2.10: preferred, colored; next MAIN 1.67.2.11: preferred, colored
Changes since revision 1.67.2.10: +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.88: download - view: text, markup, annotated - select for diffs
Fri Mar 27 13:13:59 2009 UTC (2 years, 10 months ago) by jamie
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +2 -1 lines
SVN rev 190466 on 2009-03-27 13:13:59Z by jamie

Whitespace/spelling fixes in advance of upcoming functional changes.

Approved by:	bz (mentor)

Revision 1.67.2.10: download - view: text, markup, annotated - select for diffs
Tue Mar 10 17:28:23 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.67.2.9: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.9: +2 -5 lines
SVN rev 189634 on 2009-03-10 17:28:23Z by jhb

MFC: Push down Giant inside sysctl.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Mon Mar 2 23:26:30 2009 UTC (2 years, 11 months ago) by jamie
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +2 -9 lines
SVN rev 189290 on 2009-03-02 23:26:30Z by jamie

Extend the "vfsopt" mount options for more general use.  Make struct
vfsopt and the vfs_buildopts function public, and add some new fields
to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and
vfs_opterror.

Further extend the interface to allow reading options from the kernel
in addition to sending them to the kernel, with vfs_setopt and related
functions.

While this allows the "name=value" option interface to be used for more
than just FS mounts (planned use is for jails), it retains the current
"vfsopt" name and <sys/mount.h> requirement.

Approved by:	bz (mentor)

Revision 1.67.2.9: download - view: text, markup, annotated - select for diffs
Sat Feb 7 13:19:08 2009 UTC (3 years ago) by bz
Branches: RELENG_7
Diff to: previous 1.67.2.8: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.8: +61 -0 lines
SVN rev 188281 on 2009-02-07 13:19:08Z by bz

MFC:
 r185435:
  This enhances the current jail implementation to permit multiple
  addresses per jail. In addtion to IPv4, IPv6 is supported as well.
  Due to updated checks it is even possible to have jails without
  an IP address at all, which basically gives one a chroot with
  restricted process view, no networking,..

  SCTP support was updated and supports IPv6 in jails as well.

  Cpuset support permits jails to be bound to specific processor
  sets after creation.

  Jails can have an unrestricted (no duplicate protection, etc.) name
  in addition to the hostname. The jail name cannot be changed from
  within a jail and is considered to be used for management purposes
  or as audit-token in the future.

  DDB 'show jails' command was added to aid debugging.

  Proper compat support permits 32bit jail binaries to be used on 64bit
  systems to manage jails. Also backward compatibility was preserved where
  possible: for jail v1 syscalls, as well as with user space management
  utilities.

  Both jail as well as prison version were updated for the new features.
  A gap was intentionally left as the intermediate versions had been
  used by various patches floating around the last years.

  Bump __FreeBSD_version for the afore mentioned and in kernel changes.

 r185441:
  Unbreak the no-networks (no INET/6) build.

 r185899:
  Correctly check the number of prison states to not access anything
  outside the prison_states array.
  When checking if there is a name configured for the prison, check the
  first character to not be '\0' instead of checking if the char array
  is present, which it always is. Note, that this is different for the
  *jailname in the syscall.

  Found with:	Coverity Prevent(tm)
  CID:		4156, 4155

 r186085:
  Make sure that the direct jls invocations prints something
  reasonable close to and in the same format as it had always.

 r186606:
  Make sure that unused j->ip[46] are cleared.

 r186834:
  Document the special loopback address behaviour of jails.

  PR:		kern/103464

 r186841:
  Put the devfs ruleset next to devfs enable, add a comment about
  the suggested ruleset[1].

  While here use an IP from the 'test-net' prefix for docs.

  PR:		kern/130102

 r187059:
  Add a short section talking about jails and file systems; mention the
  mountand jail-aware file systems as well as quota.

  PR:		kern/68192

 r187092:
  Sort .Xr.

 r187365:
  s,unmount 8,umount 8, it is unmount(2) which I did not mean.

 r187669:
  Update the description of the '-h' option wrt to primary addresses
  per address family and add a reference to the ip-addresses option.

 r187670:
  New sentence starts on a new line.

Revision 1.38.2.17: download - view: text, markup, annotated - select for diffs
Wed Jan 21 17:03:55 2009 UTC (3 years ago) by jhb
Branches: RELENG_6
Diff to: previous 1.38.2.16: preferred, colored; branchpoint 1.38: preferred, colored; next MAIN 1.39: preferred, colored
Changes since revision 1.38.2.16: +18 -0 lines
SVN rev 187537 on 2009-01-21 17:03:55Z by jhb

MFC: Split most of getdirentries() out into a kern_getdirentries() and add
a freebsd32 frontend to fix a data corruption bug with 32-bit binaries.

Revision 1.38.2.16: download - view: text, markup, annotated - select for diffs
Wed Jan 21 16:28:15 2009 UTC (3 years ago) by jhb
Branches: RELENG_6
Diff to: previous 1.38.2.15: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.15: +80 -0 lines
SVN rev 187536 on 2009-01-21 16:28:15Z by jhb

MFC: Add support for installing 32-bit system calls from kernel modules.

Revision 1.67.2.8: download - view: text, markup, annotated - select for diffs
Wed Jan 21 16:14:43 2009 UTC (3 years ago) by jhb
Branches: RELENG_7
Diff to: previous 1.67.2.7: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.7: +80 -0 lines
SVN rev 187535 on 2009-01-21 16:14:43Z by jhb

MFC: Add support for installing 32-bit system calls from kernel modules.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Mon Dec 29 12:58:45 2008 UTC (3 years, 1 month ago) by ed
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +2 -5 lines
SVN rev 186564 on 2008-12-29 12:58:45Z by ed

Push down Giant inside sysctl. Also add some more assertions to the code.

In the existing code we didn't really enforce that callers hold Giant
before calling userland_sysctl(), even though there is no guarantee it
is safe. Fix this by just placing Giant locks around the call to the oid
handler. This also means we only pick up Giant for a very short period
of time. Maybe we should add MPSAFE flags to sysctl or phase it out all
together.

I've also added SYSCTL_LOCK_ASSERT(). We have to make sure sysctl_root()
and name2oid() are called with the sysctl lock held.

Reviewed by:	Jille Timmermans <jille quis cx>

Revision 1.85: download - view: text, markup, annotated - select for diffs
Wed Dec 3 18:45:38 2008 UTC (3 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +1 -1 lines
SVN rev 185589 on 2008-12-03 18:45:38Z by jhb

When unloading a 32-bit system call module, restore the sysent vector in
the 32-bit system call table instead of the main system call table.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Sat Nov 29 14:32:14 2008 UTC (3 years, 2 months ago) by bz
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +61 -0 lines
SVN rev 185435 on 2008-11-29 14:32:14Z by bz

MFp4:
  Bring in updated jail support from bz_jail branch.

This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..

SCTP support was updated and supports IPv6 in jails as well.

Cpuset support permits jails to be bound to specific processor
sets after creation.

Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.

DDB 'show jails' command was added to aid debugging.

Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.

Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.

Bump __FreeBSD_version for the afore mentioned and in kernel changes.

Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
  and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
  help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
  suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
  on cluster machines as well as all the testers and people
  who provided feedback the last months on freebsd-jail and
  other channels.
- My employer, CK Software GmbH, for the support so I could work on this.

Reviewed by:	(see above)
MFC after:	3 months (this is just so that I get the mail)
X-MFC Before:   7.2-RELEASE if possible

Revision 1.67.2.7.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.67.2.7: preferred, colored; next MAIN 1.67.2.8: preferred, colored
Changes since revision 1.67.2.7: +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.67.2.7: download - view: text, markup, annotated - select for diffs
Thu Nov 13 02:35:40 2008 UTC (3 years, 2 months ago) by peter
Branches: RELENG_7
CVS tags: RELENG_7_1_BP
Branch point for: RELENG_7_1
Diff to: previous 1.67.2.6: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.6: +1 -1 lines
SVN rev 184907 on 2008-11-13 02:35:40Z by peter

MFC 184828,184829: Fix si_addr in 32 bit signals.

Approved by:	re (kib)

Revision 1.83: download - view: text, markup, annotated - select for diffs
Mon Nov 10 23:36:20 2008 UTC (3 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +1 -1 lines
SVN rev 184829 on 2008-11-10 23:36:20Z by peter

Sigh.  Fix a pointer/int compile error.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Mon Nov 10 23:26:52 2008 UTC (3 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +1 -1 lines
SVN rev 184828 on 2008-11-10 23:26:52Z by peter

Fix a signal emulation bug introduced in r163018 (and present in 7.x).
This prevents 32 bit signal handlers from finding out what the faulting
address is.  Both the secret 4th argument and siginfo->si_addr are zero.

Revision 1.67.2.6: download - view: text, markup, annotated - select for diffs
Thu Oct 30 13:14:45 2008 UTC (3 years, 3 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.67.2.5: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.5: +18 -0 lines
SVN rev 184469 on 2008-10-30 13:14:45Z by jhb

MFC: Split most of getdirentries() out into a kern_getdirentries() and add
a freebsd32 frontend to fix a data corruption bug with 32-bit binaries.

Approved by:	re (kib)

Revision 1.81: download - view: text, markup, annotated - select for diffs
Wed Oct 22 21:55:48 2008 UTC (3 years, 3 months ago) by jhb
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +18 -0 lines
SVN rev 184183 on 2008-10-22 21:55:48Z by jhb

Split the copyout of *base at the end of getdirentries() out leaving the
rest in kern_getdirentries().  Use kern_getdirentries() to implement
freebsd32_getdirentries().  This fixes a bug where calls to getdirentries()
in 32-bit binaries would trash the 4 bytes after the 'long base' in
userland.

Submitted by:	ups
MFC after:	1 week

Revision 1.67.2.5: download - view: text, markup, annotated - select for diffs
Mon Oct 6 16:11:08 2008 UTC (3 years, 4 months ago) by obrien
Branches: RELENG_7
Diff to: previous 1.67.2.4: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.4: +50 -5 lines
SVN rev 183644 on 2008-10-06 16:11:08Z by obrien

MFC: revs 183042,183044,183188,183189,183270,183271,183273.
Add freebsd32 compat shim for nmount(2).  Also 32-bit ioctl shims
for MDIO, CDIOREADTOCHEADER and CDIOREADTOCENTRYS requests.
Fix bug which removed the 32-bit swapon(2) interface.  style(9).

Approved by: re(kostikbel)

Revision 1.38.2.15.2.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.38.2.15: preferred, colored; next MAIN 1.38.2.16: preferred, colored
Changes since revision 1.38.2.15: +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.80: download - view: text, markup, annotated - select for diffs
Thu Sep 25 20:50:21 2008 UTC (3 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +80 -0 lines
SVN rev 183365 on 2008-09-25 20:50:21Z by jhb

Add support for installing 32-bit system calls from kernel modules.  This
includes syscall32_{de,}register() routines as well as a module handler
and wrapper macros similar to the support for native syscalls in
<sys/sysent.h>.

MFC after:	1 month

Revision 1.79: download - view: text, markup, annotated - select for diffs
Fri Sep 19 15:17:32 2008 UTC (3 years, 4 months ago) by obrien
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +46 -2 lines
SVN rev 183188 on 2008-09-19 15:17:32Z by obrien

Add freebsd32 compat shim for nmount(2).
(and quiet some compiler warnings for vfs_donmount)

Revision 1.78: download - view: text, markup, annotated - select for diffs
Mon Sep 15 17:39:40 2008 UTC (3 years, 4 months ago) by obrien
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +4 -3 lines
SVN rev 183044 on 2008-09-15 17:39:40Z by obrien

style(9)

Revision 1.67.2.4: download - view: text, markup, annotated - select for diffs
Fri Jul 25 17:46:01 2008 UTC (3 years, 6 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.67.2.3: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.3: +57 -0 lines
SVN rev 180808 on 2008-07-25 17:46:01Z by jhb

MFC: Add cpuset, an api for thread to cpu binding and cpu resource grouping
and assignment.  This is mostly synched up with what is in HEAD with the
following exceptions:
- I didn't MFC any of the interrupt binding stuff as it requires other
  changes and I figured this change was large enough as it is.
- The sched_affinity() implementation for ULE in HEAD depends on the newer
  CPU topology stuff as well as other changes in ULE.  Rather than
  backport all of that, I implemented sched_affinity() using the existing
  CPU topology and ULE code in 7.x.  Thus, any bugs in the ULE affinity
  stuff in 7 are purely my fault and not Jeff's.

Note that, just as in HEAD, cpusets currently don't work on SCHED_4BSD (the
syscalls will succeed, but they don't have any effect).

Tested by:	brooks, ps

Revision 1.77: download - view: text, markup, annotated - select for diffs
Thu Jul 10 19:54:34 2008 UTC (3 years, 7 months ago) by brooks
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +4 -4 lines
SVN rev 180436 on 2008-07-10 19:54:34Z by brooks

style(9): put parentheses around return values.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Thu Jul 10 17:45:57 2008 UTC (3 years, 7 months ago) by brooks
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +57 -0 lines
SVN rev 180433 on 2008-07-10 17:45:57Z by brooks

id_t is a 64-bit integer and thus is passed as two arguments like off_t is.
As a result, those arguments must be recombined before calling the real
syscal implementation.  This change fixes 32-bit compatibility for
cpuset_getid(), cpuset_setid(), cpuset_getaffinity(), and
cpuset_setaffinity().

Revision 1.75: download - view: text, markup, annotated - select for diffs
Mon Mar 31 12:08:30 2008 UTC (3 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +60 -7 lines
Add the freebsd32 compatibility shims for the *at() syscalls.

Reviewed by:	rwatson, rdivacky
Tested by:	pho

Revision 1.67.2.3: download - view: text, markup, annotated - select for diffs
Thu Dec 20 19:43:55 2007 UTC (4 years, 1 month ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0
Diff to: previous 1.67.2.2: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.2: +0 -6 lines
MFC: Remove redundant checks for msgsnd(3) and msgrcv(3).

Approved by:	re (kensmith)

Revision 1.38.2.15: download - view: text, markup, annotated - select for diffs
Wed Dec 19 23:03:50 2007 UTC (4 years, 1 month ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_4_BP
Branch point for: RELENG_6_4
Diff to: previous 1.38.2.14: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.14: +184 -25 lines
MFC: Add freebsd32 compat wrappers for msgctl() and __semctl().

Revision 1.38.2.14: download - view: text, markup, annotated - select for diffs
Wed Dec 19 22:59:07 2007 UTC (4 years, 1 month ago) by jhb
Branches: RELENG_6
Diff to: previous 1.38.2.13: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.13: +11 -114 lines
MFC: Move several data structure definitions out of freebsd32_misc.c and
into freebsd32.h and freebsd32_ipc.h.

Revision 1.67.2.2: download - view: text, markup, annotated - select for diffs
Wed Dec 19 20:43:41 2007 UTC (4 years, 1 month ago) by jhb
Branches: RELENG_7
Diff to: previous 1.67.2.1: preferred, colored; branchpoint 1.67: preferred, colored
Changes since revision 1.67.2.1: +184 -25 lines
MFC: Add freebsd32 compat wrappers for msgctl() and __semctl().

Approved by:	re (kensmith)

Revision 1.67.2.1: download - view: text, markup, annotated - select for diffs
Wed Dec 19 20:37:53 2007 UTC (4 years, 1 month ago) by jhb
Branches: RELENG_7
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +11 -108 lines
MFC: Move several data structure definitions out of freebsd32_misc.c and
into freebsd32.h and freebsd32_ipc.h.

Approved by:	re (kensmith)

Revision 1.74: download - view: text, markup, annotated - select for diffs
Mon Dec 10 19:42:23 2007 UTC (4 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +10 -22 lines
Bah, remove last vestiges of some statfs conversion fixes that aren't quite
ready for CVS yet that snuck into 1.68.

Pointy hat to:	jhb

Revision 1.73: download - view: text, markup, annotated - select for diffs
Sat Dec 8 01:41:31 2007 UTC (4 years, 2 months ago) by scottl
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +0 -1 lines
Grrr, remove an unused variable missed in the last commit.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Fri Dec 7 22:32:09 2007 UTC (4 years, 2 months ago) by scottl
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +1 -3 lines
Don't expect a return value from statfs_scale_blocks().

Revision 1.71: download - view: text, markup, annotated - select for diffs
Thu Dec 6 23:35:29 2007 UTC (4 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +184 -25 lines
Add freebsd32 compat wrappers for msgctl() and _semctl() using
kern_msgctl() and kern_semctl().

MFC after:	1 week

Revision 1.70: download - view: text, markup, annotated - select for diffs
Thu Dec 6 23:23:16 2007 UTC (4 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +1 -36 lines
Move 32-bit SYSV IPC structure definitions into freebsd32_ipc.h.

MFC after:	1 week

Revision 1.69: download - view: text, markup, annotated - select for diffs
Thu Dec 6 23:11:27 2007 UTC (4 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +36 -83 lines
Move several data structure definitions out of freebsd32_misc.c and into
freebsd32.h instead.

MFC after:	1 week

Revision 1.38.2.13: download - view: text, markup, annotated - select for diffs
Thu Dec 6 22:00:05 2007 UTC (4 years, 2 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.38.2.12: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.12: +50 -4 lines
MFC: Add kern_msgsnd() and kern_msgrcv() and use them to fix msgsnd()
and msgrcv() in 32-bit ABIs on 64-bit kernels.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Tue Dec 4 20:25:41 2007 UTC (4 years, 2 months ago) by jkim
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +0 -6 lines
Remove redundant checks for msgsnd(3) and msgrcv(3).
COMPAT_IA32 (implicitly) requires SYSVSEM, SYSVSHM and SYSVMSG in kernel.

Pointed out by:	jhb

Revision 1.38.2.12: download - view: text, markup, annotated - select for diffs
Mon Dec 3 21:42:29 2007 UTC (4 years, 2 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.38.2.11: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.11: +13 -13 lines
MFC: Unexpand PTRIN() in a few places.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Tue Aug 28 20:28:11 2007 UTC (4 years, 5 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_7_BP
Branch point for: RELENG_7
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +9 -9 lines
Rework the routines to convert a 5.x+ statfs structure (with fixed-size
64-bit counters) to a 4.x statfs structure (with long-sized counters).
- For block counters, we scale up the block size sufficiently large so
  that the resulting block counts fit into a the long-sized (long for the
  ABI, so 32-bit in freebsd32) counters.  In 4.x the NFS client's statfs
  VOP did this already.  This can lie about the block size to 4.x binaries,
  but it presents a more accurate picture of the ratios of free and
  available space.
- For non-block counters, fix the freebsd32 stats converter to cap the
  values at INT32_MAX rather than losing the upper 32-bits to match the
  behavior of the 4.x statfs conversion routine in vfs_syscalls.c

Approved by:	re (kensmith)

Revision 1.66: download - view: text, markup, annotated - select for diffs
Wed Jul 4 23:04:41 2007 UTC (4 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +83 -0 lines
Add compat6 wrapper code for mmap/lseek/pread/pwrite/truncate/ftruncate.

Approved by:  re (kensmith)

Revision 1.38.2.11: download - view: text, markup, annotated - select for diffs
Mon Jun 18 22:44:58 2007 UTC (4 years, 7 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3
Diff to: previous 1.38.2.10: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.10: +54 -0 lines
MFC: Support for running 32-bit multithreaded binaries using libthr on
amd64 including:
- Add 32-bit wrappers for thr_new(), thr_suspend(), and the umtx system
  calls.
- Add support to amd64 for constructing thread upcalls for 32-bit
  processes.
- Leave %fs and %gs alone in the signal trampoline for 32-bit processes on
  amd64.
- Add 'casuword32()' to amd64 and ia64.

Tested by:	emaste

Revision 1.65: download - view: text, markup, annotated - select for diffs
Sun Jun 17 04:37:57 2007 UTC (4 years, 7 months ago) by mjacob
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +6 -3 lines
Try a cheap way to get around gcc4.2 believing that user arguments
to system calls can change across intervening functions.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Wed May 23 13:32:21 2007 UTC (4 years, 8 months ago) by cognet
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +0 -3 lines
Remove duplicate includes.

Submitted by:   Cyril Nguyen Huu <cyril ci0 org>

Revision 1.63: download - view: text, markup, annotated - select for diffs
Tue May 1 17:10:01 2007 UTC (4 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +1 -6 lines
Eliminate the use of Giant from ia64-specific code in freebsd32_mmap().

Revision 1.62: download - view: text, markup, annotated - select for diffs
Wed Dec 20 19:36:03 2006 UTC (5 years, 1 month ago) by jkim
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +56 -4 lines
MFP4: (part of) 110058

Fix 32-bit msgsnd(3) and msgrcv(3) emulations for amd64.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Thu Oct 5 01:56:10 2006 UTC (5 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +84 -6 lines
Move some declaration of 32-bit signal structures into file
freebsd32-signal.h, implement sigtimedwait and sigwaitinfo system calls.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Mon Oct 2 12:59:55 2006 UTC (5 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +1 -0 lines
First part of a little cleanup in the calendar/timezone/RTC handling.

Move relevant variables to <sys/clock.h> and fix #includes as necessary.

Use libkern's much more time- & spamce-efficient BCD routines.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Fri Sep 22 15:04:28 2006 UTC (5 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +56 -0 lines
Add compatible code to let 32bit libthr work on 64bit kernel.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Wed Aug 16 00:02:36 2006 UTC (5 years, 5 months ago) by jkim
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +1 -0 lines
Include sys/limits.h for INT_MAX.  freebsd32_proto.h 1.58 does not include
sys/umtx.h any more and previously it was included from there.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Mon Jul 10 21:38:16 2006 UTC (5 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +5 -3 lines
- Split out kern_accept(), kern_getpeername(), and kern_getsockname() for
  use by ABI emulators.
- Alter the interface of kern_recvit() somewhat.  Specifically, go ahead
  and hard code UIO_USERSPACE in the uio as that's what all the callers
  specify.  In place, add a new uioseg to indicate what type of pointer
  is in mp->msg_name.  Previously it was always a userland address, but
  ABI emulators may pass in kernel-side sockaddrs.  Also, remove the
  namelenp field and instead require the two places that used it to
  explicitly copy mp->msg_namelen out to userland.
- Use the patched kern_recvit() to replace svr4_recvit() and the stock
  kern_sendit() to replace svr4_sendit().
- Use kern_bind() instead of stackgap use in ti_bind().
- Use kern_getpeername() and kern_getsockname() instead of stackgap in
  svr4_stream_ti_ioctl().
- Use kern_connect() instead of stackgap in svr4_do_putmsg().
- Use kern_getpeername() and kern_accept() instead of stackgap in
  svr4_do_getmsg().
- Retire the stackgap from SVR4 compat as it is no longer used.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Mon Jul 10 19:37:43 2006 UTC (5 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +13 -13 lines
Unexpand PTRIN() in several places and fix one instance where 0 was being
used instead of NULL.

Revision 1.38.2.10: download - view: text, markup, annotated - select for diffs
Wed Jun 21 16:18:48 2006 UTC (5 years, 7 months ago) by ps
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Diff to: previous 1.38.2.9: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.9: +0 -24 lines
MFC: rev 1.55
Do not copy out the iovec in the 32bit recvmsg call since soreceive
calls uiomove directly.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Thu Jun 8 18:33:08 2006 UTC (5 years, 8 months ago) by ps
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +0 -24 lines
Do not copy out the iovec in the 32bit recvmsg call since soreceive
calls uiomove directly.

Reviewed by:	ups
MFC after:	1 week

Revision 1.38.2.9: download - view: text, markup, annotated - select for diffs
Mon May 15 18:47:52 2006 UTC (5 years, 8 months ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.8: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.8: +166 -4 lines
MFC: Properly support for FreeBSD 4 32bit System V shared memory.

Submitted by:	peter

Revision 1.38.2.8: download - view: text, markup, annotated - select for diffs
Mon May 15 18:34:05 2006 UTC (5 years, 8 months ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.7: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.7: +64 -18 lines
MFC: 32bit sendfile support

Revision 1.54: download - view: text, markup, annotated - select for diffs
Thu Mar 30 07:42:32 2006 UTC (5 years, 10 months ago) by ps
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +166 -4 lines
Properly support for FreeBSD 4 32bit System V shared memory.

Submitted by:	peter
Obtained from:	Yahoo!
MFC after:	3 weeks

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

Tested by: kris@

Revision 1.38.2.7: download - view: text, markup, annotated - select for diffs
Mon Mar 6 10:56:43 2006 UTC (5 years, 11 months ago) by ps
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.38.2.6: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.6: +8 -6 lines
MFC:
Don't truncate f_mntfromname & f_mntonname to 16 characters when
translating statfs into ostatfs.  Also use strlcpy instead of bcopy
to make sure the copied strings are properly terminated.

Approved by:	re (scottl)

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Mar 4 00:09:09 2006 UTC (5 years, 11 months ago) by ps
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +8 -6 lines
use strlcpy in cvtstatfs and copy_statfs instead of bcopy to ensure
the copied strings are properly terminated.

bzero the statfs32 struct in copy_statfs.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Tue Feb 28 19:39:17 2006 UTC (5 years, 11 months ago) by ps
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +64 -18 lines
Fix 32bit sendfile by implementing kern_sendfile so that it takes
the header and trailers as iovec arguments instead of copying them
in inside of sendfile.

Reviewed by:	jhb
MFC after:	3 weeks

Revision 1.50: download - view: text, markup, annotated - select for diffs
Mon Feb 6 22:06:53 2006 UTC (6 years ago) by jhb
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +0 -1 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.38.2.6: download - view: text, markup, annotated - select for diffs
Fri Jan 27 17:17:05 2006 UTC (6 years ago) by ambrisko
Branches: RELENG_6
Diff to: previous 1.38.2.5: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.5: +21 -0 lines
MFC: 32bit lutimes

Revision 1.49: download - view: text, markup, annotated - select for diffs
Fri Jan 20 16:22:06 2006 UTC (6 years ago) by ambrisko
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +21 -0 lines
Add 32bit version of lutimes so untar doesn't mess up sym-links on amd64.

Revision 1.38.2.5: download - view: text, markup, annotated - select for diffs
Wed Dec 28 19:50:09 2005 UTC (6 years, 1 month ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.4: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.4: +22 -0 lines
MFC: 32bit futimes

Revision 1.38.2.4: download - view: text, markup, annotated - select for diffs
Wed Dec 28 19:41:48 2005 UTC (6 years, 1 month ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.3: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.3: +27 -29 lines
Correct white space issues that were introduce in 1.38.2.2.

Revision 1.38.2.3: download - view: text, markup, annotated - select for diffs
Wed Dec 28 19:39:55 2005 UTC (6 years, 1 month ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.2: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.2: +4 -3 lines
MFC: rev 1.40
Use the constants for the syscall names from syscall.h rather than
hardcoding the numbers for the SYSVIPC syscalls.

Revision 1.38.2.2: download - view: text, markup, annotated - select for diffs
Wed Dec 28 19:30:40 2005 UTC (6 years, 1 month ago) by ps
Branches: RELENG_6
Diff to: previous 1.38.2.1: preferred, colored; branchpoint 1.38: preferred, colored
Changes since revision 1.38.2.1: +630 -2 lines
MFC: 32bit compat for recvmsg, sendmsg, osigaction, osigprocmask,
osigpending, osigvec, osigblock, osigsetmask, osigsuspend, osigstack,
clock_gettime, clock_settime, and clock_getres.

Also correct the prototype for freebsd32_nanosleep in syscalls.master.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Thu Dec 8 22:14:25 2005 UTC (6 years, 2 months ago) by ambrisko
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +22 -0 lines
Add 32bit version of futimes so untar doesn't result in bad dates
(Jan 1, 1970) when run on amd64.

Reviewed by:	ps

Revision 1.47: download - view: text, markup, annotated - select for diffs
Sun Nov 6 18:12:43 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +1 -1 lines
Copy out the number of iovecs in freebsd32_recvmsg, not the length
of a single iovec.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Mon Oct 31 21:09:56 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +225 -18 lines
Reformat socket control messages on input/output for 32bit compatibility
on 64bit systems.

Submitted by:	ps, ups
Reviewed by:	jhb

Revision 1.45: download - view: text, markup, annotated - select for diffs
Wed Oct 26 22:19:51 2005 UTC (6 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +18 -18 lines
There is no 'freebsd3_' prefix for COMPAT_43 syscalls.  Those are all
bundled under MCOMPAT and have an 'o' prefix.  Adjust as appropriate.
This re-enables compiling without COMPAT_43 again.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sun Oct 23 10:43:14 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +201 -0 lines
Implement for FreeBSD 3 32 binaries:
sigaction, sigprocmask, sigpending, sigvec, sigblock, sigsetmask,
sigsuspend, sigstack

Revision 1.43: download - view: text, markup, annotated - select for diffs
Sat Oct 15 05:57:06 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +165 -0 lines
Implement the 32bit versions of recvmsg, recvfrom, sendmsg

Partially obtained from:	jhb

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sat Oct 15 02:54:18 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +53 -0 lines
Implement 32bit wrappers for clock_gettime, clock_settime, and
clock_getres.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Oct 15 02:40:10 2005 UTC (6 years, 3 months ago) by ps
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +2 -2 lines
Correct the prototype for freebsd32_nanosleep and use the proper
size when copying struct timespec32 in and out.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Mon Oct 3 18:34:17 2005 UTC (6 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +4 -3 lines
Use the constants for the syscall names from syscall.h rather than
hardcoding the numbers for the SYSVIPC syscalls.

Revision 1.38.2.1: download - view: text, markup, annotated - select for diffs
Mon Jul 18 19:49:48 2005 UTC (6 years, 6 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +6 -1 lines
MFC: Wrap freebsd32_mmap_partial() with Giant.

Approved by:	re (kensmith)

Revision 1.23.2.10: download - view: text, markup, annotated - select for diffs
Thu Jul 14 19:08:22 2005 UTC (6 years, 6 months ago) by jhb
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.23.2.9: preferred, colored; branchpoint 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23.2.9: +28 -0 lines
MFC: Add the preadv() and pwritev() system calls.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Wed Jul 13 15:12:19 2005 UTC (6 years, 6 months ago) by jhb
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +6 -1 lines
Wrap the ia64-specific freebsd32_mmap_partial() hack in Giant for now
since it calls into VFS and VM.  This makes the freebsd32_mmap() routine
MP safe and the extra Giants here can be revisited later.

Glanced at by:	marcel
MFC after:	3 days

Revision 1.38: download - view: text, markup, annotated - select for diffs
Thu Jul 7 18:17:55 2005 UTC (6 years, 7 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +28 -0 lines
- Add two new system calls: preadv() and pwritev() which are like readv()
  and writev() except that they take an additional offset argument and do
  not change the current file position.  In SAT speak:
  preadv:readv::pread:read and pwritev:writev::pwrite:write.
- Try to reduce code duplication some by merging most of the old
  kern_foov() and dofilefoo() functions into new dofilefoo() functions
  that are called by kern_foov() and kern_pfoov().  The non-v functions
  now all generate a simple uio on the stack from the passed in arguments
  and then call kern_foov().  For example, read() now just builds a uio and
  calls kern_readv() and pwrite() just builds a uio and calls kern_pwritev().

PR:		kern/80362
Submitted by:	Marc Olzheim marcolz at stack dot nl (1)
Approved by:	re (scottl)
MFC after:	1 week

Revision 1.23.2.9: download - view: text, markup, annotated - select for diffs
Wed Jun 29 18:08:31 2005 UTC (6 years, 7 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.8: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.8: +66 -49 lines
MFC:
Wrap copyin/copyout for kevent so the 32bit wrapper does not have
to malloc nchanges * sizeof(struct kevent) AND/OR nevents *
sizeof(struct kevent) on every syscall.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Wed Jun 29 15:16:20 2005 UTC (6 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +5 -15 lines
- Change the commented out freebsd32_xxx() example to use kern_xxx() along
  with a single copyin() + translate and translate + copyout() rather than
  using the stackgap.
- Remove implementation of the stackgap for freebsd32 since it is no longer
  used for that compat ABI.

Approved by:	re (scottl)

Revision 1.36: download - view: text, markup, annotated - select for diffs
Fri Jun 24 17:41:28 2005 UTC (6 years, 7 months ago) by jhb
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +2 -1 lines
Correct the amount of data to allocate in these local copies of
exec_copyin_strings() to catch up to rev 1.266 of kern_exec.c.  This fixes
panics on amd64 with compat binaries since exec_free_args() was freeing
more memory than these functions were allocating and the mismatch could
cause memory to be freed out from under other concurrent execs.

Approved by:	re (scottl)

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sat Jun 11 14:58:20 2005 UTC (6 years, 8 months ago) by pjd
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +2 -6 lines
Do not allocate memory based on not-checked argument from userland.
It can be used to panic the kernel by giving too big value.
Fix it by moving allocation and size verification into kern_getfsstat().
This even simplifies kern_getfsstat() consumers, but destroys symmetry -
memory is allocated inside kern_getfsstat(), but has to be freed by the
caller.

Found by:	FreeBSD Kernel Stress Test Suite: http://www.holm.cc/stress/
Reported by:	Peter Holm <peter@holm.cc>

Revision 1.34: download - view: text, markup, annotated - select for diffs
Thu Jun 9 17:44:46 2005 UTC (6 years, 8 months ago) by pjd
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +19 -22 lines
Avoid code duplication in serval places by introducing universal
kern_getfsstat() function.

Obtained from:	jhb

Revision 1.33: download - view: text, markup, annotated - select for diffs
Fri Jun 3 23:15:01 2005 UTC (6 years, 8 months ago) by ps
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +66 -49 lines
Wrap copyin/copyout for kevent so the 32bit wrapper does not have
to malloc nchanges * sizeof(struct kevent) AND/OR nevents *
sizeof(struct kevent) on every syscall.

Glanced at by:	peter, jmg
Obtained from:	Yahoo!
MFC after:	2 weeks

Revision 1.23.2.8: download - view: text, markup, annotated - select for diffs
Tue May 24 17:53:27 2005 UTC (6 years, 8 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.7: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.7: +2 -2 lines
MFC: rev 1.32 copyout to userland if kern_sigaction succeeds

Revision 1.32: download - view: text, markup, annotated - select for diffs
Tue May 24 17:52:14 2005 UTC (6 years, 8 months ago) by ps
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +2 -2 lines
Copyout to userland if kern_sigaction succeeds

Revision 1.23.2.7: download - view: text, markup, annotated - select for diffs
Sat Apr 23 22:09:17 2005 UTC (6 years, 9 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.6: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.6: +63 -168 lines
MFC:
- Use kern_setitimer(), kern_getitimer(), kern_select(), kern_utimes(),
  kern_statfs(), kern_fstatfs(), kern_fhstatfs(), kern_stat(),
  kern_fstat(), and kern_lstat().

Revision 1.23.2.6: download - view: text, markup, annotated - select for diffs
Thu Apr 21 21:11:24 2005 UTC (6 years, 9 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.5: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.5: +31 -35 lines
MFC:
Use kern_kevent instead of the stackgap for 32bit syscall wrapping
and correct the freebsd32_kevent prototype.

Revision 1.23.2.5: download - view: text, markup, annotated - select for diffs
Thu Apr 21 20:33:04 2005 UTC (6 years, 9 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.4: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.4: +84 -122 lines
MFC:
kern_ntptime.c, kern_time.c, sys_generic.c p1003_1b.c, syscallsubr.h:
- Implement kern_adjtime(), kern_readv(),
  kern_sched_rr_get_interval(), kern_settimeofday(), and
  kern_writev() to allow for further stackgap reduction in
  the compat ABIs.

osf1_misc.c:
- Use a custom version of copyinuio() to implement
  osf1_{read,write}v() via kern_{read,write}v().

linux32_machdep.c:
- Use a custom version of copyinuio() to implement readv/writev using
  kern_readv/writev.
- Use kern_sched_rr_get_interval() rather than the stackgap.

freebsd32_misc.c:
- Use a custom version of copyinuio() to implement readv/writev using
  kern_readv/writev.
- Use kern_settimeofday() and kern_adjtime() rather than
  stackgapping it.

ibcs2_misc.c:
- Use kern_settimeofday() to avoid stackgap use.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Mar 31 22:58:13 2005 UTC (6 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +84 -123 lines
- Use a custom version of copyinuio() to implement readv/writev using
  kern_readv/writev.
- Use kern_settimeofday() and kern_adjtime() rather than stackgapping it.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Tue Mar 1 17:45:55 2005 UTC (6 years, 11 months ago) by ps
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +31 -35 lines
Use kern_kevent instead of the stackgap for 32bit syscall wrapping.

Submitted by:	jhb
Tested on:	amd64

Revision 1.29: download - view: text, markup, annotated - select for diffs
Tue Mar 1 13:50:57 2005 UTC (6 years, 11 months ago) by ps
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +2 -2 lines
Ooops.  I will compile test before committing.  The stackgap version
of kevent32 will be going away shortly, so this is temporary until
I commit the non-stackgap version.

Revision 1.23.2.4: download - view: text, markup, annotated - select for diffs
Tue Mar 1 09:30:15 2005 UTC (6 years, 11 months ago) by obrien
Branches: RELENG_5
CVS tags: RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.23.2.3: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.3: +17 -11 lines
Back out the rework of how we store process times in the kernel.
This changed the size of struct proc and thus broke the 5-STABLE kernel ABI.

Revision 1.23.2.3: download - view: text, markup, annotated - select for diffs
Mon Feb 28 09:26:11 2005 UTC (6 years, 11 months ago) by obrien
Branches: RELENG_5
Diff to: previous 1.23.2.2: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.2: +11 -17 lines
MFC: Rework how we store process times in the kernel such that we always
store the raw values including for child process statistics and only compute
the system and user timevals on demand.
(See the 2004-10-05 18:51:12 UTC jhb commit for full details.)

Revision 1.23.2.2: download - view: text, markup, annotated - select for diffs
Sun Feb 20 14:43:45 2005 UTC (6 years, 11 months ago) by ps
Branches: RELENG_5
Diff to: previous 1.23.2.1: preferred, colored; branchpoint 1.23: preferred, colored
Changes since revision 1.23.2.1: +31 -0 lines
MFC: Add 32bit compat syscall for nanosleep and MFC the 32bit compat
syscall for modstat.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Fri Feb 18 18:56:04 2005 UTC (6 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +159 -218 lines
- Add a custom version of exec_copyin_args() to deal with the 32-bit
  pointers in argv and envv in userland and use that together with
  kern_execve() and exec_free_args() to implement freebsd32_execve()
  without using the stackgap.
- Fix freebsd32_adjtime() to call adjtime() rather than utimes().  Still
  uses stackgap for now.
- Use kern_setitimer(), kern_getitimer(), kern_select(), kern_utimes(),
  kern_statfs(), kern_fstatfs(), kern_fhstatfs(), kern_stat(),
  kern_fstat(), and kern_lstat().

Tested by:	cokane (amd64)
Silence on:	amd64, ia64

Revision 1.23.2.1: download - view: text, markup, annotated - select for diffs
Sat Feb 5 01:02:49 2005 UTC (7 years ago) by das
Branches: RELENG_5
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +0 -2 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.27: download - view: text, markup, annotated - select for diffs
Wed Jan 19 17:44:59 2005 UTC (7 years ago) by ps
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +31 -0 lines
- rename nanosleep1 to kern_nanosleep
- Add a 32bit syscall entry for nanosleep

Reviewed by:	peter
Obtained from:	Yahoo!

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

Revision 1.25: 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.24: preferred, colored
Changes since revision 1.24: +3 -7 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.24: download - view: text, markup, annotated - select for diffs
Tue Oct 5 18:51:10 2004 UTC (7 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +11 -17 lines
Rework how we store process times in the kernel such that we always store
the raw values including for child process statistics and only compute the
system and user timevals on demand.

- Fix the various kern_wait() syscall wrappers to only pass in a rusage
  pointer if they are going to use the result.
- Add a kern_getrusage() function for the ABI syscalls to use so that they
  don't have to play stackgap games to call getrusage().
- Fix the svr4_sys_times() syscall to just call calcru() to calculate the
  times it needs rather than calling getrusage() twice with associated
  stackgap, etc.
- Add a new rusage_ext structure to store raw time stats such as tick counts
  for user, system, and interrupt time as well as a bintime of the total
  runtime.  A new p_rux field in struct proc replaces the same inline fields
  from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime).  A new p_crux
  field in struct proc contains the "raw" child time usage statistics.
  ruadd() has been changed to handle adding the associated rusage_ext
  structures as well as the values in rusage.  Effectively, the values in
  rusage_ext replace the ru_utime and ru_stime values in struct rusage.  These
  two fields in struct rusage are no longer used in the kernel.
- calcru() has been split into a static worker function calcru1() that
  calculates appropriate timevals for user and system time as well as updating
  the rux_[isu]u fields of a passed in rusage_ext structure.  calcru() uses a
  copy of the process' p_rux structure to compute the timevals after updating
  the runtime appropriately if any of the threads in that process are
  currently executing.  It also now only locks sched_lock internally while
  doing the rux_runtime fixup.  calcru() now only requires the caller to
  hold the proc lock and calcru1() only requires the proc lock internally.
  calcru() also no longer allows callers to ask for an interrupt timeval
  since none of them actually did.
- calcru() now correctly handles threads executing on other CPUs.
- A new calccru() function computes the child system and user timevals by
  calling calcru1() on p_crux.  Note that this means that any code that wants
  child times must now call this function rather than reading from p_cru
  directly.  This function also requires the proc lock.
- This finishes the locking for rusage and friends so some of the Giant locks
  in exit1() and kern_wait() are now gone.
- The locking in ttyinfo() has been tweaked so that a shared lock of the
  proctree lock is used to protect the process group rather than the process
  group lock.  By holding this lock until the end of the function we now
  ensure that the process/thread that we pick to dump info about will no
  longer vanish while we are trying to output its info to the console.

Submitted by:	bde (mostly)
MFC after:	1 month

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Jun 17 17:16:41 2004 UTC (7 years, 7 months ago) by phk
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +2 -2 lines
Second half of the dev_t cleanup.

The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sat Apr 24 04:31:59 2004 UTC (7 years, 9 months ago) by marcel
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +10 -0 lines
Fix build for non-COMPAT_FREEBSD4 configurations. Make the FreeBSD 4
statfs functions conditional upon the option.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Wed Apr 14 23:17:37 2004 UTC (7 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +32 -5 lines
Catch up to the not-so-recent statfs(2) changes.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Mar 17 19:59:59 2004 UTC (7 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +9 -13 lines
- Replace wait1() with a kern_wait() function that accepts the pid,
  options, status pointer and rusage pointer as arguments.  It is up to
  the caller to copyout the status and rusage to userland if needed.  This
  lets us axe the 'compat' argument and hide all that functionality in
  owait(), by the way.  This also cleans up some locking in kern_wait()
  since it no longer has to drop locks around copyout() since all the
  copyout()'s are deferred.
- Convert owait(), wait4(), and the various ABI compat wait() syscalls to
  use kern_wait() rather than wait1() or wait4().  This removes a bit
  more stackgap usage.

Tested on:	i386
Compiled on:	i386, alpha, amd64

Revision 1.19: download - view: text, markup, annotated - select for diffs
Wed Jan 28 23:45:48 2004 UTC (8 years ago) by peter
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +28 -0 lines
Regen

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Dec 23 03:20:49 2003 UTC (8 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +44 -52 lines
Rather than screw around with the (unsafe) stackgap, call vn_stat/fo_stat
directly for stat/fstat/lstat syscall emulation.  It turns out not only
safer, but the code is smaller this way too.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Dec 23 02:48:11 2003 UTC (8 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +0 -173 lines
Eliminate stackgap usage for the (woefully incomplete) path translations
since it isn't needed here anymore.
Use standard open(2)/access(2) and chflags(2) syscalls now.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Thu Dec 11 02:34:49 2003 UTC (8 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +13 -21 lines
Just implementing a 32 bit version of gettimeofday() was smaller than
the wrapper code.  And it doesn't use the stackgap as a bonus.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Fri Nov 7 21:27:13 2003 UTC (8 years, 3 months ago) by peter
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.14: preferred, colored
Changes since revision 1.14: +9 -3 lines
Dont write to the stackgap directly in execve().

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu Oct 30 02:40:30 2003 UTC (8 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +21 -0 lines
Add CTASSERT()'s to check that the sizes of our replicas of the 32 bit
structures come out the right size.

Fix the ones that broke.  stat32 had some missing fields from the end
and statfs32 was broken due to the strange definition of MNAMELEN
(which is dependent on sizeof(long))

I'm not sure if this fixes any actual problems or not.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sat Aug 23 00:04:52 2003 UTC (8 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +0 -2 lines
Switch to using the emulator in the common compat area.
Still work-in-progress.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Fri Aug 22 23:07:28 2003 UTC (8 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +72 -69 lines
Initial sweep to de-i386-ify this

Revision 1.11: download - view: text, markup, annotated - select for diffs
Fri Jul 25 21:16:26 2003 UTC (8 years, 6 months ago) by obrien
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -2 lines
Use __FBSDID().

Brought to you by:	a boring talk at Ottawa Linux Symposium

Revision 1.10: download - view: text, markup, annotated - select for diffs
Wed May 14 04:10:48 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
CVS tags: old_RELENG_5_1_BP, old_RELENG_5_1_0_RELEASE, old_RELENG_5_1
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +113 -3 lines
Add BASIC i386 binary support for the amd64 kernel.  This is largely
stolen from the ia64/ia32 code (indeed there was a repocopy), but I've
redone the MD parts and added and fixed a few essential syscalls.  It
is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic)
and p4.  The ia64 code has not implemented signal delivery, so I had
to do that.

Before you say it, yes, this does need to go in a common place.  But
we're in a freeze at the moment and I didn't want to risk breaking ia64.
I will sort this out after the freeze so that the common code is in a
common place.

On the AMD64 side, this required adding segment selector context switch
support and some other support infrastructure.  The %fs/%gs etc code
is hairy because loading %gs will clobber the kernel's current MSR_GSBASE
setting.  The segment selectors are not used by the kernel, so they're only
changed at context switch time or when changing modes.  This still needs
to be optimized.

Approved by:	re (amd64/* blanket)

Revision 1.9: download - view: text, markup, annotated - select for diffs
Tue Apr 22 18:23:49 2003 UTC (8 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +33 -66 lines
- Replace inline implementations of sigprocmask() with calls to
  kern_sigprocmask() in the various binary compatibility emulators.
- Replace calls to sigsuspend(), sigaltstack(), sigaction(), and
  sigprocmask() that used the stackgap with calls to the corresponding
  kern_sig*() functions instead without using the stackgap.

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

Approved by: trb

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sun Feb 16 14:11:52 2003 UTC (8 years, 11 months ago) by phk
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +0 -1 lines
Remove #include <sys/dkstat.h>

Revision 1.6: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:55:52 2003 UTC (9 years ago) by alfred
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +5 -5 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.2.2.1: download - view: text, markup, annotated - select for diffs
Thu Dec 19 09:40:09 2002 UTC (9 years, 1 month ago) by alfred
Branches: old_old_RELENG_5_0
CVS tags: old_old_RELENG_5_0_0_RELEASE
Diff to: previous 1.2: preferred, colored; next MAIN 1.3: preferred, colored
Changes since revision 1.2: +128 -128 lines
MFC: SCARGS and syscallargs removal.

Approved by: re@ (rwatson)

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sat Dec 14 01:56:25 2002 UTC (9 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +128 -128 lines
SCARGS removal take II.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Fri Dec 13 22:41:46 2002 UTC (9 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +128 -128 lines
Backout removal SCARGS, the code freeze is only "selectively" over.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Fri Dec 13 22:27:24 2002 UTC (9 years, 1 month ago) by alfred
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +128 -128 lines
Remove SCARGS.

Reviewed by: md5

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed Oct 9 22:27:24 2002 UTC (9 years, 4 months ago) by peter
Branches: MAIN
CVS tags: old_old_RELENG_5_0_BP
Branch point for: old_old_RELENG_5_0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +21 -0 lines
Try and deal with the #ifdef COMPAT_FREEBSD4 sendfile stuff.  This would
have been a lot easier if do_sendfile() was usable externally.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sat Jul 20 02:56:10 2002 UTC (9 years, 6 months ago) by peter
Branches: MAIN
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).

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