Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/exec_elf.c
RevisionDateAuthorComments
 1.107  06-Dec-2024  riastradh sys/kern/kern_exec.c, exec_*.c: Sprinkle SET_ERROR dtrace probes.

PR kern/58378: Kernel error code origination lacks dtrace probes
 1.106  06-Dec-2024  riastradh sys/kern/kern_exec.c, exec_*.c: Sort includes.

No functional change intended.
 1.105  17-Aug-2023  rin exec_elf: Sort auxv entries by value of types

No significant changes intended.
Just for slightly nicer output for gdb "info auxv".
 1.104  26-Oct-2022  riastradh kern/exec_elf.c: Get emul_netbsd from sys/proc.h.
 1.103  08-Jun-2022  rin Do not warn for ELF note for FDO packaging metadata
(https://systemd.io/COREDUMP_PACKAGE_METADATA/),
found in userland binaries of Fedora 36.
 1.102  18-May-2021  hannken Remove a superfluous VOP_GETATTR() from elf_load_interp() and replace
the LK_EXCLUSIVE lock with a LK_SHARED lock.

The attributes requested were not used since Rev 1.25 of exec_elf32.c
from 1997/05/08 when mycroft GCd the va_mode check.
 1.101  12-Jan-2020  ad branches: 1.101.10; 1.101.12;
Tidy up the vnode locking around execve() on ELF images to acquire and
release the locks fewer times. Proposed on tech-kern a very long time go.
 1.100  16-Sep-2019  christos branches: 1.100.2;
PR/54549: ng0: always initialize execname.
 1.99  15-Sep-2019  christos Don't set AT_SUN_EXECNAME if we don't have a fully resolved name.
 1.98  07-Jun-2019  christos deduplicate the elf auxv builder code, welcome to 8.99.43
 1.97  12-Apr-2018  christos branches: 1.97.2;
ignore the ancient NetBSD emulation tag.
 1.96  18-Mar-2018  christos stsrt with an alignment of 1 (which means no alignment). From alnsn
 1.95  18-Mar-2018  christos Turn KASSERTS that check alignment which are user triggerable into errors.
From alnsn
 1.94  17-Mar-2018  christos CID/1427732: Don't dereference NULL execname if there is no emul_arg.
(there always is one in our emulations) from alnsn@
 1.93  07-Nov-2017  christos branches: 1.93.2;
Store full executable path in p->p_path as discussed in tech-kern.
This means that the full executable path is always available.

- exec_elf.c: use p->path to set AT_SUN_EXECNAME, and since this is
always set, do so unconditionally.
- kern_exec.c: simplify pathexec, use kmem_strfree where appropriate
and set p->p_path
- kern_exit.c: free p->p_path
- kern_fork.c: set p->p_path for the child.
- kern_proc.c: use p->p_path to return the executable pathname; the
NULL check for p->p_path, should be a KASSERT?
- exec.h: gc ep_path, it is not used anymore
- param.h: bump version, 'struct proc' size change

TODO:
1. reference count the path string, to save copy at fork and free
just before exec?
2. canonicalize the pathname by changing namei() to LOCKPARENT
vnode and then using getcwd() on the parent directory?
 1.92  16-Oct-2017  christos Setting AT_BASE on static binaries breaks TLS because they assume that
it is 0, will fix it differently.
 1.91  08-Oct-2017  christos For static PIE set the interpreter address to be the entry offset so we
don't lose it.
 1.90  21-Apr-2017  kamil branches: 1.90.4;
Enhance verbosity of debug message for ELF magic mismatch

Print e_ident[EI_MAG3] (it was missed)
Print e_ident[EI_CLASS] as it is used do determine correct ELF magic.

No functional change for non-debug (without option DEBUG_ELF) build.
 1.89  18-Feb-2017  chs obey the executable's ELF alignment constraints for PIE.
this fixes gdb of PIE binaries on mac68k (and other platforms
which use an ELF alignment that is larger than PAGE_SIZE).
 1.88  12-Feb-2017  uwe netbsd_elf_signature - look at note segments (phdrs) not note
sections. They point to the same data in the file, but sections are
for linkers and are not necessarily present in an executable.

The original switch from phdrs to shdrs seems to be just a cop-out to
avoid parsing multiple notes per segment, which doesn't really avoid
the problem b/c sections also can contain multiple notes.
 1.87  15-Sep-2016  christos branches: 1.87.2;
oops removed too much
 1.86  15-Sep-2016  christos Add debugging.
 1.85  25-May-2016  christos branches: 1.85.2;
randomize the location of the rtld.
 1.84  22-May-2016  christos reduce #ifdef mess caused by PaX
 1.83  08-May-2016  christos Move all the randomization inside kern_pax.c so we can control it directly.
Add debugging flags to be able to set the random number externally.
 1.82  19-Mar-2016  christos Allow enabling and disabling PaX ASLR debug
 1.81  26-Nov-2015  martin We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.
 1.80  01-Nov-2015  christos Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.
 1.79  01-Nov-2015  christos Add buildid Go note
 1.78  22-Oct-2015  maxv Check the error code from es_setup_stack, and correctly free ep_emul_arg if
it fails.

That bug is harmless, since ep_setup_stack never fails.
 1.77  26-Sep-2015  maxv Revamp the way processes are PaX'ed in the kernel. Sent on tech-kern@ two
months ago, but no one reviewed it - probably because it's not a trivial
change.

This change fixes the following bug: when loading a PaX'ed binary, the
kernel updates the PaX flag of the calling process before it makes sure
the new process is actually launched. If the kernel fails to launch the
new process, it does not restore the PaX flag of the calling process,
leaving it in an inconsistent state.

Actually, simply restoring it would be horrible as well, since in the
meantime another thread may have used the flag.

The solution is therefore: modify all the functions used by PaX so that
they take as argument the exec package instead of the lwp, and set the PaX
flag in the process *right before* launching the new process - it cannot
fail in the meantime.
 1.76  08-Aug-2015  maxv revert; but still fix the comment
 1.75  05-Aug-2015  maxv stupid comment, and make sure we are not executing a lib
 1.74  04-Aug-2015  maxv Some changes, to reduce a bit my tech-kern@ patch:
- move the P_PAX_ flags out of #ifdef PAX_ASLR in pax.h
- add a generic pax_flags_active() function
- fix a comment in exec_elf.c; interp is not static
- KNF for return
- rename pax_aslr() to pax_aslr_mmap()
- rename pax_segvguard_cb() to pax_segvguard_cleanup_cb()
 1.73  30-Jul-2015  maxv Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h
 1.72  27-Apr-2015  maxv Remove #ifdef notyet.
 1.71  20-Mar-2015  maxv Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.

Original report by uebayasi@
 1.70  17-Aug-2014  chs branches: 1.70.2;
eliminate COMPAT_OLDNOTE and just always recognize the old notes.
 1.69  08-Jul-2014  maxv branches: 1.69.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.
 1.68  06-Jul-2014  maxv Check .evs_used==0 instead of .evs_cmds==NULL. evs_cmds would not be NULL if
another _makecmds() had allocated and deallocated VMCMDs (not the case
currently).
 1.67  25-Jun-2014  christos Provide a compatibility define for binaries generated before NetBSD 1.5.
These binaries contain multiple notes per section and their NetBSD version
value is 199905. This is enabled via COMPAT_OLDNOTE (default off).
 1.66  15-May-2014  christos be a bit more verbose about why we think a note is bad.
 1.65  22-Mar-2014  maxv branches: 1.65.2;
Small changes:
- rename elf_load_file() to elf_load_interp()
- use the correct type for 'nused'
- remove useless cases
- reorder a kmem_alloc

ok christos@
 1.64  16-Mar-2014  maxv Remove the 'prot' argument from elf_load_psection(). It is not used
outside, and can be declared locally. Clearer.

ok christos@
 1.63  06-Mar-2014  matt add ep_entryoffset to exec_package so one can calculate the relocabase
of an ET_DYN image.
 1.62  27-Feb-2014  maxv We have to ensure the string is NUL-terminated and of the expected
length to avoid copying uninitialized data.

ok christos@
 1.61  22-Feb-2014  maxv Simplify error path.

ok christos@
 1.60  21-Feb-2014  maxv Properly check the section size to avoid out-of-bound reads. The
computed size must be the exact same size that is indicated in
sh_size.

ok agc@ christos@
 1.59  19-Feb-2014  maxv We need VMCMDs for a binary and its interpreter, so make sure we have
at least one VMCMD. This also prevents the kernel from using an
uninitialized pointer as entry point for the execution.

From me and Christos

ok christos@
 1.58  16-Feb-2014  maxv Small cleanup:
- make elf_load_file() and elf_load_psection() static
- make loops consistent
- 'nload' is not used - see rev1.24
- 'ap' is not used in elf_load_file()

ok agc@ christos@
 1.57  15-Feb-2014  christos initialize offset to 0 (Maxime Villard)
 1.56  15-Feb-2014  maxv Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@
 1.55  14-Feb-2014  maxv Fix memory leak.

ok christos@ agc@
 1.54  25-Jan-2014  christos __USING_TOPDOWN_VM is no more, __USE_TOPDOWN_VM...
 1.53  21-Dec-2013  skrll Check interp after reading it. Checking newly allocated memory doesn't
work.

Hi Christos.
 1.52  21-Dec-2013  christos Consistency checks for the length of the interpreter (the length includes
the trailing NUL): make sure it is not empty and has the proper length.
From Maxime Villard
 1.51  14-Nov-2013  martin As discussed on tech-kern: make TOPDOWN-VM runtime selectable per process
(offer MD code or emulations to override it).
 1.50  11-Nov-2013  martin Remove dead code
 1.49  05-Nov-2013  martin Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.
 1.48  30-Oct-2013  joerg Preserve NetBSD version from the ABI tag for compat use.
 1.47  10-Sep-2013  matt Support an optional MARCH ELF tag.
Store the MACHINE_ARCH of the executable in mdproc and override sysctl
so that value returned.
 1.46  26-Aug-2013  martin Fix a comment and a few minor optimizations:

* elf_check_header() already ensures eh.e_phnum > MAXPHNUM, so do not
test it again at the call site
* is_dyn == true implies a successfull call to elf_check_header(eh, ET_DYN),
so no need to call elf_check_header(eh, ET_EXEC)

From Maxime Villard.
 1.45  09-Apr-2013  skrll branches: 1.45.4;
Fix PAX build.
 1.44  08-Apr-2013  skrll Remove some set but unused variables
 1.43  05-Aug-2012  matt branches: 1.43.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.
 1.42  03-Aug-2012  matt Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...
 1.41  02-Jun-2012  christos put back missing break;
 1.40  02-Jun-2012  christos the gnu tag name is valid for both type 1 (abi) and type 3 (build id)
 1.39  22-May-2012  christos - Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.
 1.38  08-Apr-2012  martin Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
 1.37  11-Feb-2012  martin branches: 1.37.2;
Add a posix_spawn syscall, as discussed on tech-kern.
Based on the summer of code project by Charles Zhang, heavily reworked
later by me - all bugs are likely mine.
Ok: core, releng.
 1.36  04-Feb-2012  joerg Add AuxInfo record with the base address of the main thread.
 1.35  03-Feb-2012  matt Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.34  01-Feb-2012  matt Use kmem instead of malloc.
 1.33  19-Nov-2011  tls branches: 1.33.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.32  27-Aug-2011  reinoud branches: 1.32.2;
In execve1(), don't assume VM_MIN_ADDRESS is 0 for PIE executables.
 1.31  02-Aug-2011  christos Add SuSE note
 1.30  19-Jul-2011  christos don't produce diagnostics for GNU tags
 1.29  07-Mar-2011  joerg Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.28  15-Feb-2011  pooka augment comment
 1.27  07-Oct-2010  chs branches: 1.27.2; 1.27.4;
when we use a fake data section, make sure that the start is page-aligned.
 1.26  11-Sep-2010  chs always supply an auxiliary vector for linux ELF processes.
static executables (such as newer versions of /sbin/ldconfig)
require this to work properly. since static executables
also don't have a PT_PHDR entry, use the same heuristic as
linux does to provide a value for AT_PHDR in this case.
 1.25  07-Sep-2010  joerg Remember the end of the last text segment and set up a fake data segment
if size 0 and starting after the text segments, if no data segment was
found. Unbreaks sbrk on platforms where all loaded segments are
executable (PR 43817). The cast of executable segments after data
segments is left out for now.
 1.24  20-Aug-2010  joerg Allow ELF objects with more than two PT_LOAD sections. Go creates such
binaries by default with separate sections for executable, writeable
data and constants. Use the same heuristic as FreeBSD to match up the
text and data segment assumptions.
 1.23  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.22  06-Jun-2010  dholland Improve previous: there were two printfs and I'd only noticed and fixed
one of them. PR 43217.
 1.21  02-May-2010  dholland Don't printf a userspace pointer; print the copied-in kernel version
instead, now that it's readily available. Fixes PR 43217.
 1.20  02-Apr-2010  christos fix debugging printf.
 1.19  22-Mar-2010  drochner When choosing the start address of a dynamic (ie relocatable) executable,
respect the alignment in the ELF phdr.
Also, for correctness, use the maximum alignment of the PT_LOAD
sections rather than just the first one found.
Also, use more meaningful types.
 1.18  20-Mar-2010  christos more debugging compilation fixes.
 1.17  20-Mar-2010  christos fix debugging code.
 1.16  20-Mar-2010  christos minimize ifdefs and avoid duplicated code.
 1.15  19-Mar-2010  christos - Make maximum memory limits for various things #define constants and use the
consistently across the code.
- Re-do note parsing code to read the section headers instead of the program
headers because the new binutils merge all the note sections in one program
header. This fixes all the pax note parsing which has been broken for all
binaries built with the new binutils.
- Add diagnostics to the note parsing code to detect malformed binaries.
- Allocate and free note scratch space only once, not once per note.
 1.14  15-Mar-2010  christos rename DEBUG_ASLR -> PAX_ASLR_DEBUG
 1.13  22-Feb-2010  drochner branches: 1.13.2;
Run binaries with ELF_TYPE==DYN at virtual address PAGE_SIZE rather
than 0. This is still not the intent of PIE, but it allows them to
run with VA 0 disabled.
(The PAX_ASLR stuff which should deal with this needs work.)
CV: ----------------------------------------------------------------------
 1.12  14-Dec-2009  matt branches: 1.12.2;
Merge from matt-nb5-mips64
 1.11  17-Dec-2008  cegger branches: 1.11.2;
kill MALLOC and FREE macros.
 1.10  19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.9  20-Sep-1996  cgd branches: 1.9.78; 1.9.82; 1.9.86;
rename exec_elf.c to exec_elf32.c, since it execs 32-bit ELF. exec_elf32.c
was copied from exec_elf.c on the CVS server to keep the logs intact.
 1.8  14-Jun-1996  christos Merge pagedvn changes from OpenBSD and added mips defines. Also added
ELF_MAP_PAGE_ZERO define. The entry point computation is different than
the one OpenBSD uses.
 1.7  13-Jun-1996  christos - Pass the Elf exec header in the emulation dependent probe functions.
- remove static from elf_read_from().
 1.6  09-Feb-1996  christos branches: 1.6.4;
More proto fixes
 1.5  09-Feb-1996  fvdl Use a default, 'safe' address to map the loader to in case the an emulation-
specific probe function did not specify it. It picks the same address
as mmap() does for a non-fixed map at address 0. See also the comment
around a similar line of code in vm/vm_mmap.c.
 1.4  16-Jan-1996  fvdl * Don't rely on the protection bits of segments anymore to decide whether
it's text or data; use the entry point instead (this solves some trouble
with ELF executables with strange permissions)
* Incorporate some fixes from r_friedl@informatik.uni-kl.de sent to
netbsd-bugs a while ago
 1.3  16-Sep-1995  thorpej s/memcmp/bcmp/
 1.2  30-Jun-1995  christos Remove unused define
 1.1  22-Jun-1995  fvdl Generic mi ELF loader; delete Linux and Svr4 compat conf entries and
add generic ELF entry to exec_conf.c
 1.6.4.2  11-Dec-1996  mycroft From trunk:
Change the exec locking protocol to fix a deadlock.
 1.6.4.1  05-Dec-1996  rat Patch request from frank@fwi.uva.nl (Frank van der Linden)

>Fixes a problem with Linux ELF binaries which contain only one loadable
>section. The code expected 2 loadable sections (text and data), and if it
>did not get those totally wrong values for the data address and size were
>used.
 1.9.86.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.9.82.4  09-Oct-2010  yamt sync with head
 1.9.82.3  11-Aug-2010  yamt sync with head.
 1.9.82.2  11-Mar-2010  yamt sync with head
 1.9.82.1  04-May-2009  yamt sync with head.
 1.9.78.1  17-Jan-2009  mjf Sync with HEAD.
 1.11.2.2  19-Jan-2009  skrll Sync with HEAD.
 1.11.2.1  17-Dec-2008  skrll file exec_elf.c was added on branch nick-hppapmap on 2009-01-19 13:19:37 +0000
 1.12.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.12.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.13.2.4  21-Apr-2011  rmind sync with head
 1.13.2.3  05-Mar-2011  rmind sync with head
 1.13.2.2  03-Jul-2010  rmind sync with head
 1.13.2.1  30-May-2010  rmind sync with head
 1.27.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.27.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.32.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.2.3  30-Oct-2012  yamt sync with head
 1.32.2.2  23-May-2012  yamt sync with head.
 1.32.2.1  17-Apr-2012  yamt sync with head
 1.33.2.3  02-Jun-2012  mrg sync to latest -current.
 1.33.2.2  29-Apr-2012  mrg sync to latest -current.
 1.33.2.1  18-Feb-2012  mrg merge to -current.
 1.37.2.3  14-Jul-2017  snj Pull up following revision(s) (requested by uwe in ticket #1438):
sys/kern/exec_elf.c: revision 1.88 via patch
netbsd_elf_signature - look at note segments (phdrs) not note
sections. They point to the same data in the file, but sections are
for linkers and are not necessarily present in an executable.
The original switch from phdrs to shdrs seems to be just a cop-out to
avoid parsing multiple notes per segment, which doesn't really avoid
the problem b/c sections also can contain multiple notes.
 1.37.2.2  14-Feb-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1028):
sys/kern/exec_elf.c: revision 1.55
Fix memory leak.
ok christos@ agc@
 1.37.2.1  12-Apr-2012  riz branches: 1.37.2.1.4; 1.37.2.1.6;
Pull up following revision(s) (requested by martin in ticket #175):
sys/kern/kern_exit.c: revision 1.238
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.4
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.5
sys/uvm/uvm_extern.h: revision 1.183
lib/libc/gen/posix_spawn_fileactions.c: revision 1.2
sys/kern/kern_exec.c: revision 1.348
sys/kern/kern_exec.c: revision 1.349
sys/compat/netbsd32/syscalls.master: revision 1.95
sys/uvm/uvm_glue.c: revision 1.159
sys/uvm/uvm_map.c: revision 1.317
sys/compat/netbsd32/netbsd32.h: revision 1.95
sys/kern/exec_elf.c: revision 1.38
sys/sys/spawn.h: revision 1.2
sys/sys/exec.h: revision 1.135
sys/compat/netbsd32/netbsd32_execve.c: revision 1.34
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
Fix asynchronous posix_spawn child exit status (and test for it).
 1.37.2.1.6.1  14-Feb-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1028):
sys/kern/exec_elf.c: revision 1.55
Fix memory leak.
ok christos@ agc@
 1.37.2.1.4.1  14-Feb-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1028):
sys/kern/exec_elf.c: revision 1.55
Fix memory leak.
ok christos@ agc@
 1.43.2.3  03-Dec-2017  jdolecek update from HEAD
 1.43.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.1  23-Jun-2013  tls resync from head
 1.45.4.2  18-May-2014  rmind sync with head
 1.45.4.1  28-Aug-2013  rmind sync with head
 1.65.2.1  10-Aug-2014  tls Rebase.
 1.69.2.5  18-Mar-2017  snj Pull up following revision(s) (requested by uwe in ticket #1368):
sys/kern/exec_elf.c: revision 1.88 via patch
netbsd_elf_signature - look at note segments (phdrs) not note
sections. They point to the same data in the file, but sections are
for linkers and are not necessarily present in an executable.
The original switch from phdrs to shdrs seems to be just a cop-out to
avoid parsing multiple notes per segment, which doesn't really avoid
the problem b/c sections also can contain multiple notes.
 1.69.2.4  26-Jan-2016  riz Apply patch (requested by martin in ticket #1062):

sys/kern/exec_elf.c patch

Restore binary compatibility on sparc64 for old binaries.
[martin, ticket #1062]
 1.69.2.3  08-Nov-2015  riz Pull up following revision(s) (requested by christos in ticket #1019):
sys/kern/exec_elf.c: revision 1.79
sys/sys/exec_elf.h: revision 1.150
sys/sys/exec_elf.h: revision 1.151
sys/kern/exec_elf.c: revision 1.80
Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.
Add buildid Go note
 1.69.2.2  29-Mar-2015  martin Pull up following revision(s) (requested by maxv in ticket #650):
sys/compat/netbsd32/netbsd32_exec_elf32.c: revision 1.39
sys/kern/exec_elf.c: revision 1.71
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.18
sys/compat/linux/common/linux_exec_elf32.c: revision 1.92
sys/compat/svr4_32/svr4_32_exec_elf32.c: revision 1.24
Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.
Original report by uebayasi@
 1.69.2.1  18-Aug-2014  martin Pull up following revision(s) (requested by chs in ticket #32):
sys/kern/exec_elf.c: revision 1.70
eliminate COMPAT_OLDNOTE and just always recognize the old notes.
 1.70.2.8  28-Aug-2017  skrll Sync with HEAD
 1.70.2.7  05-Oct-2016  skrll Sync with HEAD
 1.70.2.6  29-May-2016  skrll Sync with HEAD
 1.70.2.5  22-Apr-2016  skrll Sync with HEAD
 1.70.2.4  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.70.2.3  22-Sep-2015  skrll Sync with HEAD
 1.70.2.2  06-Jun-2015  skrll Sync with HEAD
 1.70.2.1  06-Apr-2015  skrll Sync with HEAD
 1.85.2.3  26-Apr-2017  pgoyette Sync with HEAD
 1.85.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.85.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.87.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.90.4.1  20-Mar-2018  bouyer Pull up following revision(s) (requested by alnsn in ticket #644):
sys/kern/exec_elf.c: revision 1.95
sys/kern/exec_elf.c: revision 1.96
Turn KASSERTS that check alignment which are user triggerable into errors.
=46rom alnsn
stsrt with an alignment of 1 (which means no alignment). From alnsn
 1.93.2.4  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.93.2.3  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.93.2.2  07-Mar-2018  pgoyette Move the emul_find_root() and emul_find_interp() to a new file
subr_emul.c

The previous location was in exec_elf.c but that can get built
multiple times for a single kernel, so we could end up with
duplicate symbols.

Thanks to ,rg@ for the heads-up.
 1.93.2.1  06-Mar-2018  pgoyette Move necessary routines out of compat_util.c and into exec_elf.c

Once again, compat_util.c is only for modules, so move it back into
compat/common/files.common and out of kern/files.kern
 1.97.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.97.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.97.2.1  10-Jun-2019  christos Sync with HEAD
 1.100.2.1  17-Jan-2020  ad Sync with head.
 1.101.12.1  31-May-2021  cjep sync with head
 1.101.10.1  17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed