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

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

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

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.224: download - view: text, markup, annotated - select for diffs
Mon Jan 30 07:56:00 2012 UTC (10 days, 17 hours ago) by kib
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +6 -1 lines
SVN rev 230767 on 2012-01-30 07:56:00Z by kib

Finally, try to enable the nxstacks on amd64 and powerpc64 for both 64bit
and 32bit ABIs. Also try to enable nxstacks for PAE/i386 when supported,
and some variants of powerpc32.

MFC after:	2 months (if ever)

Revision 1.223: download - view: text, markup, annotated - select for diffs
Tue Jan 17 16:20:50 2012 UTC (3 weeks, 2 days ago) by alc
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +3 -0 lines
SVN rev 230268 on 2012-01-17 16:20:50Z by alc

Explain why it is safe to unlock the vnode.

Requested by:	kib

Revision 1.222: download - view: text, markup, annotated - select for diffs
Tue Jan 17 00:27:32 2012 UTC (3 weeks, 3 days ago) by alc
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +25 -26 lines
SVN rev 230246 on 2012-01-17 00:27:32Z by alc

Improve abstraction.  Eliminate direct access by elf*_load_section()
to an OBJT_VNODE-specific field of the vm object.  The same
information can be just as easily obtained from the struct vattr that
is in struct image_params if the latter is passed to
elf*_load_section().  Moreover, by replacing the vmspace and vm
object parameters to elf*_load_section() with a struct image_params
parameter, we actually reduce the size of the object code.

In collaboration with:	kib

Revision 1.221: download - view: text, markup, annotated - select for diffs
Sun Jan 15 13:23:18 2012 UTC (3 weeks, 4 days ago) by uqs
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +1 -1 lines
SVN rev 230132 on 2012-01-15 13:23:18Z by uqs

Convert files to UTF-8

Revision 1.218.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.218.2.1: preferred, colored; next MAIN 1.219: preferred, colored
Changes since revision 1.218.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.220: 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.219: preferred, colored
Changes since revision 1.219: +9 -1 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.219: download - view: text, markup, annotated - select for diffs
Thu Oct 13 16:16:46 2011 UTC (3 months, 4 weeks ago) by marcel
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +6 -0 lines
SVN rev 226342 on 2011-10-13 16:16:46Z by marcel

In elf32_trans_prot() and when compiling for amd64 or ia64, add
PROT_EXECUTE when PROT_READ is needed. By default i386 allows
execution when reading is allowed and JDK 1.4.x depends on that.

Revision 1.218.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.218: preferred, colored; next MAIN 1.219: preferred, colored
Changes since revision 1.218: +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.218: download - view: text, markup, annotated - select for diffs
Wed Jul 6 20:06:44 2011 UTC (7 months ago) by trasz
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +2 -0 lines
SVN rev 223825 on 2011-07-06 20:06:44Z by trasz

All the racct_*() calls need to happen with the proc locked.  Fixing this
won't happen before 9.0.  This commit adds "#ifdef RACCT" around all the
"PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order
to avoid useless locking/unlocking in kernels built without "options RACCT".

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

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

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

Revision 1.216: download - view: text, markup, annotated - select for diffs
Tue Apr 5 20:23:59 2011 UTC (10 months ago) by trasz
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +11 -1 lines
SVN rev 220373 on 2011-04-05 20:23:59Z by trasz

Add accounting for most of the memory-related resources.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib (earlier version)

Revision 1.215: download - view: text, markup, annotated - select for diffs
Wed Feb 2 16:35:10 2011 UTC (12 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +1 -2 lines
SVN rev 218195 on 2011-02-02 16:35:10Z by mdf

Put the general logic for being a CPU hog into a new function
should_yield().  Use this in various places.  Encapsulate the common
case of check-and-yield into a new function maybe_yield().

Change several checks for a magic number of iterations to use
should_yield() instead.

MFC after:	1 week

Revision 1.197.2.9: download - view: text, markup, annotated - select for diffs
Sat Jan 15 09:25:19 2011 UTC (12 months, 3 weeks ago) by kib
Branches: RELENG_8
Diff to: previous 1.197.2.8: preferred, colored; branchpoint 1.197: preferred, colored; next MAIN 1.198: preferred, colored
Changes since revision 1.197.2.8: +35 -22 lines
SVN rev 217442 on 2011-01-15 09:25:19Z by kib

MFC r217150:
Collect code to translate between vm_prot_t and p_flags into helper
functions.

Revision 1.214: download - view: text, markup, annotated - select for diffs
Sat Jan 8 18:41:19 2011 UTC (13 months ago) by kib
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +3 -2 lines
SVN rev 217160 on 2011-01-08 18:41:19Z by kib

Use the same expression to report stack protection mode for AT_STACKEXEC
as the expression used by exec_new_vmspace().

Revision 1.213: download - view: text, markup, annotated - select for diffs
Sat Jan 8 16:30:59 2011 UTC (13 months ago) by kib
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +17 -5 lines
SVN rev 217152 on 2011-01-08 16:30:59Z by kib

In elf image activator, read and apply the stack protection mode from
PT_GNU_STACK program header, if present and enabled. Two new sysctls
are provided, kern.elf32.nxstack and kern.elf64.nxstack, that allow to
enable PT_GNU_STACK for ABIs of specified bitsize, if ABI decided to
support shared page.

Inform rtld about access mode of the stack initial mapping by
AT_STACKPROT aux vector.

At the moment, the default is disabled, waiting for the usermode
support bits.

Revision 1.212: download - view: text, markup, annotated - select for diffs
Sat Jan 8 16:02:14 2011 UTC (13 months ago) by kib
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +35 -22 lines
SVN rev 217150 on 2011-01-08 16:02:14Z by kib

Collect code to translate between vm_prot_t and p_flags into helper
functions.

MFC after:	1 week

Revision 1.197.2.8: download - view: text, markup, annotated - select for diffs
Mon Dec 27 12:39:24 2010 UTC (13 months, 2 weeks ago) by attilio
Branches: RELENG_8
Diff to: previous 1.197.2.7: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.7: +10 -0 lines
SVN rev 216734 on 2010-12-27 12:39:24Z by attilio

MFC r215679:
Add the ability for GDB to printout the thread name along with other thread
specific informations.
In order to achieve that, for both on-line debugging and core analysis,
a new member to PT_LWPINFO ptrace(2) interface is added and a new
ELF note (NT_THRMISC) as well.

Sponsored by:	Sandvine Incorporated

Revision 1.178.2.14.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.178.2.14: preferred, colored; next MAIN 1.179: preferred, colored
Changes since revision 1.178.2.14: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

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

Approved by:	re (implicit)

Revision 1.197.2.7.4.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.197.2.7: preferred, colored; next MAIN 1.197.2.8: preferred, colored
Changes since revision 1.197.2.7: +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.211: download - view: text, markup, annotated - select for diffs
Mon Nov 22 14:42:13 2010 UTC (14 months, 2 weeks ago) by attilio
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +10 -0 lines
SVN rev 215679 on 2010-11-22 14:42:13Z by attilio

Add the ability for GDB to printout the thread name along with other
thread specific informations.

In order to do that, and in order to avoid KBI breakage with existing
infrastructure the following semantic is implemented:
- For live programs, a new member to the PT_LWPINFO is added (pl_tdname)
- For cores, a new ELF note is added (NT_THRMISC) that can be used for
  storing thread specific, miscellaneous, informations. Right now it is
  just popluated with a thread name.

GDB, then, retrieves the correct informations from the corefile via the
BFD interface, as it groks the ELF notes and create appropriate
pseudo-sections.

Sponsored by:	Sandvine Incorporated
Tested by:	gianni
Discussed with:	dim, kan, kib
MFC after:	2 weeks

Revision 1.210: 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.209: preferred, colored
Changes since revision 1.209: +11 -0 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.197.2.7.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.197.2.7: preferred, colored; next MAIN 1.197.2.8: preferred, colored
Changes since revision 1.197.2.7: +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.209: download - view: text, markup, annotated - select for diffs
Fri Apr 30 03:13:24 2010 UTC (21 months, 1 week ago) by alfred
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +7 -4 lines
SVN rev 207416 on 2010-04-30 03:13:24Z by alfred

Don't leak core_buf or gzfile if doing a compressed core file and we
hit an error condition.

Obtained from: Juniper Networks

Revision 1.197.2.7: download - view: text, markup, annotated - select for diffs
Wed Apr 7 02:24:41 2010 UTC (22 months ago) by nwhitehorn
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP
Branch point for: RELENG_8_2, RELENG_8_1
Diff to: previous 1.197.2.6: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.6: +6 -9 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.208: download - view: text, markup, annotated - select for diffs
Thu Mar 25 14:31:26 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +1 -0 lines
SVN rev 205643 on 2010-03-25 14:31:26Z by nwhitehorn

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

Revision 1.207: download - view: text, markup, annotated - select for diffs
Thu Mar 25 14:21:22 2010 UTC (22 months, 2 weeks ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +6 -11 lines
SVN rev 205641 on 2010-03-25 14:21:22Z by nwhitehorn

Change the way text_addr and data_addr are computed to use the
executable status of segments instead of detecting the main text segment
by which segment contains the program entry point. This affects
obreak() and is required for correct operation of that function
on 64-bit PowerPC systems. The previous behavior was apparently
required only for the Alpha, which is no longer supported.

Reviewed by:	jhb
Tested on:	amd64, sparc64, powerpc

Revision 1.206: 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.205: preferred, colored
Changes since revision 1.205: +6 -9 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.205: download - view: text, markup, annotated - select for diffs
Thu Mar 4 21:53:45 2010 UTC (23 months, 1 week ago) by alfred
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +1 -1 lines
SVN rev 204737 on 2010-03-04 21:53:45Z by alfred

put calls to gzclose() under ifdef COMPRESS_USER_CORES to prevent
undefined symbols on kernels without this option.

Reported by: Alexander Best

Revision 1.204: download - view: text, markup, annotated - select for diffs
Tue Mar 2 06:58:58 2010 UTC (23 months, 1 week ago) by alfred
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +156 -16 lines
SVN rev 204552 on 2010-03-02 06:58:58Z by alfred

Merge projects/enhanced_coredumps (r204346) into HEAD:

  Enhanced process coredump routines.

  This brings in the following features:
  1) Limit number of cores per process via the %I coredump formatter.
  Example:
    if corefilename is set to %N.%I.core AND num_cores = 3, then
    if a process "rpd" cores, then the corefile will be named
    "rpd.0.core", however if it cores again, then the kernel will
    generate "rpd.1.core" until we hit the limit of "num_cores".

    this is useful to get several corefiles, but also prevent filling
    the machine with corefiles.

  2) Encode machine hostname in core dump name via %H.

  3) Compress coredumps, useful for embedded platforms with limited space.
    A sysctl kern.compress_user_cores is made available if turned on.

    To enable compressed coredumps, the following config options need to be set:
    options COMPRESS_USER_CORES
    device zlib   # brings in the zlib requirements.
    device gzio   # brings in the kernel vnode gzip output module.

  4) Eventhandlers are fired to indicate coredumps in progress.

  5) The imgact sv_coredump routine has grown a flag to pass in more
  state, currently this is used only for passing a flag down to compress
  the coredump or not.

  Note that the gzio facility can be used for generic output of gzip'd
  streams via vnodes.

Obtained from: Juniper Networks
Reviewed by: kan

Revision 1.178.2.14.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.178.2.14: preferred, colored; next MAIN 1.179: preferred, colored
Changes since revision 1.178.2.14: +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.178.2.14: download - view: text, markup, annotated - select for diffs
Tue Jan 19 19:59:03 2010 UTC (2 years ago) by kib
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.178.2.13: preferred, colored; branchpoint 1.178: preferred, colored; next MAIN 1.179: preferred, colored
Changes since revision 1.178.2.13: +20 -5 lines
SVN rev 202646 on 2010-01-19 19:59:03Z by kib

MFC r198202:
If ET_DYN binary has non-zero base address for some reason, honour it
and do not relocate the binary to ET_DYN_LOAD_ADDR. Communicate the
relocation bias of the mapping for interpeter-less ET_DYN binary.

Tested by:	Mykola Dzham <i levsha me>

Revision 1.178.2.13: download - view: text, markup, annotated - select for diffs
Tue Jan 19 19:56:50 2010 UTC (2 years ago) by kib
Branches: RELENG_7
Diff to: previous 1.178.2.12: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.12: +14 -10 lines
SVN rev 202645 on 2010-01-19 19:56:50Z by kib

MFC r197934:
Map PIE binaries at non-zero base address.

Tested by:	Mykola Dzham <i levsha me>

Revision 1.178.2.12: download - view: text, markup, annotated - select for diffs
Tue Jan 19 19:54:18 2010 UTC (2 years ago) by kib
Branches: RELENG_7
Diff to: previous 1.178.2.11: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.11: +4 -1 lines
SVN rev 202644 on 2010-01-19 19:54:18Z by kib

MFC r197932:
Do not map segments of zero length.

Tested by:	Mykola Dzham <i levsha me>

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

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

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

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

Revision 1.178.2.10: download - view: text, markup, annotated - select for diffs
Tue Dec 22 19:51:49 2009 UTC (2 years, 1 month ago) by kib
Branches: RELENG_7
Diff to: previous 1.178.2.9: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.9: +0 -3 lines
SVN rev 200858 on 2009-12-22 19:51:49Z by kib

MFC r186212 (by imp):
AT_DEBUG and AT_BRK were OBE like 10 years ago, so retire them.

MFC r186225:
Remove two remnant uses of AT_DEBUG.

Revision 1.197.2.6: download - view: text, markup, annotated - select for diffs
Sat Dec 5 20:40:28 2009 UTC (2 years, 2 months ago) by bz
Branches: RELENG_8
Diff to: previous 1.197.2.5: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.5: +4 -1 lines
SVN rev 200164 on 2009-12-05 20:40:28Z by bz

MFC r197726:

  Print a warning in case we cannot add more brandinfo because
  we would overflow the MAX_BRANDS sized array.

Reviewed by:	kib

Revision 1.197.2.5.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.197.2.5: preferred, colored; next MAIN 1.197.2.6: preferred, colored
Changes since revision 1.197.2.5: +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.197.2.5: download - view: text, markup, annotated - select for diffs
Tue Oct 20 13:34:41 2009 UTC (2 years, 3 months ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.197.2.4: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.4: +32 -13 lines
SVN rev 198284 on 2009-10-20 13:34:41Z by kib

MFC r197934:
Map PIE binaries at non-zero base address.

MFC r198202:
Honour non-zero mapbase for PIE binaries. Inform interpreter-less PIE
binary about its relocbase.

Approved by:	re (kensmith)

Revision 1.197.2.4: download - view: text, markup, annotated - select for diffs
Tue Oct 20 13:30:06 2009 UTC (2 years, 3 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.197.2.3: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.3: +4 -1 lines
SVN rev 198281 on 2009-10-20 13:30:06Z by kib

MFC r197932:
Do not map elf segments of zero length.

Approved by:	re (kensmith)

Revision 1.203: download - view: text, markup, annotated - select for diffs
Sun Oct 18 12:57:48 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +20 -5 lines
SVN rev 198202 on 2009-10-18 12:57:48Z by kib

If ET_DYN binary has non-zero base address for some reason, honour it
and do not relocate the binary to ET_DYN_LOAD_ADDR. This allows for the
binary author to influence address map of the process. In particular,
when the binary is actually an interpeter, this allows to have almost
usual process address map.

Communicate the relocation bias of the mapping for interpeter-less
ET_DYN binary, that is interperter itself, in AT_BASE aux entry. This
way, rtld is able to find its dynamic structure and relocate itself.
Note that mapbase in the rtld is still wrong and requires further
fixing.

Reported and tested by:	rwatson
Discussed with:	kan
MFC after:	3 days

Revision 1.202: download - view: text, markup, annotated - select for diffs
Sat Oct 10 15:33:01 2009 UTC (2 years, 4 months ago) by kib
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +14 -10 lines
SVN rev 197934 on 2009-10-10 15:33:01Z by kib

Map PIE binaries at non-zero base address.

Discussed with:	bz
Reviewed by:	kan
Tested by:	bz (i386, amd64), bsam (linux)
MFC after:	some time

Revision 1.201: download - view: text, markup, annotated - select for diffs
Sat Oct 10 15:28:52 2009 UTC (2 years, 4 months ago) by kib
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +4 -1 lines
SVN rev 197932 on 2009-10-10 15:28:52Z by kib

Do not map segments of zero length.

Discussed with:	bz
Reviewed by:	kan
Tested by:	bz (i386, amd64), bsam (linux)
MFC after:	some time

Revision 1.200: download - view: text, markup, annotated - select for diffs
Sat Oct 3 10:50:00 2009 UTC (2 years, 4 months ago) by bz
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +4 -1 lines
SVN rev 197726 on 2009-10-03 10:50:00Z by bz

Print a warning in case we cannot add more brandinfo because
we would overflow the MAX_BRANDS sized array.

Reviewed by:	kib
MFC After:	1 month

Revision 1.178.2.9: download - view: text, markup, annotated - select for diffs
Mon Sep 7 13:37:04 2009 UTC (2 years, 5 months ago) by bz
Branches: RELENG_7
Diff to: previous 1.178.2.8: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.8: +13 -5 lines
SVN rev 196924 on 2009-09-07 13:37:04Z by bz

MFC r196653:
  Make sure FreeBSD binaries without .note.ABI-tag section work
  correctly and do not match a colliding Debian GNU/kFreeBSD
  brandinfo statements.
  For this mark the Debian GNU/kFreeBSD brandinfo that it must have
  an .note.ABI-tag section and ignore the old EI_OSABI brandinfo
  when comparing a possibly colliding set of options.

  Due to SYSINIT we add the brandinfo in a non-deterministic order,
  so native FreeBSD is not always first. We may want to consider
  to force native FreeBSD to come first as well.

  The only way a problem could currently be noticed is when running an
  i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD
  brandinfo  was matched first,  as the fallback to ld-elf32.so.1 does
  not exist in that case.

Reported and tested by:	ticso
In collaboration with:	kib

Revision 1.197.2.3: download - view: text, markup, annotated - select for diffs
Wed Sep 2 10:39:46 2009 UTC (2 years, 5 months ago) by bz
Branches: RELENG_8
Diff to: previous 1.197.2.2: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.2: +13 -5 lines
SVN rev 196761 on 2009-09-02 10:39:46Z by bz

MFC r196653:
  Make sure FreeBSD binaries without .note.ABI-tag section work
  correctly and do not match a colliding Debian GNU/kFreeBSD
  brandinfo statements.
  For this mark the Debian GNU/kFreeBSD brandinfo that it must have
  an .note.ABI-tag section and ignore the old EI_OSABI brandinfo
  when comparing a possibly colliding set of options.

  Due to SYSINIT we add the brandinfo in a non-deterministic order,
  so native FreeBSD is not always first. We may want to consider
  to force native FreeBSD to come first as well.

  The only way a problem could currently be noticed is when running an
  i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD
  brandinfo  was matched first,  as the fallback to ld-elf32.so.1 does
  not exist in that case.

Reported and tested by:	ticso
In collaboration with:	kib
MFC after:		3 days
Approved by:		re (rwatson)

Revision 1.199: download - view: text, markup, annotated - select for diffs
Sun Aug 30 14:38:17 2009 UTC (2 years, 5 months ago) by bz
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +13 -5 lines
SVN rev 196653 on 2009-08-30 14:38:17Z by bz

Make sure FreeBSD binaries without .note.ABI-tag section work
correctly and do not match a colliding Debian GNU/kFreeBSD
brandinfo statements.
For this mark the Debian GNU/kFreeBSD brandinfo that it must have
an .note.ABI-tag section and ignore the old EI_OSABI brandinfo
when comparing a possibly colliding set of options.

Due to SYSINIT we add the brandinfo in a non-deterministic order,
so native FreeBSD is not always first. We may want to consider
to force native FreeBSD to come first as well.

The only way a problem could currently be noticed is when running an
i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD
brandinfo  was matched first,  as the fallback to ld-elf32.so.1 does
not exist in that case.

Reported and tested by:	ticso
In collaboration with:	kib
MFC after:		3 days

Revision 1.178.2.8: download - view: text, markup, annotated - select for diffs
Thu Aug 27 17:36:59 2009 UTC (2 years, 5 months ago) by bz
Branches: RELENG_7
Diff to: previous 1.178.2.7: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.7: +54 -6 lines
SVN rev 196602 on 2009-08-27 17:36:59Z by bz

MFC r196512:

  Fix handling of .note.ABI-tag section for GNU systems [1].
  Handle GNU/Linux according to LSB Core Specification 4.0,
  Chapter 11. Object Format, 11.8. ABI note tag.

  Also check the first word of desc, not only name, according to
  glibc abi-tags specification to distinguish between Linux and
  kFreeBSD.

  Add explicit handling for Debian GNU/kFreeBSD, which runs
  on our kernels as well [2].

  In {amd64,i386}/trap.c, when checking osrel of the current process,
  also check the ABI to not change the signal behaviour for Linux
  binary processes, now that we save an osrel version for all three
  from the lists above in struct proc [2] (slightly different to HEAD).

  These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
  and Linux binaries on the same machine again for at least i386 and
  amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).

PR:		kern/135468
Submitted by:	dchagin [1] (initial patch)
Suggested by:	kib [2]
Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
Reviewed by:	kib

Revision 1.197.2.2: download - view: text, markup, annotated - select for diffs
Thu Aug 27 17:34:13 2009 UTC (2 years, 5 months ago) by bz
Branches: RELENG_8
Diff to: previous 1.197.2.1: preferred, colored; branchpoint 1.197: preferred, colored
Changes since revision 1.197.2.1: +54 -6 lines
SVN rev 196601 on 2009-08-27 17:34:13Z by bz

MFC r196512:

  Fix handling of .note.ABI-tag section for GNU systems [1].
  Handle GNU/Linux according to LSB Core Specification 4.0,
  Chapter 11. Object Format, 11.8. ABI note tag.

  Also check the first word of desc, not only name, according to
  glibc abi-tags specification to distinguish between Linux and
  kFreeBSD.

  Add explicit handling for Debian GNU/kFreeBSD, which runs
  on our kernels as well [2].

  In {amd64,i386}/trap.c, when checking osrel of the current process,
  also check the ABI to not change the signal behaviour for Linux
  binary processes, now that we save an osrel version for all three
  from the lists above in struct proc [2].

  These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
  and Linux binaries on the same machine again for at least i386 and
  amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).

PR:		kern/135468
Submitted by:	dchagin [1] (initial patch)
Suggested by:	kib [2]
Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
Reviewed by:	kib
Approved by:	re (kensmith)

Revision 1.198: download - view: text, markup, annotated - select for diffs
Mon Aug 24 16:19:47 2009 UTC (2 years, 5 months ago) by bz
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +54 -6 lines
SVN rev 196512 on 2009-08-24 16:19:47Z by bz

Fix handling of .note.ABI-tag section for GNU systems [1].
Handle GNU/Linux according to LSB Core Specification 4.0,
Chapter 11. Object Format, 11.8. ABI note tag.

Also check the first word of desc, not only name, according to
glibc abi-tags specification to distinguish between Linux and
kFreeBSD.

Add explicit handling for Debian GNU/kFreeBSD, which runs
on our kernels as well [2].

In {amd64,i386}/trap.c, when checking osrel of the current process,
also check the ABI to not change the signal behaviour for Linux
binary processes, now that we save an osrel version for all three
from the lists above in struct proc [2].

These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
and Linux binaries on the same machine again for at least i386 and
amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).

PR:		kern/135468
Submitted by:	dchagin [1] (initial patch)
Suggested by:	kib [2]
Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
Reviewed by:	kib
MFC after:	3 days

Revision 1.197.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.197: preferred, colored
Changes since revision 1.197: +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.178.2.6.2.2: download - view: text, markup, annotated - select for diffs
Fri Apr 17 17:05:31 2009 UTC (2 years, 9 months ago) by dchagin
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.178.2.6.2.1: preferred, colored; branchpoint 1.178.2.6: preferred, colored; next MAIN 1.178.2.7: preferred, colored
Changes since revision 1.178.2.6.2.1: +1 -1 lines
SVN rev 191213 on 2009-04-17 17:05:31Z by dchagin

Merge r190708 from HEAD to releng/7.2:
Fix KBI breakage by r190520 which affects older linux.ko binaries:

1) Move the new field (brand_note) to the end of the Brandinfo structure.
2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer
   is valid.
3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old
   modules won't have the flag set, so the new field brand_note would be
   ignored.

Suggested by:   jhb
Reviewed by:    jhb

Approved by:	re (Ken Smith), kib (mentor)

Revision 1.178.2.7: download - view: text, markup, annotated - select for diffs
Fri Apr 17 16:42:57 2009 UTC (2 years, 9 months ago) by dchagin
Branches: RELENG_7
Diff to: previous 1.178.2.6: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.6: +1 -1 lines
SVN rev 191210 on 2009-04-17 16:42:57Z by dchagin

Merge r190708 from HEAD to stable/7:
Fix KBI breakage by r190520 which affects older linux.ko binaries:

1) Move the new field (brand_note) to the end of the Brandinfo structure.
2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer
   is valid.
3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old
   modules won't have the flag set, so the new field brand_note would be
   ignored.

Suggested by:   jhb
Reviewed by:	jhb
Approved by:	re (Ken Smith), kib (mentor)

Revision 1.178.2.6.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
Diff to: previous 1.178.2.6: preferred, colored
Changes since revision 1.178.2.6: +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.197: download - view: text, markup, annotated - select for diffs
Sun Apr 5 09:27:19 2009 UTC (2 years, 10 months ago) by dchagin
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +1 -1 lines
SVN rev 190708 on 2009-04-05 09:27:19Z by dchagin

Fix KBI breakage by r190520 which affects older linux.ko binaries:

1) Move the new field (brand_note) to the end of the Brandinfo structure.
2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer
   is valid.
3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old
   modules won't have the flag set, so the new field brand_note would be
   ignored.

Suggested by:	jhb
Reviewed by:	jhb
Approved by:	kib (mentor)
MFC after:	6 days

Revision 1.178.2.6: download - view: text, markup, annotated - select for diffs
Sun Mar 29 08:07:36 2009 UTC (2 years, 10 months ago) by dchagin
Branches: RELENG_7
CVS tags: RELENG_7_2_BP
Branch point for: RELENG_7_2
Diff to: previous 1.178.2.5: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.5: +101 -51 lines
SVN rev 190520 on 2009-03-29 08:07:36Z by dchagin

Merge from head to stable/7:

r189771:
Implement new way of branding ELF binaries by looking to a
".note.ABI-tag" section.

The search order of a brand is changed, now first of all the
".note.ABI-tag" is looked through.

Move code which fetch osreldate for ELF binary to check_note() handler.

r189919:
Use the properly sized types for ELF object header and program headers.
This fixes osrel fetching from the FreeBSD branding note for the 64bit
platforms (bug introduced by r189771).

r190264:
Fix several issues with parsing the notes for ELF objects.

Badly formed ELF note may cause the caclulated pointer to the next note
to point both after the note region, that was checked in the code, but
also to point before the region, that was not checked [1]. Remember the
first note location in note0 and leap out if the note is not between
note0 and note_end.

In the similar way, badly formed note may cause infinite loop by
pointing next note into the same or previous note. Guard against this
by
limiting amount of loop iterations by arbitrary choosen big number.

For clarity, check the calculated note alignment in each iteration.

PR:     kern/132886
Approved by:	re(Ken Smith)

Revision 1.196: download - view: text, markup, annotated - select for diffs
Sun Mar 22 13:42:41 2009 UTC (2 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +5 -5 lines
SVN rev 190264 on 2009-03-22 13:42:41Z by kib

Fix several issues with parsing the notes for ELF objects.

Badly formed ELF note may cause the caclulated pointer to the next note
to point both after the note region, that was checked in the code, but
also to point before the region, that was not checked [1]. Remember the
first note location in note0 and leap out if the note is not between
note0 and note_end.

In the similar way, badly formed note may cause infinite loop by
pointing next note into the same or previous note. Guard against this by
limiting amount of loop iterations by arbitrary choosen big number.

For clarity, check the calculated note alignment in each iteration.

Reported by:	Chris Palmer <chris noncombatant org> [1]
PR:	kern/132886
Reviewed and tested by:	dchagin
MFC after:	3 days

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

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

Tested by:	pho
Reviewed by:	kan

Revision 1.194: download - view: text, markup, annotated - select for diffs
Tue Mar 17 09:50:40 2009 UTC (2 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +4 -4 lines
SVN rev 189919 on 2009-03-17 09:50:40Z by kib

Use the properly sized types for ELF object header and program headers.
This fixes osrel fetching from the FreeBSD branding note for the 64bit
platforms.

Reported by:	swell.k gmail com
Reviewed by:	dchagin
Tested by:	dchagin, swell.k gmail com

Revision 1.193: download - view: text, markup, annotated - select for diffs
Fri Mar 13 16:40:51 2009 UTC (2 years, 10 months ago) by dchagin
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +101 -51 lines
SVN rev 189771 on 2009-03-13 16:40:51Z by dchagin

Implement new way of branding ELF binaries by looking to a
".note.ABI-tag" section.

The search order of a brand is changed, now first of all the
".note.ABI-tag" is looked through.

Move code which fetch osreldate for ELF binary to check_note() handler.

PR:		118473
Approved by:	kib (mentor)

Revision 1.178.2.5: download - view: text, markup, annotated - select for diffs
Sun Mar 1 22:48:18 2009 UTC (2 years, 11 months ago) by rwatson
Branches: RELENG_7
Diff to: previous 1.178.2.4: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.4: +2 -1 lines
SVN rev 189255 on 2009-03-01 22:48:18Z by rwatson

Merge r187686 from head to stable/7:

  When a statically linked binary is executed (or at least, one without
  an interpreter definition in its program header), set the auxiliary
  ELF argument AT_BASE to 0 rather than to the address that we would
  have mapped the interpreter at if there had been one.

  The ELF ABI specifications appear to be ambiguous as to the desired
  behavior in this situation, as they define AT_BASE as the base address
  of the interpreter, but do not mention what to do if there is none.
  On Solaris, AT_BASE will be set to the base address of the static
  binary if there is no interpreter, and on Linux, AT_BASE is set to 0.
  We go with the Linux semantics as they are of more immediate utility
  and allow the early runtime environment to know that the kernel has
  not mapped an interpreter, but because AT_PHDR points at the ELF
  header for the running binary, it is still possible to retrieve all
  required mapping information when the process starts should it be
  required.  Either approach would be preferable to our current behavior
  of passing a pointer to an unmapped region of user memory as AT_BASE.

  Sponsored by:	Google

Revision 1.192: download - view: text, markup, annotated - select for diffs
Sun Jan 25 12:07:43 2009 UTC (3 years ago) by rwatson
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +2 -1 lines
SVN rev 187686 on 2009-01-25 12:07:43Z by rwatson

When a statically linked binary is executed (or at least, one without
an interpreter definition in its program header), set the auxiliary
ELF argument AT_BASE to 0 rather than to the address that we would
have mapped the interpreter at if there had been one.

The ELF ABI specifications appear to be ambiguous as to the desired
behavior in this situation, as they define AT_BASE as the base address
of the interpreter, but do not mention what to do if there is none.
On Solaris, AT_BASE will be set to the base address of the static
binary if there is no interpreter, and on Linux, AT_BASE is set to 0.
We go with the Linux semantics as they are of more immediate utility
and allow the early runtime environment to know that the kernel has
not mapped an interpreter, but because AT_PHDR points at the ELF
header for the running binary, it is still possible to retrieve all
required mapping information when the process starts should it be
required.  Either approach would be preferable to our current behavior
of passing a pointer to an unmapped region of user memory as AT_BASE.

MFC after:	3 weeks

Revision 1.191: download - view: text, markup, annotated - select for diffs
Wed Dec 17 16:54:29 2008 UTC (3 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +0 -4 lines
SVN rev 186235 on 2008-12-17 16:54:29Z by peter

Remove sysctl debug.elf_trace and the trace field in auxargs.  They go
nowhere.  It used to be the equivalent of $LD_DEBUG in rtld-elf.
Elf_Auxargs is an internal structure.

Revision 1.190: download - view: text, markup, annotated - select for diffs
Wed Dec 17 16:25:20 2008 UTC (3 years, 1 month ago) by imp
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +1 -2 lines
SVN rev 186233 on 2008-12-17 16:25:20Z by imp

Minor style(9) nit.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Wed Dec 17 13:13:35 2008 UTC (3 years, 1 month ago) by kib
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +0 -3 lines
SVN rev 186225 on 2008-12-17 13:13:35Z by kib

Remove two remnant uses of AT_DEBUG.

Revision 1.178.2.4.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.178.2.4: preferred, colored; next MAIN 1.178.2.5: preferred, colored
Changes since revision 1.178.2.4: +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.178.2.4: download - view: text, markup, annotated - select for diffs
Mon Oct 27 13:56:27 2008 UTC (3 years, 3 months ago) by kib
Branches: RELENG_7
CVS tags: RELENG_7_1_BP
Branch point for: RELENG_7_1
Diff to: previous 1.178.2.3: preferred, colored; branchpoint 1.178: preferred, colored
Changes since revision 1.178.2.3: +11 -4 lines
SVN rev 184335 on 2008-10-27 13:56:27Z by kib

MFC r175105 (by peter):
Fall back to the binary-specified interpreter (ld-elf.so.1) if the
ABI override binary isn't found.

MFC r183694:
If the ABI-overriden interpreter was not loaded, do not set have_interp
to TRUE.

Approved by:	re (kensmith)

Revision 1.188: download - view: text, markup, annotated - select for diffs
Wed Oct 8 11:11:36 2008 UTC (3 years, 4 months ago) by kib
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +2 -1 lines
SVN rev 183694 on 2008-10-08 11:11:36Z by kib

If the ABI-overriden interpreter was not loaded, do not set
have_interp to TRUE. This allows the code in image activator to try
/libexec/ld-elf.so.1 as interpreter when newinterp is not found to
execute.

Reviewed by:	peter
MFC after:	2 weeks (together with r175105)

Revision 1.162.2.6.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.162.2.6: preferred, colored; next MAIN 1.163: preferred, colored
Changes since revision 1.162.2.6: +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.187: download - view: text, markup, annotated - select for diffs
Thu May 15 03:07:34 2008 UTC (3 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +2 -2 lines
Go back to using the process command name (p_comm) for the file name and
command line arguments stored in the note at the beginning of a core dump
instead of the current thread name.

Reviewed by:	julian

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Manpage and FreeBSD_version will be updated through further commits.

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

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

Revision 1.183: download - view: text, markup, annotated - select for diffs
Sat Jan 5 08:35:56 2008 UTC (4 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +10 -4 lines
Fall back to the binary-specified interpreter (ld-elf.so.1) if the
ABI override binary isn't found.  This could probably be smoother, but
it is what I did in p4 change #126891 on 2007/09/27.  It should solve
the "ld-elf32.so.1"-in-chroot problem.

Revision 1.162.2.5.2.1: download - view: text, markup, annotated - select for diffs
Fri Dec 7 14:30:26 2007 UTC (4 years, 2 months ago) by kib
Branches: RELENG_6_3
CVS tags: RELENG_6_3_0_RELEASE
Diff to: previous 1.162.2.5: preferred, colored; next MAIN 1.162.2.6: preferred, colored
Changes since revision 1.162.2.5: +10 -3 lines
MFC rev. 1.181:
Check for the program headers alignment of the ELF images before
dereferencing. Unaligned access could cause panic on strict alignment
architectures.

Approved by:	re (kensmith)

Revision 1.162.2.6: download - view: text, markup, annotated - select for diffs
Fri Dec 7 14:28:31 2007 UTC (4 years, 2 months ago) by kib
Branches: RELENG_6
CVS tags: RELENG_6_4_BP
Branch point for: RELENG_6_4
Diff to: previous 1.162.2.5: preferred, colored; branchpoint 1.162: preferred, colored; next MAIN 1.163: preferred, colored
Changes since revision 1.162.2.5: +10 -3 lines
MFC rev. 1.181:
Check for the program headers alignment of the ELF images before
dereferencing. Unaligned access could cause panic on strict alignment
architectures.

Approved by:	re (kensmith)

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

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

Approved by:	re (kensmith)

Revision 1.178.2.1: download - view: text, markup, annotated - select for diffs
Thu Dec 6 13:47:46 2007 UTC (4 years, 2 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +10 -3 lines
MFC rev. 1.181:
Check for the program headers alignment of the ELF images before
dereferencing. Unaligned access could cause panic on strict alignment
architectures.

Approved by:	re (kensmith)

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

MFC after:	3 days

Revision 1.181: download - view: text, markup, annotated - select for diffs
Tue Dec 4 12:21:27 2007 UTC (4 years, 2 months ago) by kib
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +10 -3 lines
Check for the program headers alignment of the ELF images before
dereferencing. Unaligned access could cause panic on strict alignment
architectures.

Reviewed by:	marcel, marius (also tested on sparc64, thanks !)
MFC after:	3 days

Revision 1.180: download - view: text, markup, annotated - select for diffs
Wed Nov 14 06:51:33 2007 UTC (4 years, 2 months ago) by julian
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +2 -2 lines
A bunch more files that should probably print out a thread name
instead of a process name.

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

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

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

In collaboration with:	Peter Holm
Reviewed by:	jhb

Revision 1.162.2.5: download - view: text, markup, annotated - select for diffs
Wed Jun 6 21:30:42 2007 UTC (4 years, 8 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_3_BP
Branch point for: RELENG_6_3
Diff to: previous 1.162.2.4: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.2.4: +15 -10 lines
MFC 1.176: Add vm map and object locking to each_writable_segment().

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

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

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

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

MFC after:	1 week

Revision 1.177: download - view: text, markup, annotated - select for diffs
Wed Jan 17 14:58:53 2007 UTC (5 years ago) by delphij
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +1 -1 lines
Use FOREACH_PROC_IN_SYSTEM instead of using its unrolled form.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Sun Nov 19 23:38:59 2006 UTC (5 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +15 -10 lines
Add vm map and object locking to each_writable_segment().

Noticed by: jhb@
MFC after: 3 weeks

Revision 1.162.2.3: download - view: text, markup, annotated - select for diffs
Thu Mar 16 00:25:31 2006 UTC (5 years, 10 months ago) by alc
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2, RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.162.2.2: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.2.2: +97 -144 lines
MFC
  File                  Revisions
  kern/imgact_aout.c    1.100
  kern/imgact_elf.c     1.167-1.172, 1.175
  kern/imgact_gzip.c    1.55
  vm/vm_extern.h        1.77
  vm/vm_glue.c          1.214

  Use sf_buf_alloc() instead of vm_map_find() on exec_map to create
  the ephemeral mappings that are used as the source for three copy
  operations from kernel space to user space.  There are two reasons
  for making this change: (1) Under heavy load exec_map can fill up
  causing vm_map_find() to fail.  When it fails, the nascent process
  is aborted (SIGABRT).  Whereas, this reimplementation using
  sf_buf_alloc() sleeps.  (2) Although it is possible to sleep on
  vm_map_find()'s failure until address space becomes available (see
  kmem_alloc_wait()), using sf_buf_alloc() is faster.  Furthermore,
  the reimplementation uses a CPU private mapping, avoiding a TLB
  shootdown on multiprocessors.

  The second argument to vm_map_find() should be NULL instead of 0.

  Correct a long-standing problem in elfN_map_insert(): In order to
  copy a page to user space, the user space mapping must allow write
  access.

  Eliminate an unneeded (vm_prot_t) parameter from two functions.
  Eliminate unnecessary uses of a local variable.

  Maintain the vnode lock throughout elfN_load_file() rather than
  releasing it and reacquiring it in vrele().  Consequently, there is
  no reason to increase the reference count on the vm object caching
  the file's pages.

  Eliminate unused parameters to elfN_load_file().

  Maintain the lock on the vnode for most of exec_elfN_imgact().
  Specifically, it is required for the I/O that may be performed by
  elfN_load_section().

  Avoid an obscure deadlock in the a.out, elf, and gzip image
  activators.  Add a comment describing why the deadlock does not
  occur in the common case and how it might occur in less usual
  circumstances.

  Eliminate an unused variable from exec_aout_imgact().

  Avoid a vm object reference leak in a rarely used code path.

  An executable contains at most one PT_INTERP program header.
  Therefore, the loop that searches for it can terminate after it is
  found rather than iterating over the entire set of program headers.

  Eliminate an unneeded initialization.

Approved by: re (mux)

Revision 1.175: download - view: text, markup, annotated - select for diffs
Sat Jan 21 20:11:49 2006 UTC (6 years ago) by alc
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +7 -10 lines
Avoid a vm object reference leak in a rarely used code path.

An executable contains at most one PT_INTERP program header.  Therefore,
the loop that searches for it can terminate after it is found rather than
iterating over the entire set of program headers.

Eliminate an unneeded initialization.

Reviewed by: tegge

Revision 1.155.2.1: download - view: text, markup, annotated - select for diffs
Tue Jan 10 02:12:27 2006 UTC (6 years, 1 month ago) by sobomax
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.155: preferred, colored; next MAIN 1.156: preferred, colored
Changes since revision 1.155: +9 -1 lines
MFC: allow execution of ET_DYN elf binaries (aka shared libraries) when
emulating architectures that allow this (Linux so far).

To preserve kernel modules ABI, unlike the version commited into the trunk,
which adds new flag field into Brandinfo structure for this purpose, this
one checks if brand field of Brandinfo matches ELFOSABI_LINUX.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>

Revision 1.162.2.2: download - view: text, markup, annotated - select for diffs
Tue Jan 10 00:52:07 2006 UTC (6 years, 1 month ago) by sobomax
Branches: RELENG_6
Diff to: previous 1.162.2.1: preferred, colored; branchpoint 1.162: preferred, colored
Changes since revision 1.162.2.1: +9 -1 lines
MFC: allow execution of ET_DYN elf binaries (aka shared libraries) when
emulating architectures that allow this (Linux so far).

To preserve kernel modules ABI, unlike the version commited into the trunk,
which adds new flag field into Brandinfo structure for this purpose, this
one checks if brand field of Brandinfo matches ELFOSABI_LINUX.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>

Revision 1.174: download - view: text, markup, annotated - select for diffs
Mon Dec 26 22:32:52 2005 UTC (6 years, 1 month ago) by sobomax
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +2 -4 lines
Fix breakage introduced in the previous commit.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Mon Dec 26 21:23:55 2005 UTC (6 years, 1 month ago) by sobomax
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +10 -7 lines
Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structure
with flags bitfield and set BI_CAN_EXEC_DYN flag for all brands that usually
allow executing elf dynamic binaries (aka shared libraries). When it is
requested to execute ET_DYN elf image check if this flag is on after we
know the elf brand allowing execution if so.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>

Revision 1.172: download - view: text, markup, annotated - select for diffs
Sat Dec 24 04:57:50 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +35 -32 lines
Maintain the lock on the vnode for most of exec_elfN_imgact().
Specifically, it is required for the I/O that may be performed by
elfN_load_section().

Avoid an obscure deadlock in the a.out, elf, and gzip image
activators.  Add a comment describing why the deadlock does not occur
in the common case and how it might occur in less usual circumstances.

Eliminate an unused variable from exec_aout_imgact().

In collaboration with: tegge

Revision 1.171: download - view: text, markup, annotated - select for diffs
Wed Dec 21 18:58:40 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +13 -21 lines
Maintain the vnode lock throughout elfN_load_file() rather than releasing
it and reacquiring it in vrele().  Consequently, there is no reason to
increase the reference count on the vm object caching the file's pages.
Reviewed by: tegge

Eliminate unused parameters to elfN_load_file().

Revision 1.170: download - view: text, markup, annotated - select for diffs
Tue Dec 20 23:42:18 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +10 -15 lines
Eliminate an unneeded (vm_prot_t) parameter from two functions.  Eliminate
unnecessary uses of a local variable.

Reviewed by: tegge

Revision 1.169: download - view: text, markup, annotated - select for diffs
Sat Dec 17 19:40:47 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +1 -1 lines
Correct a long-standing problem in elfN_map_insert(): In order to copy a
page to user space, the user space mapping must allow write access.

In collaboration with: tegge@
MFC after: 3 weeks

Revision 1.168: download - view: text, markup, annotated - select for diffs
Fri Dec 16 19:14:25 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +1 -1 lines
Style: The second argument to vm_map_find() should be NULL instead of 0.

Revision 1.167: download - view: text, markup, annotated - select for diffs
Fri Dec 16 18:34:13 2005 UTC (6 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +29 -61 lines
Use sf_buf_alloc() instead of vm_map_find() on exec_map to create the
ephemeral mappings that are used as the source for three copy
operations from kernel space to user space.  There are two reasons for
making this change: (1) Under heavy load exec_map can fill up causing
vm_map_find() to fail.  When it fails, the nascent process is aborted
(SIGABRT).  Whereas, this reimplementation using sf_buf_alloc()
sleeps.  (2) Although it is possible to sleep on vm_map_find()'s
failure until address space becomes available (see kmem_alloc_wait()),
using sf_buf_alloc() is faster.  Furthermore, the reimplementation
uses a CPU private mapping, avoiding a TLB shootdown on
multiprocessors.

Problem uncovered by: kris@
Reviewed by: tegge@
MFC after: 3 weeks

Revision 1.166: download - view: text, markup, annotated - select for diffs
Mon Nov 14 22:24:00 2005 UTC (6 years, 2 months ago) by cognet
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +7 -1 lines
Add a new sysctl, kern.elf[32|64].can_exec_dyn. When set to 1, one can
execute a ET_DYN binary (shared object).
This does not make much sense, but some linux scripts expect to be able to
execute /lib/ld-linux.so.2 (ldd comes to mind).
The sysctl defaults to 0.

MFC after:	3 days

Revision 1.165: download - view: text, markup, annotated - select for diffs
Wed Sep 28 07:03:03 2005 UTC (6 years, 4 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +0 -6 lines
Back out alpha/alpha/trap.c:1.124, osf1_ioctl.c:1.14, osf1_misc.c:1.57,
osf1_signal.c:1.41, amd64/amd64/trap.c:1.291, linux_socket.c:1.60,
svr4_fcntl.c:1.36, svr4_ioctl.c:1.23, svr4_ipc.c:1.18, svr4_misc.c:1.81,
svr4_signal.c:1.34, svr4_stat.c:1.21, svr4_stream.c:1.55,
svr4_termios.c:1.13, svr4_ttold.c:1.15, svr4_util.h:1.10,
ext2_alloc.c:1.43, i386/i386/trap.c:1.279, vm86.c:1.58,
unaligned.c:1.12, imgact_elf.c:1.164, ffs_alloc.c:1.133:

Now that Giant is acquired in uprintf() and tprintf(), the caller no
longer leads to acquire Giant unless it also holds another mutex that
would generate a lock order reversal when calling into these functions.
Specifically not backed out is the acquisition of Giant in nfs_socket.c
and rpcclnt.c, where local mutexes are held and would otherwise violate
the lock order with Giant.

This aligns this code more with the eventual locking of ttys.

Suggested by:	bde

Revision 1.164: download - view: text, markup, annotated - select for diffs
Mon Sep 19 16:51:42 2005 UTC (6 years, 4 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +6 -0 lines
Add GIANT_REQUIRED and WITNESS sleep warnings to uprintf() and tprintf(),
as they both interact with the tty code (!MPSAFE) and may sleep if the
tty buffer is full (per comment).

Modify all consumers of uprintf() and tprintf() to hold Giant around
calls into these functions.  In most cases, this means adding an
acquisition of Giant immediately around the function.  In some cases
(nfs_timer()), it means acquiring Giant higher up in the callout.

With these changes, UFS no longer panics on SMP when either blocks are
exhausted or inodes are exhausted under load due to races in the tty
code when running without Giant.

NB: Some reduction in calls to uprintf() in the svr4 code is probably
desirable.

NB: In the case of nfs_timer(), calling uprintf() while holding a mutex,
or even in a callout at all, is a bad idea, and will generate warnings
and potential upset.  This needs to be fixed, but was a problem before
this change.

NB: uprintf()/tprintf() sleeping is generally a bad ideas, as is having
non-MPSAFE tty code.

MFC after:	1 week

Revision 1.162.2.1: download - view: text, markup, annotated - select for diffs
Sun Sep 18 03:31:35 2005 UTC (6 years, 4 months ago) by csjp
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +7 -3 lines
MFC v1.163 src/sys/kern/imgact_elf.c
MFC v1.82  src/sys/kern/vfs_lookup.c
MFC v1.394 src/sys/kern/vfs_syscalls.c

Approved by:	re (scottl)

Revision 1.163: download - view: text, markup, annotated - select for diffs
Thu Sep 15 15:03:47 2005 UTC (6 years, 4 months ago) by csjp
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +7 -3 lines
Improve the MP safeness associated with the creation of symbolic
links and the execution of ELF binaries. Two problems were found:

1) The link path wasn't tagged as being MP safe and thus was not properly
   protected.
2) The ELF interpreter vnode wasnt being locked in namei(9) and thus was
   insufficiently protected.

This commit makes the following changes:

-Sets the MPSAFE flag in NDINIT for symbolic link paths
-Sets the MPSAFE flag in NDINIT and introduce a vfslocked variable which
 will be used to instruct VFS_UNLOCK_GIANT to unlock Giant if it has been
 picked up.
-Drop in an assertion into vfs_lookup which ensures that if the MPSAFE
 flag is NOT set, that we have picked up giant. If not panic (if WITNESS
 compiled into the kernel). This should help us find conditions where vnode
 operations are in-sufficiently protected.

This is a RELENG_6 candidate.

Discussed with:	jeff
MFC after:	4 days

Revision 1.162: download - view: text, markup, annotated - select for diffs
Thu Jun 30 07:49:22 2005 UTC (6 years, 7 months ago) by peter
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +40 -10 lines
Jumbo-commit to enhance 32 bit application support on 64 bit kernels.
This is good enough to be able to run a RELENG_4 gdb binary against
a RELENG_4 application, along with various other tools (eg: 4.x gcore).
We use this at work.

ia32_reg.[ch]: handle the 32 bit register file format, used by ptrace,
	procfs and core dumps.
procfs_*regs.c: vary the format of proc/XXX/*regs depending on the client
	and target application.
procfs_map.c: Don't print a 64 bit value to 32 bit consumers, or their
	sscanf fails.  They expect an unsigned long.
imgact_elf.c: produce a valid 32 bit coredump for 32 bit apps.
sys_process.c: handle 32 bit consumers debugging 32 bit targets.  Note
	that 64 bit consumers can still debug 32 bit targets.

IA64 has got stubs for ia32_reg.c.

Known limitations: a 5.x/6.x gdb uses get/setcontext(), which isn't
implemented in the 32/64 wrapper yet.  We also make a tiny patch to
gdb pacify it over conflicting formats of ld-elf.so.1.

Approved by:	re

Revision 1.161: download - view: text, markup, annotated - select for diffs
Tue May 24 22:21:44 2005 UTC (6 years, 8 months ago) by cognet
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +0 -4 lines
Don't set the default of kern.fallback_elf_brand to FreeBSD for arm, as
binutils now do the job for us

Revision 1.160: download - view: text, markup, annotated - select for diffs
Tue May 3 10:51:38 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +0 -2 lines
 - Neither of our image formats require Giant now that the vm and vfs have
   been locked.

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sun Apr 3 07:57:47 2005 UTC (6 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +0 -2 lines
Remove GIANT_REQUIRED from elfN_load_section().

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

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

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

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

Revision 1.156: download - view: text, markup, annotated - select for diffs
Thu Sep 23 23:29:24 2004 UTC (7 years, 4 months ago) by cognet
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +4 -0 lines
On arm, set the default elf brand to FreeBSD, until the binutils do it for us.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Wed Aug 11 02:35:05 2004 UTC (7 years, 6 months ago) by marcel
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +5 -2 lines
Add __elfN(dump_thread). This function is called from __elfN(coredump)
to allow dumping per-thread machine specific notes. On ia64 we use this
function to flush the dirty registers onto the backingstore before we
write out the PRSTATUS notes.

Tested on: alpha, amd64, i386, ia64 & sparc64
Not tested on: arm, powerpc

Revision 1.154: download - view: text, markup, annotated - select for diffs
Sun Aug 8 09:48:10 2004 UTC (7 years, 6 months ago) by dfr
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +11 -0 lines
Make sure that AT_PHDR has a useful value even for static programs.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Sun Jul 18 20:28:07 2004 UTC (7 years, 6 months ago) by marcel
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +5 -8 lines
After maintaining previous behaviour in writing out the core notes, it's
time now to break with the past: do not write the PID in the first note.
Rationale:
1.  [impact of the breakage] Process IDs in core files serve no immediate
    purpose to the debugger itself. They are only useful to relate a core
    file to a process. This can provide context to the person looking at
    the core file, provided one keeps track of this. Overall, not having
    the PID in the core file is only in very rare occasions unfortunate.
2.  [reason of the breakage] Having one PRSTATUS note contain the PID,
    while all others contain the LWPID of the corresponding kernel thread
    creates an irregularity for the debugger that cannot easily be worked
    around. This is caused by libthread_db correlating user thread IDs to
    kernel thread (aka LWP) IDs and thus aware of the actual LWPIDs.

Update comments accordingly.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sat Jun 26 18:58:22 2004 UTC (7 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +31 -33 lines
Allocate TIDs in thread_init() and deallocate them in thread_fini().
The overhead of unconditionally allocating TIDs (and likewise,
unconditionally deallocating them), is amortized across multiple
thread creations by the way UMA makes it possible to have type-stable
storage.
Previously the cost was kept down by having threads created as part
of a fork operation use the process' PID as the TID. While this had
some nice properties, it also introduced complexity in the way TIDs
were allocated. Most importantly, by using the type-stable storage
that UMA gives us this was also unnecessary.

This change affects how core dumps are created and in particular how
the PRSTATUS notes are dumped. Since we don't have a thread with a
TID equalling the PID, we now need a different way to preserve the
old and previous behavior. We do this by having the given thread (i.e.
the thread passed to the core dump code in td) dump it's state first
and fill in pr_pid with the actual PID. All other threads will have
pr_pid contain their TIDs. The upshot of all this is that the debugger
will now likely select the right LWP (=TID) as the initial thread.

Credits to: julian@ for spotting how we can utilize UMA.
Thanks to: all who provided julian@ with test results.

Revision 1.151: download - view: text, markup, annotated - select for diffs
Sat Jun 5 02:18:28 2004 UTC (7 years, 8 months ago) by tjr
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +1 -1 lines
Change the types of vn_rdwr_inchunks()'s len and aresid arguments to
size_t and size_t *, respectively. Update callers for the new interface.
This is a better fix for overflows that occurred when dumping segments
larger than 2GB to core files.

Revision 1.150: download - view: text, markup, annotated - select for diffs
Sat Jun 5 02:00:12 2004 UTC (7 years, 8 months ago) by tjr
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +8 -21 lines
Back out workaround for vn_rdwr_inchunks()'s INT_MAX length limitation
after discussions with bde; vn_rdwr_inchunks() itself should be fixed.

Revision 1.149: download - view: text, markup, annotated - select for diffs
Fri Jun 4 06:30:16 2004 UTC (7 years, 8 months ago) by tjr
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +21 -8 lines
Write segments to core dump files in maximally-sized chunks that neither
exceed vn_rdwr_inchunks()'s INT_MAX length limitation nor span a block
boundary. This fixes dumping segments larger than 2GB.

PR:	67546

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

Revision 1.147: download - view: text, markup, annotated - select for diffs
Thu Apr 8 06:37:00 2004 UTC (7 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +9 -6 lines
Do not assume that the initial thread (i.e. the thread with the ID
equal to the process ID) is still present when we dump a core. It
already may have been destroyed. In that case we would end up
dereferencing a NULL pointer, so specifically test for that as well.

Reported & tested by: Dan Nelson <dnelson@allantgroup.com>

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sat Apr 3 20:25:41 2004 UTC (7 years, 10 months ago) by marcel
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +81 -50 lines
Create NT_PRSTATUS and NT_FPREGSET notes for each and every thread
in the process. This is required for proper debugging of corefiles
created by 1:1 or M:N threaded processes. Add an XXX comment where
we should actually call a function that dumps MD specific notes.
An example of a MD specific note is the NT_PRXFPREG note for SSE
registers.

Since BFD creates non-annotated pseudo-sections for the first PRSTATUS
and FPREGSET notes (non-annotated in the sense that the name of the
section does not contain the pid/tid), make sure those sections describe
the initial thread of the process (i.e. the thread which tid equals the
pid). This is not strictly necessary, but makes sure that tools that use
the non-annotated section names will not change behaviour due to this
change.

The practical upshot of this all is that one can see the threads in
the debugger when looking at a corefile. For 1:1 threading this means
that *all* threads are visible.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Thu Mar 18 16:33:05 2004 UTC (7 years, 10 months ago) by nectar
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +6 -6 lines
Verify more bits of the ELF header: the program header table
entry size and the ELF version.  Also, avoid a potential integer
overflow when determining whether the ELF header fits entirely
within the first page.

Reviewed by:	jdp

A panic when attempting to execute an ELF binary with a bogus program
header table entry size was

Reported by:	Christer Öberg <christer.oberg@texonet.com>

Revision 1.144: download - view: text, markup, annotated - select for diffs
Wed Feb 4 21:52:55 2004 UTC (8 years ago) by jhb
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +6 -5 lines
Locking for the per-process resource limits structure.
- struct plimit includes a mutex to protect a reference count.  The plimit
  structure is treated similarly to struct ucred in that is is always copy
  on write, so having a reference to a structure is sufficient to read from
  it without needing a further lock.
- The proc lock protects the p_limit pointer and must be held while reading
  limits from a process to keep the limit structure from changing out from
  under you while reading from it.
- Various global limits that are ints are not protected by a lock since
  int writes are atomic on all the archs we support and thus a lock
  wouldn't buy us anything.
- All accesses to individual resource limits from a process are abstracted
  behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return
  either an rlimit, or the current or max individual limit of the specified
  resource from a process.
- dosetrlimit() was renamed to kern_setrlimit() to match existing style of
  other similar syscall helper functions.
- The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit()
  (it didn't used the stackgap when it should have) but uses lim_rlimit()
  and kern_setrlimit() instead.
- The svr4 compat no longer uses the stackgap for resource limits calls,
  but uses lim_rlimit() and kern_setrlimit() instead.
- The ibcs2 compat no longer uses the stackgap for resource limits.  It
  also no longer uses the stackgap for accessing sysctl's for the
  ibcs2_sysconf() syscall but uses kernel_sysctl() instead.  As a result,
  ibcs2_sysconf() no longer needs Giant.
- The p_rlimit macro no longer exists.

Submitted by:	mtm (mostly, I only did a few cleanups and catchups)
Tested on:	i386
Compiled on:	alpha, amd64

Revision 1.143: download - view: text, markup, annotated - select for diffs
Tue Dec 23 02:45:24 2003 UTC (8 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +0 -0 lines
Forced commit; previous commit also included:
- eliminate a malloc()/snprintf()/free() in the native exec(2) case and
  in the easy emulation environments.
- Allow the brand emul_path (ie: /compat/xxx) to be NULL rather than
  needing it to be an empty string that is always referenced.

Revision 1.142: download - view: text, markup, annotated - select for diffs
Tue Dec 23 02:42:38 2003 UTC (8 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +16 -11 lines
Add an additional field to the elf brandinfo structure to support
quicker exec-time replacement of the elf interpreter on an emulation
environment where an entire /compat/* tree isn't really warranted.

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

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

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

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

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

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

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

Revision 1.139: download - view: text, markup, annotated - select for diffs
Sat May 31 19:55:05 2003 UTC (8 years, 8 months ago) by marcel
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +4 -5 lines
Fix ia32 compat on ia64. Recent ia64 MD changes caused the garbage on
the stack to be changed in a way incompatible with elf32_map_insert()
where we used data_buf without initializing it for when the partial
mapping resulting in a misaligned image (typical when the page size
implied by the image is not the same as the page size in use by the
kernel). Since data_buf is passed by reference to vm_map_find(), the
compiler cannot warn about it.

While here, move all local variables to the top of the function.

Revision 1.138: 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
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +5 -5 lines
Back out M_* changes, per decision of the TRB.

Approved by: trb

Revision 1.137: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:55:53 2003 UTC (9 years ago) by alfred
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +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.136: download - view: text, markup, annotated - select for diffs
Sun Jan 5 03:48:14 2003 UTC (9 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +5 -8 lines
- Provide backwards compatibility for kern.fallback_elf_brand.
- Use the generic elf type macros in imgact_elf.h instead of ifdefing the
  entire contents of the header.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Sat Jan 4 22:07:48 2003 UTC (9 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +23 -27 lines
Improve the way that an elf image activator for an alternate word size is
included in the kernel.  Include imgact_elf.c in conf/files,  instead of
both imgact_elf32.c and imgact_elf64.c, which will use the default word
size for an architecture as defined in machine/elf.h.  Architectures that
wish to build an additional image activator for an alternate word size can
include either imgact_elf32.c or imgact_elf64.c in files.${ARCH}, which
allows it to be dependent on MD options instead of solely on architecture.

Glanced at by:	peter

Revision 1.73.2.13: download - view: text, markup, annotated - select for diffs
Sat Dec 28 19:49:41 2002 UTC (9 years, 1 month ago) by dillon
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.73.2.12: preferred, colored; branchpoint 1.73: preferred, colored; next MAIN 1.74: preferred, colored
Changes since revision 1.73.2.12: +31 -11 lines
MFC ELF coredump handling fixes.  Do not skip read-only pages unrelated
to the binary image.  Use NOCORE to differentiate between the two.  Introduce
a debug.elf_legacy_coredump sysctl which, if set, reverts to the old behavior.

See the log message in sys/kern/imgact_elf.c 1.133.

PR:		kern/45994

Revision 1.134: download - view: text, markup, annotated - select for diffs
Sat Dec 21 01:15:39 2002 UTC (9 years, 1 month ago) by marcel
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +5 -3 lines
Fix multiple registration of the elf_legacy_coredump sysctl variable.
The duplication is caused by the fact that imgact_elf.c is included
by both imgact_elf32.c and imgact_elf64.c and both are compiled by
default on ia64. Consequently, we have two seperate copies of the
elf_legacy_coredump variable due to them being declared static, and
two entries for the same sysctl in the linker set, both referencing
the unique copy of the elf_legacy_coredump variable. Since the second
sysctl cannot be registered, one of the elf_legacy_coredump variables
can not be tuned (if ordering still holds, it's the ELF64 related one).

The only solution is to create two different sysctl variables, just
like the elf<32|64>_trace sysctl variables. This unfortunately is an
(user) interface change, but unavoidable. Thus, on ELF32 platforms
the sysctl variable is called elf32_legacy_coredump and on ELF64
platforms it is called elf64_legacy_coredump. Platforms that have
both ELF formats have both sysctl variables.

These variables should probably be retired sooner rather than later.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Mon Dec 16 19:24:43 2002 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +31 -11 lines
Change the way ELF coredumps are handled.  Instead of unconditionally
skipping read-only pages, which can result in valuable non-text-related
data not getting dumped, the ELF loader and the dynamic loader now mark
read-only text pages NOCORE and the coredump code only checks (primarily) for
complete inaccessibility of the page or NOCORE being set.

Certain applications which map large amounts of read-only data will
produce much larger cores.  A new sysctl has been added,
debug.elf_legacy_coredump, which will revert to the old behavior.

This commit represents collaborative work by all parties involved.
The PR contains a program demonstrating the problem.

PR:		kern/45994
Submitted by:	"Peter Edwards" <pmedwards@eircom.net>, Archie Cobbs <archie@dellroad.org>
Reviewed by:	jdp, dillon
MFC after:	7 days

Revision 1.73.2.12: download - view: text, markup, annotated - select for diffs
Sun Dec 15 20:16:46 2002 UTC (9 years, 1 month ago) by dillon
Branches: RELENG_4
Diff to: previous 1.73.2.11: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.11: +5 -5 lines
Fix a bug where the VTEXT designation can be 'lost' on a running executable
if it exec()'s itself.  This problem has already been fixed in -current.

PR:		misc/39326
Submitted by:	Peter Edwards <pmedwards@eircom.net>

Revision 1.132: download - view: text, markup, annotated - select for diffs
Fri Nov 8 20:49:50 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +1 -0 lines
Assign value of NULL to imgp->execlabel when imgp is initialized
in the ELF code.  Missed in earlier merge from the MAC tree.

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

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

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

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

Revision 1.130: download - view: text, markup, annotated - select for diffs
Wed Oct 23 01:57:39 2002 UTC (9 years, 3 months ago) by kan
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +19 -14 lines
Handle binaries with arbitrary number PT_LOAD sections, not only
ones with one text and one data section.

The text and data rlimit checks still needs to be fixed to properly
accout for additional sections.

Reviewed by:	peter (slightly different patch version)

Revision 1.129: download - view: text, markup, annotated - select for diffs
Thu Oct 17 20:03:38 2002 UTC (9 years, 3 months ago) by robert
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +2 -2 lines
Use strlcpy() instead of strncpy() to copy NUL terminated strings
for safety and consistency.

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

Revision 1.73.2.11: download - view: text, markup, annotated - select for diffs
Mon Sep 9 17:38:47 2002 UTC (9 years, 5 months ago) by dillon
Branches: RELENG_4
CVS tags: RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7
Diff to: previous 1.73.2.10: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.10: +24 -18 lines
MFC partial reversion of previous commit, based on problems reported by
Alpha users and a long discussion with Peter Wemm.  The jist of it is
that we can't trust any of the elf flags to determine what is data and
what is text so we use the old 'entry point in segment' method to
detect text vs data, and we can't calculate the actual data_size for
vmspace because break() depends on data_start + data_size pointing to
the end of the address space, so we use the last data segment (as before).
However, we were able to retain partial checking for RLIMIT_TEXT,
RLIMIT_DATA, and full checking for RLIMIT_VMEM.

Approved by:	re

Revision 1.127: download - view: text, markup, annotated - select for diffs
Sun Sep 8 02:17:44 2002 UTC (9 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +3 -1 lines
Do not blow up when we walk off the end of the brands list.

Found by:	kris, jake

Revision 1.126: download - view: text, markup, annotated - select for diffs
Wed Sep 4 04:42:12 2002 UTC (9 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +18 -8 lines
Alright, fix the problems with the elf loader for the Alpha.  It turns
out that there is no easy way to discern the difference between a text
segment and a data segment through the read-only OR execute attribute
in the elf segment header, so revert the algorithm to what it was before.

Neither can we account for multiple data load segments in the vmspace
structure (at least not without more work), due to assumptions obreak()
makes in regards to the data start and data size fields.

Retain RLIMIT_VMEM checking by using a local variable to track the
total bytes of data being loaded.

Reviewed by:	peter
X-MFC after:	ASAP

Revision 1.125: download - view: text, markup, annotated - select for diffs
Tue Sep 3 21:18:17 2002 UTC (9 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +10 -15 lines
Make the text segment locating heuristics from rev 1.121 more reliable
so that it works on the Alpha.  This defines the segment that the entry
point exists in as 'text' and any others (usually one) as data.

Submitted by: tmm
Tested on: i386, alpha

Revision 1.73.2.10: download - view: text, markup, annotated - select for diffs
Mon Sep 2 21:22:54 2002 UTC (9 years, 5 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.73.2.9: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.9: +34 -13 lines
MFC stage-2 RLIMIT_VMEM support.  Add support to the elf loader.

Approved by:	re

Revision 1.124: download - view: text, markup, annotated - select for diffs
Mon Sep 2 17:27:30 2002 UTC (9 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +2 -2 lines
Grammer cleanup

Revision 1.123: download - view: text, markup, annotated - select for diffs
Mon Sep 2 04:50:57 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +75 -105 lines
Moved elf brand identification into a function.  Fully identify the
brand early in the process of loading an elf file, so that we can
identify the sysentvec, and so that we do not continue if we do not
have a brand (and thus a sysentvec).  Use the values in the sysentvec
for the page size and vm ranges unconditionally, since they are all
filled in now.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Mon Sep 2 02:41:26 2002 UTC (9 years, 5 months ago) by jake
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +3 -3 lines
Fixed more indentation bugs.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Fri Aug 30 18:09:46 2002 UTC (9 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +33 -10 lines
Implement data, text, and vmem limit checking in the elf loader and svr4
compat code.  Clean up accounting for multiple segments.  Part 1/2.

Submitted by:	Andrey Alekseyev <uitm@zenon.net> (with some modifications)
MFC after:	3 days

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

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

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

Reviewed by:	md5

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

Reviewed by:	md5

Revision 1.116: download - view: text, markup, annotated - select for diffs
Thu Aug 15 20:55:03 2002 UTC (9 years, 5 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +4 -2 lines
In order to better support flexible and extensible access control,
make a series of modifications to the credential arguments relating
to file read and write operations to cliarfy which credential is
used for what:

- Change fo_read() and fo_write() to accept "active_cred" instead of
  "cred", and change the semantics of consumers of fo_read() and
  fo_write() to pass the active credential of the thread requesting
  an operation rather than the cached file cred.  The cached file
  cred is still available in fo_read() and fo_write() consumers
  via fp->f_cred.  These changes largely in sys_generic.c.

For each implementation of fo_read() and fo_write(), update cred
usage to reflect this change and maintain current semantics:

- badfo_readwrite() unchanged
- kqueue_read/write() unchanged
  pipe_read/write() now authorize MAC using active_cred rather
  than td->td_ucred
- soo_read/write() unchanged
- vn_read/write() now authorize MAC using active_cred but
  VOP_READ/WRITE() with fp->f_cred

Modify vn_rdwr() to accept two credential arguments instead of a
single credential: active_cred and file_cred.  Use active_cred
for MAC authorization, and select a credential for use in
VOP_READ/WRITE() based on whether file_cred is NULL or not.  If
file_cred is provided, authorize the VOP using that cred,
otherwise the active credential, matching current semantics.

Modify current vn_rdwr() consumers to pass a file_cred if used
in the context of a struct file, and to always pass active_cred.
When vn_rdwr() is used without a file_cred, pass NOCRED.

These changes should maintain current semantics for read/write,
but avoid a redundant passing of fp->f_cred, as well as making
it more clear what the origin of each credential is in file
descriptor read/write operations.

Follow-up commits will make similar changes to other file descriptor
operations, and modify the MAC framework to pass both credentials
to MAC policy modules so they can implement either semantic for
revocation.

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

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

Revision 1.114: download - view: text, markup, annotated - select for diffs
Sun Aug 4 10:29:32 2002 UTC (9 years, 6 months ago) by jeff
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +7 -5 lines
 - Replace v_flag with v_iflag and v_vflag
 - v_vflag is protected by the vnode lock and is used when synchronization
   with VOP calls is needed.
 - v_iflag is protected by interlock and is used for dealing with vnode
   management issues.  These flags include X/O LOCK, FREE, DOOMED, etc.
 - All accesses to v_iflag and v_vflag have either been locked or marked with
   mp_fixme's.
 - Many ASSERT_VOP_LOCKED calls have been added where the locking was not
   clear.
 - Many functions in vfs_subr.c were restructured to provide for stronger
   locking.

Idea stolen from:	BSD/OS

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

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

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

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

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

Revision 1.111: download - view: text, markup, annotated - select for diffs
Sun Jun 2 20:05:54 2002 UTC (9 years, 8 months ago) by schweikh
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +1 -1 lines
Fix typo in the BSD copyright: s/withough/without/

Spotted and suggested by:	des
MFC after:	3 weeks

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

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

Revision 1.73.2.9: download - view: text, markup, annotated - select for diffs
Sun Dec 16 18:26:16 2001 UTC (10 years, 1 month ago) by mp
Branches: RELENG_4
CVS tags: RELENG_4_6_BP, RELENG_4_6_2_RELEASE, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE, RELENG_4_6, RELENG_4_5_BP, RELENG_4_5_0_RELEASE, RELENG_4_5
Diff to: previous 1.73.2.8: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.8: +77 -46 lines
MFC: r1.97-1.101
     - Reduce stack allocation
     - Use explicit sizes for the prpsinfo command length string
     - Explicitely use M_WAITOK for clarity

Also, added braces and fixed a return to reduce diffs to -current.

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sun Dec 16 17:21:16 2001 UTC (10 years, 1 month ago) by mp
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +2 -2 lines
Remove whitespace at end of line.

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

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

Reviewed by:	peter
MFC after:	2 weeks

Revision 1.73.2.7: download - view: text, markup, annotated - select for diffs
Fri Sep 28 16:58:35 2001 UTC (10 years, 4 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.73.2.6: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.6: +3 -3 lines
MFC use of uio_yield() in the core dump code, which along with recent
work minimizes the impact that core'ing programs have on the system.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Wed Sep 26 06:54:31 2001 UTC (10 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +3 -3 lines
Make uio_yield() a global.  Call uio_yield() between chunks
in vn_rdwr_inchunks(), allowing other processes to gain an exclusive
lock on the vnode.  Specifically: directory scanning, to avoid a race to the
root directory, and multiple child processes coring simultaniously so they
can figure out that some other core'ing child has an exclusive adv lock and
just exit instead.

This completely fixes performance problems when large programs core.  You
can have hundreds of copies (forked children) of the same binary core all
at once and not notice.

MFC after:	3 days

Revision 1.73.2.6: download - view: text, markup, annotated - select for diffs
Sat Sep 22 09:21:48 2001 UTC (10 years, 4 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.73.2.5: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.5: +6 -5 lines
MFC the Yahoo coredump patch from Peter, Paul, and I, plus the additional fix
by Peter.  See kern/kern_sig.c 1.132.

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

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

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

X-MFC after:    ha ha ha ha

Revision 1.104: download - view: text, markup, annotated - select for diffs
Sun Sep 9 05:08:33 2001 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +1 -1 lines
The basis for the recent coredump commit had the wrong attribution.
The new attribution is below.

Submitted by:	peter, ps

Revision 1.103: download - view: text, markup, annotated - select for diffs
Sat Sep 8 20:02:32 2001 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +6 -5 lines
This brings in a Yahoo coredump patch from Paul, with additional mods by
me (addition of vn_rdwr_inchunks).  The problem Yahoo is solving is that
if you have large process images core dumping, or you have a large number of
forked processes all core dumping at the same time, the original coredump code
would leave the vnode locked throughout.  This can cause the directory vnode
to get locked up, which can cause the parent directory vnode to get locked
up, and so on all the way to the root node, locking the entire machine up
for extremely long periods of time.

This patch solves the problem in two ways.  First it uses an advisory
non-blocking lock to abort multiple processes trying to core to the same
file.  Second (my contribution) it chunks up the writes and uses bwillwrite()
to avoid holding the vnode locked while blocking in the buffer cache.

Submitted by:	ps
Reviewed by:	dillon
MFC after:	2 weeks

Revision 1.102: download - view: text, markup, annotated - select for diffs
Sun Sep 2 12:23:08 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +5 -1 lines
For ia64, set the default elf brand to be FreeBSD.  This is temporarily
necessary only for as long as we're using a linux toolchain.

Revision 1.101: download - view: text, markup, annotated - select for diffs
Tue Aug 28 23:58:32 2001 UTC (10 years, 5 months ago) by brian
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +2 -2 lines
OR M_WAITOK with M_ZERO in malloc()s args for clarity.

Revision 1.100: download - view: text, markup, annotated - select for diffs
Sat Aug 18 04:24:30 2001 UTC (10 years, 5 months ago) by mp
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +2 -2 lines
Unbreak linux compatibility by providing the correct length of the buffer.

Reported by:	"Pierre Y. Dampure" <pierre.dampure@westmarsh.com>,
		"Niels Chr. Bank-Pedersen" <ncbp@bank-pedersen.dk>
Pointy hat to:	mp

Revision 1.99: download - view: text, markup, annotated - select for diffs
Thu Aug 16 20:16:20 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +1 -2 lines
Don't explicitly null-terminate.  The buffer we are copying into is
already zeroed, and we explicitly leave the last byte untouched.

Submitted by: bde

Revision 1.98: download - view: text, markup, annotated - select for diffs
Thu Aug 16 16:14:26 2001 UTC (10 years, 5 months ago) by mp
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +66 -41 lines
Reduce stack allocation (stack-fast?).
    elf_load_file()   =>  352 to 52 bytes
    exec_elf_imgact() => 1072 to 48 bytes
    elf_corehdr()     =>  396 to  8 bytes

Reviewed by:	julian

Revision 1.97: download - view: text, markup, annotated - select for diffs
Thu Aug 16 08:35:51 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +3 -2 lines
Use explicit sizes for the prpsinfo command length string so that
we dont have any more unexpected changes in core dumps.  This gets us
back to the original core dump layout from a few days ago.

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

Revision 1.95: download - view: text, markup, annotated - select for diffs
Wed May 23 22:05:08 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +3 -2 lines
Lock the VM while twiddling the vmspace.

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

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

faults can not be taken without holding Giant.

Memory subsystems can now call the base page allocators safely.

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

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

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

Reviewed (partially) by: jake, jhb

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

Revision 1.93: download - view: text, markup, annotated - select for diffs
Wed Mar 28 11:52:53 2001 UTC (10 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +4 -4 lines
Convert the allproc and proctree locks from lockmgr locks to sx locks.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Wed Mar 28 09:17:54 2001 UTC (10 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +2 -1 lines
Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>

Revision 1.73.2.4: download - view: text, markup, annotated - select for diffs
Mon Mar 5 09:11:58 2001 UTC (10 years, 11 months ago) by obrien
Branches: RELENG_4
CVS tags: RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_3
Diff to: previous 1.73.2.3: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.3: +6 -9 lines
MFC: Do not set a default ELF syscall ABI fallback.
If one runs an un-branded Linux static binary that calls Linux's fcntl
the machine will reboot when interupted by the FreeBSD syscall ABI.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Sun Mar 4 11:58:50 2001 UTC (10 years, 11 months ago) by obrien
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +6 -7 lines
Do not set a default ELF syscall ABI fallback.
If one runs an un-branded Linux static binary that calls Linux's fcntl
the machine will reboot when interupted by the FreeBSD syscall ABI.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Sat Feb 24 22:20:09 2001 UTC (10 years, 11 months ago) by obrien
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +13 -9 lines
MFS: bring the consistent `compat_3_brand' support into -CURRENT
     (the work was first done in the RELENG_4 branch near a release
	 during a MFC to make the code cleaner and more consistent)

Revision 1.73.2.3: download - view: text, markup, annotated - select for diffs
Thu Feb 22 05:15:04 2001 UTC (10 years, 11 months ago) by marcel
Branches: RELENG_4
Diff to: previous 1.73.2.2: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.2: +4 -2 lines
MFC: ABI dependent MINSIGSTKSZ.

Maintain forward compatibility on the -stable branch by
not doing an MFC of the machine dependent MINSIGSTKSZ.
This guarantees that binaries compiled on systems that
include this MFC will run on older systems.

Reviewed by: gallatin

Revision 1.89: download - view: text, markup, annotated - select for diffs
Fri Feb 9 06:09:48 2001 UTC (11 years ago) by bmilekic
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +3 -3 lines
Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)

Revision 1.88: download - view: text, markup, annotated - select for diffs
Sat Jan 27 00:01:25 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +2 -7 lines
Back out proc locking to protect p_ucred for obtaining additional
references along with the actual obtaining of additional references.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Wed Jan 24 00:27:28 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +7 -2 lines
Proc locking.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Wed Dec 13 00:17:00 2000 UTC (11 years, 2 months ago) by jake
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +3 -3 lines
- Change the allproc_lock to use a macro, ALLPROC_LOCK(how), instead
  of explicit calls to lockmgr.  Also provides macros for the flags
  pased to specify shared, exclusive or release which map to the
  lockmgr flags.  This is so that the use of lockmgr can be easily
  replaced with optimized reader-writer locks.
- Add some locking that I missed the first time.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Wed Nov 22 07:41:57 2000 UTC (11 years, 2 months ago) by jake
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +9 -4 lines
Protect the following with a lockmgr lock:

	allproc
	zombproc
	pidhashtbl
	proc.p_list
	proc.p_hash
	nextpid

Reviewed by:	jhb
Obtained from:	BSD/OS and netbsd

Revision 1.84: download - view: text, markup, annotated - select for diffs
Thu Nov 9 08:25:47 2000 UTC (11 years, 3 months ago) by marcel
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +4 -2 lines
Make MINSIGSTKSZ machine dependent, and have the sigaltstack
syscall compare against a variable sv_minsigstksz in struct
sysentvec as to properly take the size of the machine- and
ABI dependent struct sigframe into account.

The SVR4 and iBCS2 modules continue to have a minsigstksz of
8192 to preserve behavior. The real values (if different) are
not known at this time. Other ABI modules use the real
values.

The native MINSIGSTKSZ is now defined as follows:

Arch		MINSIGSTKSZ
----		-----------
alpha		    4096
i386		    2048
ia64		   12288

Reviewed by: mjacob
Suggested by: bde

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sun Nov 5 10:41:34 2000 UTC (11 years, 3 months ago) by obrien
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +2 -2 lines
ELF kernels should use an ELF sysvec.  This allows us to move a.out
specific files to those platforms that acutally support a.out.

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

Revision 1.81: download - view: text, markup, annotated - select for diffs
Wed Oct 4 01:29:09 2000 UTC (11 years, 4 months ago) by jasone
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +4 -3 lines
Convert lockmgr locks from using simple locks to using mutexes.

Add lockdestroy() and appropriate invocations, which corresponds to
lockinit() and must be called to clean up after a lockmgr lock is no
longer needed.

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

Reviewed in general by:	mckusick, dillon

Revision 1.79: download - view: text, markup, annotated - select for diffs
Sun Sep 10 13:54:52 2000 UTC (11 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +2 -2 lines
Move the include of <sys/systm.h> so that KTR gets a declaration for
snprintf().

Revision 1.73.2.2: download - view: text, markup, annotated - select for diffs
Tue Jul 25 08:20:19 2000 UTC (11 years, 6 months ago) by green
Branches: RELENG_4
CVS tags: RELENG_4_2_0_RELEASE, RELENG_4_1_1_RELEASE, RELENG_4_1_0_RELEASE
Diff to: previous 1.73.2.1: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.1: +33 -4 lines
MFC: check for truncated files and also set VTEXT on external included files

Approved by:	jkh

Revision 1.78: download - view: text, markup, annotated - select for diffs
Sun Jul 23 22:19:49 2000 UTC (11 years, 6 months ago) by green
Branches: MAIN
CVS tags: PRE_SMPNG
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +4 -3 lines
Using an atomic operation here won't help if nobody else uses them (for
this).  Use the simple_lock() on v_interlock like elsewhere.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sun Jul 23 08:59:18 2000 UTC (11 years, 6 months ago) by green
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +1 -1 lines
Clarification (forced commit):
The immutability flag referred to in the previous revision is actually
VTEXT, not VEXEC.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Sun Jul 23 06:49:46 2000 UTC (11 years, 6 months ago) by green
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +32 -4 lines
Solve the problem where it is possible to get the kernel stuck in
a loop down in pmap_init_pt().  A subtraction causes the number of
pages to become negative, that was assigned to an unsigned variable,
and there is a lot of iteration.  The bug is due to the ELF image
activator not properly checking for its files being the correct size
as specified by the ELF header.

The solution is to check that the header doesn't ask for part of a
file when that part of the file doesn't exist.  Make sure to set
VEXEC at the proper times to make the executables immutable (remove
race conditions).  Also, the ELF format specifiies header entries
that allow embedding of other executables (hence how ld-elf.so.1
gets loaded, but not the same as loading shared libraries), so those
executables need to be set VEXEC, too, so they're immutable.

Reviewed by:	peter

Revision 1.73.2.1: download - view: text, markup, annotated - select for diffs
Thu Jul 6 22:26:40 2000 UTC (11 years, 7 months ago) by obrien
Branches: RELENG_4
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +28 -27 lines
MFC:  Change our ELF binary branding to match the SCO (as USL) method in
      the latest SVR4 ELF spec.

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

Generated by:	src/tools/tools/kerninclude

Revision 1.74: download - view: text, markup, annotated - select for diffs
Tue Apr 18 02:39:20 2000 UTC (11 years, 9 months ago) by obrien
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +27 -30 lines
Change our ELF binary branding to something more acceptable to the Binutils
maintainers.

After we established our branding method of writing upto 8 characters of
the OS name into the ELF header in the padding; the Binutils maintainers
and/or SCO (as USL) decided that instead the ELF header should grow two new
fields -- EI_OSABI and EI_ABIVERSION.  Each of these are an 8-bit unsigned
integer.  SCO has assigned official values for the EI_OSABI field.  In
addition to this, the Binutils maintainers and NetBSD decided that a better
ELF branding method was to include ABI information in a ".note" ELF
section.

With this set of changes, we will now create ELF binaries branded using
both "official" methods.  Due to the complexity of adding a section to a
binary, binaries branded with ``brandelf'' will only brand using the
EI_OSABI method.  Also due to the complexity of pulling a section out of an
ELF file vs. poking around in the ELF header, our image activator only
looks at the EI_OSABI header field.

Note that a new kernel can still properly load old binaries except for
Linux static binaries branded in our old method.

  *
  * For a short period of time, ``ld'' will also brand ELF binaries
  * using our old method.  This is so people can still use kernel.old
  * with a new world.  This support will be removed before 5.0-RELEASE,
  * and may not last anywhere upto the actual release.  My expiration
  * time for this is about 6mo.
  *

Revision 1.73: download - view: text, markup, annotated - select for diffs
Mon Feb 28 06:36:45 2000 UTC (11 years, 11 months ago) by ps
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_0_0_RELEASE
Branch point for: RELENG_4
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +4 -3 lines
Update a comment in elf_coredump to reflect that if you madvise
with MADV_NOCORE, its address space is also excluded from a core
file.

Pointed out by:	alc

Revision 1.72: download - view: text, markup, annotated - select for diffs
Mon Feb 28 04:10:33 2000 UTC (11 years, 11 months ago) by ps
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +8 -1 lines
Add MAP_NOCORE to mmap(2), and MADV_NOCORE and MADV_CORE to madvise(2).
This
This feature allows you to specify if mmap'd data is included in
an application's corefile.

Change the type of eflags in struct vm_map_entry from u_char to
vm_eflags_t (an unsigned int).

Reviewed by:	dillon,jdp,alfred
Approved by:	jkh

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

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

Revision 1.44.2.8: download - view: text, markup, annotated - select for diffs
Sat Nov 27 03:07:10 1999 UTC (12 years, 2 months ago) by bp
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE, RELENG_3_4_0_RELEASE
Diff to: previous 1.44.2.7: preferred, colored; branchpoint 1.44: preferred, colored; next MAIN 1.45: preferred, colored
Changes since revision 1.44.2.7: +4 -2 lines
MFC: vnode can be left referenced if an ELF image is broken.

Approved by:	jkh
Reviewed by:	peter

Revision 1.69: download - view: text, markup, annotated - select for diffs
Sun Nov 21 12:38:16 1999 UTC (12 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +2 -2 lines
s/p_cred->pc_ucred/p_ucred/g

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sat Nov 20 03:03:14 1999 UTC (12 years, 2 months ago) by bp
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +4 -2 lines
Vnode was left referenced in the case if ELF image is broken.

Reviewed by:	Peter Wemm <peter@netplex.com.au>

Revision 1.67: download - view: text, markup, annotated - select for diffs
Tue Nov 16 10:56:04 1999 UTC (12 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +2 -2 lines
This is a partial commit of the patch from PR 14914:

   Alot of the code in sys/kern directly accesses the *Q_HEAD and *Q_ENTRY
   structures for list operations.  This patch makes all list operations
   in sys/kern use the queue(3) macros, rather than directly accessing the
   *Q_{HEAD,ENTRY} structures.

This batch of changes compile to the same object files.

Reviewed by:    phk
Submitted by:   Jake Burkholder <jake@checker.org>
PR:     14914

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

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

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

Revision 1.65: download - view: text, markup, annotated - select for diffs
Mon Oct 11 15:19:08 1999 UTC (12 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +1 -2 lines
Trim unused options (or #ifdef for undoc options).

Submitted by:	phk

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

Revision 1.44.2.7: download - view: text, markup, annotated - select for diffs
Wed Sep 1 06:12:01 1999 UTC (12 years, 5 months ago) by sef
Branches: RELENG_3
CVS tags: RELENG_3_3_0_RELEASE
Diff to: previous 1.44.2.6: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.6: +9 -45 lines
MFC:  clean up the coredump routines a bit, eliminating some duplicate
code.

Reviewed by:	julian

Revision 1.64: download - view: text, markup, annotated - select for diffs
Wed Sep 1 00:29:52 1999 UTC (12 years, 5 months ago) by julian
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +9 -45 lines
General cleanup of core-dumping code.

Submitted by: Sean Fagan,

Revision 1.44.2.6: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:25:54 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
Diff to: previous 1.44.2.5: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.5: +1 -1 lines
$Id$ -> $FreeBSD$

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

Revision 1.44.2.5: download - view: text, markup, annotated - select for diffs
Thu Aug 26 17:35:03 1999 UTC (12 years, 5 months ago) by dima
Branches: RELENG_3
Diff to: previous 1.44.2.4: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.4: +3 -3 lines
MFC: don't follow symlinks on coredumps

Revision 1.62: download - view: text, markup, annotated - select for diffs
Thu Aug 26 17:32:48 1999 UTC (12 years, 5 months ago) by dima
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +3 -3 lines
Don't follow symlinks on coredumps.

Reviewed by:	dillon && security-officer

Revision 1.44.2.4: download - view: text, markup, annotated - select for diffs
Thu Jul 15 13:01:54 1999 UTC (12 years, 6 months ago) by marcel
Branches: RELENG_3
Diff to: previous 1.44.2.3: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.3: +8 -5 lines
MFC: handle interpreter loading in chroot'd env.

PR: 10145
Reviewed by: peter

Revision 1.61: download - view: text, markup, annotated - select for diffs
Fri Jul 9 19:10:14 1999 UTC (12 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +5 -7 lines
Fix the previous warning a different way since the emul_path exposure was
intentional.  Avoid the warning by propagating the const filename through
to elf_load_file() instead.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Fri Jul 9 18:05:03 1999 UTC (12 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +3 -2 lines
Minor tweak - don't cause a warning.
I don't know if it was intentional or not, but it would have printed out:
  /compat/linux/foo/bar.so: interpreter not found
If it was, then I've broken it.  De-constifying the 'interp' variable
or carrying the constness through to elf_load_file() are alternatives.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Mon Jul 5 18:38:29 1999 UTC (12 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +11 -7 lines
Also try to load the interpreter without prepending "emul_path". This allows
dynamicly linked binaries to run in a chroot'd environment with "emul_path"
as the new root. The new behavior of loading interpreters is identical to the
principle of overlaying.

PR: 10145

Revision 1.58: download - view: text, markup, annotated - select for diffs
Mon May 17 00:53:38 1999 UTC (12 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +3 -14 lines
Add the options MAP_PREFAULT and MAP_PREFAULT_PARTIAL to vm_map_find/insert,
eliminating the need for the pmap_object_init_pt calls in imgact_* and
mmap.

Reviewed by:	David Greenman <dg@root.com>

Revision 1.57: download - view: text, markup, annotated - select for diffs
Fri May 14 23:09:00 1999 UTC (12 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +3 -3 lines
Simplify vm_map_find/insert's interface: remove the MAP_COPY_NEEDED option.

It never makes sense to specify MAP_COPY_NEEDED without also specifying
MAP_COPY_ON_WRITE, and vice versa.  Thus, MAP_COPY_ON_WRITE suffices.

Reviewed by:	David Greenman <dg@root.com>

Revision 1.56: download - view: text, markup, annotated - select for diffs
Sun May 9 16:04:08 1999 UTC (12 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +1 -3 lines
Fix a couple of warnings and some bitrot in comments.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sat Feb 20 23:52:34 1999 UTC (12 years, 11 months ago) by jdp
Branches: MAIN
CVS tags: PRE_VFS_BIO_NFS_PATCH, PRE_SMP_VMSHARE, PRE_NEWBUS, POST_VFS_BIO_NFS_PATCH, POST_SMP_VMSHARE, POST_NEWBUS
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +38 -28 lines
If you merge this into -stable, please increment __FreeBSD_version
in "src/sys/sys/param.h".

Fix the ELF image activator so that it can handle dynamic linkers
which are executables linked at a fixed address.  This improves
compliance with the ABI spec, and it opens the door to possibly
better dynamic linker performance in the future.  I've experimented
a bit with a fixed-address dynamic linker, and it works fine.  But
I don't have any measurements yet to determine whether it's
worthwhile.

Also, remove a few calculations that were never used for anything.

I will increment __FreeBSD_version, since this adds a new capability
to the kernel that the dynamic linker might some day rely upon.

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

Reviewed by:	Alan Cox	<alc@cs.rice.edu>
		Matthew Dillion	<dillon@apollo.backplane.com>

Revision 1.44.2.3: download - view: text, markup, annotated - select for diffs
Mon Feb 8 18:58:36 1999 UTC (13 years ago) by jdp
Branches: RELENG_3
CVS tags: RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE, RELENG_3_1_0_RELEASE
Diff to: previous 1.44.2.2: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.2: +2 -2 lines
MFC: Load the ELF dynamic linker at an architecture-specific
location, thereby solving breakage that was observed in large-memory
configurations where MAXDSIZ had to be increased.  This merge
includes the following revisions:

	src/sys/kern/imgact_elf.c	1.52 -> 1.53
	src/sys/i386/include/elf.h	1.5  -> 1.6
	src/sys/alpha/include/elf.h	1.5  -> 1.6

Merge approved by <jkh>.

Revision 1.44.2.2: download - view: text, markup, annotated - select for diffs
Mon Feb 8 01:27:07 1999 UTC (13 years ago) by newton
Branches: RELENG_3
Diff to: previous 1.44.2.1: preferred, colored; branchpoint 1.44: preferred, colored
Changes since revision 1.44.2.1: +14 -1 lines
MFC -- Prevent emulators from being unloaded whilst they are being
used.

Reviewed by:	Jordan Hubbard <jkh@freebsd.org>

Revision 1.53: download - view: text, markup, annotated - select for diffs
Sun Feb 7 23:49:56 1999 UTC (13 years ago) by jdp
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +2 -2 lines
Change the load address of the ELF dynamic linker from "2L*MAXDSIZ"
to an architecture-specific value defined in <machine/elf.h>.  This
solves problems on large-memory systems that have a high value for
MAXDSIZ.

The load address is controlled by a new macro ELF_RTLD_ADDR(vmspace).
On the i386 it is hard-wired to 0x08000000, which is the standard
SVR4 location for the dynamic linker.

On the Alpha, the dynamic linker is loaded MAXDSIZ bytes beyond
the start of the program's data segment.  This is the same place
a userland mmap(0, ...) call would put it, so it ends up just below
all the shared libraries.  The rationale behind the calculation is
that it allows room for the data segment to grow to its maximum
possible size.

These changes have been tested on the i386 for several months
without problems.  They have been tested on the Alpha as well,
though not for nearly as long.  I would like to merge the changes
into 3.1 within a week if no problems have surfaced as a result of
them.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sun Feb 7 21:48:21 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +2 -2 lines
    Remove MAP_ENTRY_IS_A_MAP 'share' maps.  These maps were once used to
    attempt to optimize forks but were essentially given-up on due to
    problems and replaced with an explicit dup of the vm_map_entry structure.
    Prior to the removal, they were entirely unused.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Fri Feb 5 22:24:26 1999 UTC (13 years ago) by jdp
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +2 -2 lines
Correct an "&" operator which should have been "&&".

Submitted by:	mjacob

Revision 1.50: download - view: text, markup, annotated - select for diffs
Fri Feb 5 03:47:47 1999 UTC (13 years ago) by newton
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +1 -1 lines
Additional note on last rev:  The rationale for this is to allow you
to run Solaris executables (or executables from any other ELF system)
directly off the CD-ROM without having to waste megabytes of disk
by copying them to another filesystem just to brand them.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Fri Feb 5 03:43:18 1999 UTC (13 years ago) by newton
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +25 -1 lines
Created sysctl kern.fallback_elf_brand.  Defaults to "none", which will
give the same behaviour produced before today.  If sysadmin sets it
to a valid ELF brand, ELF image activator will attempt to run unbranded
ELF exectutables as if they were branded with that value.

Suggested by: Dima Ruban <dima@best.net>

Revision 1.48: download - view: text, markup, annotated - select for diffs
Thu Feb 4 12:42:31 1999 UTC (13 years ago) by newton
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +14 -1 lines
Provide elf_brand_inuse() as a method an emulator can use to find out
whether it is currently in use (which is kinda useful when it's about
to unload itself:  Lockups are never very much fun, are they?).

Revision 1.47: download - view: text, markup, annotated - select for diffs
Fri Jan 29 22:59:43 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +2 -2 lines
    *_execsw static structures cannot be const due to the way they interact
    with EXEC_SET, DECLARE_MODULE, and module_register.  Specifically,
    module_register.  We may eventually be able to make these const, but
    not now.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Wed Jan 27 21:49:55 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +14 -14 lines
        Fix warnings in preparation for adding -Wall -Wcast-qual to the
        kernel compile

Revision 1.44.2.1: download - view: text, markup, annotated - select for diffs
Wed Jan 27 20:51:41 1999 UTC (13 years ago) by julian
Branches: RELENG_3
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +1 -5 lines
MFC: Linux threads support is now default, to match -current
	Recompile the usual suspects!

Revision 1.45: download - view: text, markup, annotated - select for diffs
Tue Jan 26 02:38:10 1999 UTC (13 years ago) by julian
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +1 -5 lines
Enable Linux threads support by default.
This takes the conditionals out of the code that has been tested by
various people for a while.
ps and friends (libkvm) will need a recompile as some proc structure
changes are made.

Submitted by:	"Richard Seaman, Jr." <dick@tar.com>

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sat Dec 19 02:55:33 1998 UTC (13 years, 1 month ago) by julian
Branches: MAIN
CVS tags: RELENG_3_BP
Branch point for: RELENG_3
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +5 -1 lines
Reviewed by:	 Luoqi Chen, Jordan Hubbard
Submitted by:	 "Richard Seaman, Jr." <lists@tar.com>
Obtained from:	linux :-)

Code to allow Linux Threads to run under FreeBSD.

By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Fri Dec 4 22:54:51 1998 UTC (13 years, 2 months ago) by archie
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +3 -3 lines
Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sun Oct 25 17:44:50 1998 UTC (13 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +2 -4 lines
Nitpicking and dusting performed on a train.  Removes trivial warnings
about unused variables, labels and other lint.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sun Oct 18 15:55:12 1998 UTC (13 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +109 -164 lines
Some cleanups and optimizations:
- Use the system headers method for Elf32/Elf64 symbol compatability
- get rid of the UPRINTF debugging.
- check the ELF header for compatability much more completely
- optimize the section mapper.  Use the same direct VM interfaces that
  imgact_aout.c and kern_exec.c use.
- Check the return codes from the vm_* functions better.  Some return
  KERN_* results, not an errno.
- prefault the page tables to reduce startup faults on page tables like
  a.out does.
- reset the segment protection to zero for each loop, otherwise each
  segment could get progressively more privs. (eg: if the first was
  read/write/execute, and the second was meant to be read/execute, the
  bug would make the second r/w/x too.  In practice this was not a
  problem because executables are normally laid out with text first.)
- Don't impose arbitary limits.  Use the limits on headers imposed by
  the need to fit them into one page.
- Remove unused switch() cases now that the verbose debugging is gone.

I've been using an earlier version of this for a month or so.
This sped up ELF exec speed a bit for me but I found it hard to get
consistant benchmarks when I tested it last (a few weeks ago).
I'm still bothered by the page read out of order caused by the
transition from data to bss. This which requires either part filling the
transition page or clearing the remainder.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Fri Oct 16 03:55:00 1998 UTC (13 years, 3 months ago) by peter
Branches: MAIN
CVS tags: RELENG_3_0_0_RELEASE
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +2 -2 lines
*gulp*.  Jordan specifically OK'ed this..

This is the bulk of the support for doing kld modules.  Two linker_sets
were replaced by SYSINIT()'s.  VFS's and exec handlers are self registered.
kld is now a superset of lkm.  I have converted most of them, they will
follow as a seperate commit as samples.
This all still works as a static a.out kernel using LKM's.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Thu Oct 15 09:52:19 1998 UTC (13 years, 3 months ago) by dfr
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +2 -2 lines
Don't frob the user stack directly, use suword instead.  This fixes the
elf_freebsd_fixup() panic which many people have noticed on the alpha.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Tue Oct 13 08:24:40 1998 UTC (13 years, 4 months ago) by dg
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +4 -4 lines
Fixed two potentially serious classes of bugs:

1) The vnode pager wasn't properly tracking the file size due to
   "size" being page rounded in some cases and not in others.
   This sometimes resulted in corrupted files. First noticed by
   Terry Lambert.
   Fixed by changing the "size" pager_alloc parameter to be a 64bit
   byte value (as opposed to a 32bit page index) and changing the
   pagers and their callers to deal with this properly.
2) Fixed a bogus type cast in round_page() and trunc_page() that
   caused some 64bit offsets and sizes to be scrambled. Removing
   the cast required adding casts at a few dozen callers.
   There may be problems with other bogus casts in close-by
   macros. A quick check seemed to indicate that those were okay,
   however.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Oct 11 19:22:07 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +48 -59 lines
If an ELF executable has a recognized brand, then believe it.
Formerly, the heuristic involving the interpreter path took
precedence.

Also, print a better error message if the brand is missing or not
recognized.  If there is no brand at all, give the user a hint that
"brandelf" needs to be run.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Oct 3 04:12:09 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +7 -11 lines
Fix a bug which caused the dynamic linker pathname in the PT_INTERP
program header entry to be ignored if a recognized brand was found.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Wed Sep 16 02:04:05 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +188 -80 lines
Restore the core-dumping of all writable segments for ELF executables,
minus the NULL pointer dereference in rev. 1.33.  Also simplify
things somewhat by eliminating one traversal of the VM map entries.
Finally, eliminate calls to vm_map_{un,}lock_read() which aren't
needed here.  I originally took them from procfs_map.c, but here
we know we are dealing only with the map of the current process.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Tue Sep 15 22:23:12 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +68 -200 lines
Erk.  Revert back to 1.31, dumping only data and stack to the core
file, until I can solve a panic that has just cropped up.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Tue Sep 15 22:07:20 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +3 -2 lines
When choosing segments to write to the core file, don't assume that
writable implies readable.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Tue Sep 15 21:46:34 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +199 -68 lines
Instead of just the data and stack segments, include all writable
segments (except memory-mapped devices) in the ELF core file.  This
is really nice.  You get access to the data areas of all shared
libraries, and even to files that are mapped read-write.

In the future, it might be good to add a new resource limit in the
spirit of RLIMIT_CORE.  It would specify the maximum sized writable
segment to include in core dumps.  Segments larger than that would
be omitted.  This would be useful for programs that map very large
files read/write but that still would like to get usable core dumps.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Mon Sep 14 22:46:04 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +280 -16 lines
Viola!  The kernel now generates standard ELF core dumps for ELF
executables.

Currently only data and stack are included in the core dumps.  I am
looking into adding the other (mmapped) writable segments as well.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Mon Sep 14 05:36:49 1998 UTC (13 years, 4 months ago) by jdp
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +11 -2 lines
Add provisions for variant core dump file formats, depending on the
object format of the executable being dumped.  This is the first
step toward producing ELF core dumps in the proper format.  I will
commit the code to generate the ELF core dumps Real Soon Now.  In
the meantime, ELF executables won't dump core at all.  That is
probably no less useful than dumping a.out-style core dumps as they
have done until now.

Submitted by:	Alex <garbanzo@hooked.net> (with very minor changes by me)

Revision 1.29: download - view: text, markup, annotated - select for diffs
Wed Jul 29 18:39:35 1998 UTC (13 years, 6 months ago) by dfr
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +12 -5 lines
Default to FreeBSD if no brand detected.  This makes life easier when
bootstrapping from NetBSD/alpha.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Wed Jul 15 05:00:26 1998 UTC (13 years, 6 months ago) by bde
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +3 -3 lines
Cast u_longs to uintptr_t before casting them to pointers.  Don't
attempt to even partially support systems with function pointers
larger than object pointers.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Sat Jul 11 10:28:47 1998 UTC (13 years, 7 months ago) by bde
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +5 -5 lines
Fixed printf format errors.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Mon Jun 8 09:19:35 1998 UTC (13 years, 8 months ago) by dfr
Branches: MAIN
CVS tags: PRE_NOBDEV
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +2 -2 lines
Fix a typo which prevented i386 elf from working at all (including Linux
emulated elf binaries).

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sun Jun 7 17:11:31 1998 UTC (13 years, 8 months ago) by dfr
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +50 -22 lines
This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.

Revision 1.12.2.2: download - view: text, markup, annotated - select for diffs
Wed May 13 07:04:51 1998 UTC (13 years, 9 months ago) by tg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_8_RELEASE, RELENG_2_2_7_RELEASE
Diff to: previous 1.12.2.1: preferred, colored; branchpoint 1.12: preferred, colored
Changes since revision 1.12.2.1: +2 -1 lines
MFC: Translate some traps to SIGSEGV instead of SIGBUS when running under
Linux emulation.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Tue Apr 28 18:15:07 1998 UTC (13 years, 9 months ago) by eivind
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -1 lines
Translate T_PROTFLT to SIGSEGV instead of SIGBUS when running under
Linux emulation.  This make Allegro Common Lisp 4.3 work under
FreeBSD!

Submitted by: Fred Gilham <gilham@csl.sri.com>
Commented on by: bde, dg, msmith, tg
Hoping he got everything right:  eivind

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sat Mar 28 13:24:52 1998 UTC (13 years, 10 months ago) by bde
Branches: MAIN
CVS tags: PRE_DEVFS_SLICE, POST_DEVFS_SLICE
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -3 lines
Removed unused #includes.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Mon Mar 2 05:47:58 1998 UTC (13 years, 11 months ago) by peter
Branches: MAIN
CVS tags: PRE_SOFTUPDATE, POST_SOFTUPDATE
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +49 -150 lines
Update the ELF image activator to use some of the exec resources rather
than rolling it's own.  This means that it now uses the "safe"
exec_map_first_page() to get the ld.so headers rather than risking a panic
on a page fault failure (eg: NFS server goes down).
Since all the ELF tools go to a lot of trouble to make sure everything
lives in the first page for executables, this is a win.  I have not seen
any ELF executable on any system where all the headers didn't fit in the
first page with lots of room to spare.
I have been running variations of this code for some time on my pure ELF
systems.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Mon Feb 9 06:09:21 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +3 -3 lines
Staticize.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sun Sep 21 03:13:21 1997 UTC (14 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +5 -6 lines
We were (I think) missing a vrele() on the vnode for the object loaded
via PT_INTERP (usually /usr/libexec/ld-elf.so.1).

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sun Apr 13 01:48:21 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
CVS tags: pre_smp_merge, post_smp_merge, WOLLMAN_MBUF, BP_WOLLMAN_MBUF
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +4 -2 lines
Fully implement vfork.  Vfork is now much much faster than even our
	fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)

Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
	from the other threads of a group.

Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
	possible existing shares with other threads/processes.

Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
	thread from the rest of the group.

Fix the case where a thread does an exec.  It is almost nonsense for a thread
	to modify the other threads address space by an exec, so we
	now automatically divorce the address space before modifying it.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Apr 1 10:41:48 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +4 -8 lines
Use OID_AUTO instead of magic number for old sysctl debug.elf_trace.  The
magic number conflicted with the one for the Lite2 sysctl debug.busyprt.

Staticized some variables.

Removed unused #includes.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Sun Mar 23 03:36:16 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +2 -2 lines
Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:38:56 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Mon Feb 10 02:09:04 1997 UTC (15 years ago) by dyson
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +2 -2 lines
This is the kernel Lite/2 commit.  There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>

Revision 1.14: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:43:02 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.12.2.1: download - view: text, markup, annotated - select for diffs
Sun Dec 22 23:21:20 1996 UTC (15 years, 1 month ago) by joerg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_6_RELEASE, RELENG_2_2_5_RELEASE, RELENG_2_2_2_RELEASE, RELENG_2_2_1_RELEASE, RELENG_2_2_0_RELEASE
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +3 -1 lines
YAMFC: Make DFLDSIZ and MAXDSIZ fully-supported options.

(This commit is in the RELENG_2_2 branch, in case this ain't obvious
from the message.  I just don't know yet for sure.)

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Dec 22 23:17:02 1996 UTC (15 years, 1 month ago) by joerg
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +3 -1 lines
Make DFLDSIZ and MAXDSIZ fully-supported options.

"Don't forget to do a ``make depend''" :-)

Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Oct 24 19:13:00 1996 UTC (15 years, 3 months ago) by sos
Branches: MAIN
CVS tags: RELENG_2_2_BP
Branch point for: RELENG_2_2
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +2 -1 lines
Added a missing break, so all static bins would be missed :(

Revision 1.11: download - view: text, markup, annotated - select for diffs
Wed Oct 16 20:59:08 1996 UTC (15 years, 3 months ago) by sos
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +2 -2 lines
Oops forgot to remove a debug printf.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Wed Oct 16 17:51:05 1996 UTC (15 years, 3 months ago) by sos
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +76 -47 lines
Prepare kernel to take advantage of "branded" ELF binaries.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Thu Oct 3 06:14:48 1996 UTC (15 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +7 -7 lines
Drop an unused param to unmap_pages().

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat Aug 31 16:52:23 1996 UTC (15 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +7 -7 lines
Fixed the easy cases of const poisoning in the kernel.  Cosmetic.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Tue Jun 18 05:15:46 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +2 -1 lines
Clean-up the new VM map procfs code, and also add support for executable
format file "etype".  It contains a description of the binary type for
a process.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Jun 12 05:07:25 1996 UTC (15 years, 8 months ago) by gpalmer
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -3 lines
Clean up -Wunused warnings.

Reviewed by:		bde

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed May 1 02:42:43 1996 UTC (15 years, 9 months ago) by bde
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +4 -1 lines
Removed unnecessary #includes from <sys/imgact.h> so that it is
self-sufficient and added explicit #includes where required.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Mar 12 06:20:10 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
CVS tags: wollman_polling
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +4 -4 lines
Remove references to MAP_FILE..  That is now "default" and is only
a "#define MAP_FILE 0" that is still there for net-2 source compatability.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun Mar 10 23:44:40 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -4 lines
Tweak the data/bss segment page count. The last version worked
with all the test cases I tried, I'm sure this is more correct.

Tweak some prototypes.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Mar 10 22:37:34 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +22 -12 lines
Fix some rounding problems..  In some (fairly rare) situtaions it mapped
one page too many, which caused obreak() to fail in vm_map_find() with
ENOMEM because of the conflicting page.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Mar 10 08:42:54 1996 UTC (15 years, 11 months ago) by sos
Branches: MAIN
First attempt at FreeBSD & Linux ELF support.

Compile and link a new kernel, that will give native ELF support, and
provide the hooks for other ELF interpreters as well.

To make native ELF binaries use John Polstras elf-kit-1.0.1..
For the time being also use his ld-elf.so.1 and put it in
/usr/libexec.

The Linux emulator has been enhanced to also run ELF binaries, it
is however in its very first incarnation.
Just get some Linux ELF libs (Slackware-3.0) and put them in the
prober place (/compat/linux/...).
I've ben able to run all the Slackware-3.0 binaries I've tried
so far.
(No it won't run quake yet :)

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