Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/kloader.c
RevisionDateAuthorComments
 1.32  11-Oct-2021  rin Switch to kmem(9).
 1.31  11-Oct-2021  rin Sort headers.
 1.30  11-Oct-2021  rin Zero clear sh_offset to indicate a section is unused.

Avoid kernel text being doubly allocated due to non-zero sh_offset for
unused sections.

None of MD codes and kern_ksyms.c use sh_type == SHT_NULL (yet?) to
determine whether a section is unused.
 1.29  29-Jun-2021  dholland Add containment for the cloning devices hack in vn_open.

Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)
 1.28  05-Sep-2020  riastradh branches: 1.28.6;
Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.27  11-Jun-2015  matt Move declaration of avail_start, avail_end to <machine/kloader.h>
 1.26  25-Jan-2014  skrll branches: 1.26.6;
More alignment spellos
 1.25  19-Nov-2010  dholland branches: 1.25.8; 1.25.18; 1.25.22;
add missing pathbuf_destroy on error path, noticed by enami

XXX: this code is wrong; it should not be calling namei and then
XXX: vn_open on the same nameidata.
 1.24  19-Nov-2010  dholland Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.23  12-Nov-2010  uebayasi kloader(4) accesses vm_page, pull in uvm/uvm.h.
 1.22  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.21  07-Feb-2010  uebayasi branches: 1.21.2; 1.21.4;
KNF.

XXX This should use bus_dma(9).
 1.20  14-Dec-2009  matt Use PRIxVADDR
 1.19  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.18  04-Jun-2008  ad branches: 1.18.6; 1.18.12; 1.18.16;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.17  28-Apr-2008  martin branches: 1.17.2;
Remove clause 3 and 4 from TNF licenses
 1.16  21-Mar-2008  ad branches: 1.16.2; 1.16.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.15  15-Dec-2007  perry branches: 1.15.6;
__FUNCTION__ -> __func__
 1.14  10-Dec-2007  he branches: 1.14.2;
Remove a now-unused local variable.
 1.13  08-Dec-2007  pooka branches: 1.13.2;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.12  21-Feb-2007  thorpej branches: 1.12.16; 1.12.18; 1.12.26;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.11  21-Jul-2006  ad branches: 1.11.10;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.10  14-May-2006  elad integrate kauth.
 1.9  20-Jan-2006  uwe branches: 1.9.2; 1.9.4; 1.9.6; 1.9.8; 1.9.10;
Use uintN_t.
 1.8  02-Jan-2006  uwe In kloader_open print errno if namei or vn_open fail.
Use consistent style for error messages.
While here, return NULL instead on 0 on error.
 1.7  11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6  24-Sep-2005  peter Remove the casts in the previous commit and use %zx.

Thanks to Simon Burge for pointing this out.
 1.5  24-Sep-2005  peter Add casts to make this compile when KLOADER_DEBUG is defined.
 1.4  24-Sep-2005  peter Fix two typos.
 1.3  31-May-2005  uwe branches: 1.3.2;
Preserve const in cast.
 1.2  17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.1  06-Jul-2004  uch branches: 1.1.2;
MI part of kloader moved to dev/kloader.c from arch/hpc/hpc/
dreamcast and playstation2 port are changed to use this.
 1.1.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.5  24-Jan-2005  skrll Adapt to branch.
 1.1.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2  03-Aug-2004  skrll Sync with HEAD
 1.1.2.1  06-Jul-2004  skrll file kloader.c was added on branch ktrace-lwp on 2004-08-03 10:44:54 +0000
 1.3.2.5  24-Mar-2008  yamt sync with head.
 1.3.2.4  21-Jan-2008  yamt sync with head
 1.3.2.3  26-Feb-2007  yamt sync with head.
 1.3.2.2  30-Dec-2006  yamt sync with head.
 1.3.2.1  21-Jun-2006  yamt sync with head.
 1.7.2.2  01-Feb-2006  yamt sync with head.
 1.7.2.1  15-Jan-2006  yamt sync with head.
 1.9.10.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.9.8.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.9.6.2  11-Aug-2006  yamt sync with head
 1.9.6.1  24-May-2006  yamt sync with head.
 1.9.4.1  01-Jun-2006  kardel Sync with head.
 1.9.2.1  09-Sep-2006  rpaulo sync with head
 1.11.10.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.12.26.1  26-Dec-2007  ad Sync with head.
 1.12.18.1  09-Jan-2008  matt sync with HEAD
 1.12.16.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.13.2.1  11-Dec-2007  yamt sync with head.
 1.14.2.1  02-Jan-2008  bouyer Sync with HEAD
 1.15.6.3  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.15.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.16.4.4  11-Aug-2010  yamt sync with head.
 1.16.4.3  11-Mar-2010  yamt sync with head
 1.16.4.2  04-May-2009  yamt sync with head.
 1.16.4.1  16-May-2008  yamt sync with head.
 1.16.2.2  17-Jun-2008  yamt sync with head.
 1.16.2.1  18-May-2008  yamt sync with head.
 1.17.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.16.1  26-Aug-2009  matt Fixup (all but mipsco) to deal the new realities in mipsland.
 1.18.12.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.6.1  28-Apr-2009  skrll Sync with HEAD.
 1.21.4.2  05-Mar-2011  rmind sync with head
 1.21.4.1  03-Jul-2010  rmind sync with head
 1.21.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.25.22.1  18-May-2014  rmind sync with head
 1.25.18.2  03-Dec-2017  jdolecek update from HEAD
 1.25.18.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.8.1  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.26.6.1  22-Sep-2015  skrll Sync with HEAD
 1.28.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed