Home | History | Annotate | Download | only in netbsd32
History log of /src/sys/compat/netbsd32/netbsd32_compat_30.c
RevisionDateAuthorComments
 1.36  19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.35  31-Jan-2020  maxv branches: 1.35.6;
Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.
 1.34  17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.33  27-Jan-2019  pgoyette branches: 1.33.6;
Merge the [pgoyette-compat] branch
 1.32  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.31  05-Dec-2014  maxv branches: 1.31.16; 1.31.18;
User-triggerable kmem_alloc(0).

Ok martin@ christos@

User
 1.30  23-Apr-2010  rmind branches: 1.30.14; 1.30.18; 1.30.20; 1.30.28; 1.30.34; 1.30.36;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.29  26-Jan-2009  njoly branches: 1.29.4; 1.29.6;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.28  11-Jan-2009  christos merge christos-time_t
 1.27  19-Nov-2008  ad branches: 1.27.4;
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.26  24-Jun-2008  ad branches: 1.26.2; 1.26.4;
Replace references to getsock/getvnode.
 1.25  29-May-2008  mrg branches: 1.25.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.24  21-Mar-2008  ad branches: 1.24.2; 1.24.4; 1.24.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.23  20-Dec-2007  dsl branches: 1.23.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.22  08-Dec-2007  dsl branches: 1.22.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.21  30-Apr-2007  dsl branches: 1.21.6; 1.21.8; 1.21.16;
Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
 1.20  22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.19  18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.18  10-Mar-2007  dsl branches: 1.18.2; 1.18.4;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.17  04-Mar-2007  christos branches: 1.17.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16  09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15  14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.14  09-Nov-2006  cube - Make better use of COMPAT_XX type in syscalls.master
- Remove useless (thanks to COMPAT_XX behaviour) #ifdefs in
syscalls.master
- Make netbsd32_compat_43.c compiled per COMPAT_LINUX32 because the latter
needs stuff from it.

Fixes Perry's PR#34951.
 1.13  04-Aug-2006  yamt branches: 1.13.4; 1.13.6;
some filehandle syscall related changes.

- remove the support of variable-sized filehandle from compat version of
syscalls. (strictly speaking, it breaks abi. i don't think it's a problem
because this feature is short-lived and there are no affected in-tree
filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
 1.12  31-Jul-2006  martin Make filehandles opaque to userland
 1.11  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.10  13-Jul-2006  pavel do not protect the getfh syscall by
#if defined(NFS) || defined(NFSSERVER).
The native syscall also isn't.
 1.9  13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.8  27-May-2006  simonb branches: 1.8.2; 1.8.4;
Limit the size of any kernel buffers allocated by the VOP_READDIR
routines to MAXBSIZE.
 1.7  14-May-2006  elad branches: 1.7.2;
integrate kauth.
 1.6  05-May-2006  cube Move fhstat as sys___fhstat30 in netbsd32_fs.c because it doesn't belong
to netbsd32_netbsd.c (which incidentally means it had been broken for a
while I guess). Add compat_30 version.
 1.5  07-Mar-2006  thorpej branches: 1.5.2; 1.5.4;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.4  12-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8;
more proc to lwp problems.
 1.3  11-Dec-2005  christos merge ktrace-lwp.
 1.2  19-Aug-2005  christos branches: 1.2.6;
Fix lossage I created with the 64 bit ino_t change.
 1.1  19-Aug-2005  christos 64 bit inode changes.
 1.2.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1  19-Aug-2005  skrll file netbsd32_compat_30.c was added on branch ktrace-lwp on 2005-11-10 14:01:20 +0000
 1.4.8.4  11-Aug-2006  yamt sync with head
 1.4.8.3  26-Jun-2006  yamt sync with head.
 1.4.8.2  24-May-2006  yamt sync with head.
 1.4.8.1  13-Mar-2006  yamt sync with head.
 1.4.6.2  01-Jun-2006  kardel Sync with head.
 1.4.6.1  22-Apr-2006  simonb Sync with head.
 1.4.4.1  09-Sep-2006  rpaulo sync with head
 1.5.4.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.3  12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.5.2.2  11-May-2006  elad sync with head
 1.5.2.1  07-Mar-2006  elad file netbsd32_compat_30.c was added on branch elad-kernelauth on 2006-05-11 23:27:31 +0000
 1.7.2.1  19-Jun-2006  chap Sync with head.
 1.8.4.7  24-Mar-2008  yamt sync with head.
 1.8.4.6  21-Jan-2008  yamt sync with head
 1.8.4.5  03-Sep-2007  yamt sync with head.
 1.8.4.4  26-Feb-2007  yamt sync with head.
 1.8.4.3  30-Dec-2006  yamt sync with head.
 1.8.4.2  21-Jun-2006  yamt sync with head.
 1.8.4.1  27-May-2006  yamt file netbsd32_compat_30.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.8.2.1  13-Jul-2006  gdamore Merge from HEAD.
 1.13.6.1  10-Dec-2006  yamt sync with head.
 1.13.4.2  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.4.1  18-Nov-2006  ad Sync with head.
 1.16.2.3  07-May-2007  yamt sync with head.
 1.16.2.2  24-Mar-2007  yamt sync with head.
 1.16.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.17.2.3  27-May-2007  ad Sync with head.
 1.17.2.2  10-Apr-2007  ad Sync with head.
 1.17.2.1  13-Mar-2007  ad Sync with head.
 1.18.4.1  29-Mar-2007  reinoud Pullup to -current
 1.18.2.1  11-Jul-2007  mjf Sync with head.
 1.21.16.1  26-Dec-2007  ad Sync with head.
 1.21.8.1  09-Jan-2008  matt sync with HEAD
 1.21.6.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.22.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.23.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.23.6.3  29-Jun-2008  mjf Sync with HEAD.
 1.23.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.23.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.24.6.4  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.6.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.6.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.6.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.24.4.2  11-Aug-2010  yamt sync with head.
 1.24.4.1  04-May-2009  yamt sync with head.
 1.24.2.1  04-Jun-2008  yamt sync with head
 1.25.2.1  27-Jun-2008  simonb Sync with head.
 1.26.4.2  03-Mar-2009  skrll Sync with HEAD.
 1.26.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.26.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.27.4.2  04-Jan-2009  christos add new syscalls.
 1.27.4.1  19-Nov-2008  christos file netbsd32_compat_30.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.29.6.1  30-May-2010  rmind sync with head
 1.29.4.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.30.36.1  06-Apr-2015  skrll Sync with HEAD
 1.30.34.1  12-Dec-2014  martin Pull up following revision(s) (requested by maxv in ticket #314):
sys/compat/netbsd32/netbsd32_compat_30.c: revision 1.31
User-triggerable kmem_alloc(0).
Ok martin@ christos@
User
 1.30.28.1  14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.30.20.1  14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.30.18.1  03-Dec-2017  jdolecek update from HEAD
 1.30.14.1  14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.31.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.31.18.1  10-Jun-2019  christos Sync with HEAD
 1.31.16.14  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.31.16.13  03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.31.16.12  03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.31.16.11  25-Sep-2018  pgoyette Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
 1.31.16.10  23-Sep-2018  pgoyette Revert previous. Instead, don't put an entry for ntp_gettime in the
syscall package if we don't have NTP.
 1.31.16.9  23-Sep-2018  pgoyette Provide a dummy version of netbsd32_ntp_gettime for systems where NTP
isn't defined.
 1.31.16.8  11-Sep-2018  pgoyette Move the NTP compat_30 and compat_50 routines into the version-specific
modules.
 1.31.16.7  11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.31.16.6  11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.31.16.5  11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.31.16.4  11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.31.16.3  11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.31.16.2  10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.31.16.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.33.6.2  29-Feb-2020  ad Sync with head.
 1.33.6.1  17-Jan-2020  ad Sync with head.
 1.35.6.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed