Commit Graph

190 Commits

Author SHA1 Message Date
jdolecek 3e5fbb6583 remove special handling for symbolic links for COMPAT_43 lstat, it's
not necessary; this removes the only places in kernel which did namei
LOOKUP with LOCKPARENT

fixes diagnostic KASSERT() in namei() code

Reported-by: syzbot+628382ecf1438e53d08d@syzkaller.appspotmail.com
2020-06-24 10:28:16 +00:00
pgoyette 8a031a1d1e Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
2019-12-12 02:15:42 +00:00
christos e4c1bc56d0 use strlcpy() for the uts conversion, makes the code simpler and more readable. 2019-10-26 11:34:48 +00:00
christos e7aab04a49 make this compile again 2019-09-23 21:07:39 +00:00
christos eb654c054f Add a boolean argument to indicate if we have a path/true (execve) or an
fd/false (fexecve). This is needed to differentiate between them because
NULL/-1 can be readily passed from userland.
2019-09-17 15:19:27 +00:00
mrg 3663af43d9 pass new missing fd argument to execve1().
fixes sparc64 build.
2019-09-17 07:58:54 +00:00
msaitoh e19818fbdb KNF. No functional change. 2019-04-23 07:45:06 +00:00
pgoyette 8c2f80f160 Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
2019-03-01 11:06:55 +00:00
pgoyette ffe8188160 The sunos and sunos32 modules require compat_09, not compat (the
latter no longer exists).

Should fix "missing prerequisite" errors seen during qemu boot
of sparc64's MODULAR kernel.
2019-02-05 00:32:18 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
riastradh d1579b2d70 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!)
2018-09-03 16:29:22 +00:00
pgoyette fb243de875 Regen 2018-08-10 21:47:14 +00:00
pgoyette 3cd7406ad8 Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys.  Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

	sys/arch/usermode/modules/syscallemu/syscallemu.c
2018-08-10 21:44:58 +00:00
kamil 2f1d1558aa Remove an element from struct emul: e_tracesig
e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
2018-05-06 13:40:50 +00:00
maya 45b55008a4 remove struct emul's e_fault.
It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
2018-01-09 20:55:42 +00:00
kamil f98f70a745 Revert vadvise(2) removal
This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
2018-01-06 16:41:23 +00:00
kamil 3805245bdb compat/sunos32: Drop SYS_vadvise
The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
2017-12-19 19:19:50 +00:00
kamil 7211c03683 compat/sunos32: Drop SYS_sbrk
sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
2017-12-19 18:25:53 +00:00
kamil 3d589eb938 compat sunos32: Drop the sstk(2) syscall
sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
2017-12-19 08:24:41 +00:00
riastradh 39f1e86852 Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.

From Ilja Van Sprundel.
2017-07-28 15:34:06 +00:00
riastradh 9c32900485 regen 2017-05-10 06:19:47 +00:00
christos 410aba1317 regen 2017-01-16 17:43:04 +00:00
christos d8dfcd6c2a regen 2017-01-13 06:18:31 +00:00
khorben 9e87b310f4 Add missing newline character in error message
This is related to kern/50469.
2016-02-28 23:24:35 +00:00
mlelstv 9e54402661 PR 50517 bad switch 2015-12-11 08:10:43 +00:00
christos 8d10f96266 Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
2015-12-08 20:36:14 +00:00
maxv ea498aca7e Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
2015-10-23 19:40:10 +00:00
maxv 6ad8aacf8e Make sure we have space for the aout header. 2015-10-18 16:59:19 +00:00
christos ec9d924643 rename sun ioctls 2015-09-26 04:13:39 +00:00
christos 9451a2b98d regen 2015-09-24 14:42:44 +00:00
christos d1ef60ebe3 regen 2015-03-07 16:38:49 +00:00
uebayasi 25e1f6dab9 Define compat modules (but without dependencies yet). 2014-11-17 01:01:57 +00:00
nakayama 599e52f863 Fix previous. There is no uap. 2014-09-05 22:37:09 +00:00
matt 45b1ec740d Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:20:59 +00:00
christos 54b7adb159 c99 initializers for struct execsw 2014-03-07 01:33:43 +00:00
christos 3b438d6a5c use new bsd.syscall.mk 2014-01-14 18:51:24 +00:00
njoly c0dc7e32cd Regen for dup/dup2/dup3 argument types fix. 2013-11-07 19:39:57 +00:00
njoly dffea6ad6b Fix dup/dup2/dup3 argument types (u_int -> int). 2013-11-07 19:37:18 +00:00
christos 721e82b55a exec modules need to be of the exec kind 2013-09-19 18:50:35 +00:00
rmind ad12c77015 Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
2012-02-19 21:05:51 +00:00
matt 1d7f24ead8 Change old-style function defintions to C89 prototypes.
Approved by releng.
2012-02-12 16:34:06 +00:00
dholland 8f6ed30d57 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.
2010-11-19 06:44:33 +00:00
chs 33fa5ccbbf many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
 - support new-style (NPTL) linux pthreads on all platforms.
   clone() with CLONE_THREAD uses 1 process with many LWPs
   instead of separate processes.
 - move the contents of sys__lwp_setprivate() into a new
   lwp_setprivate() and use that everywhere.
 - update linux_release[] and linux32_release[] to "2.6.18".
 - adjust placement of emul fork/exec/exit hooks as needed
   and adjust other emul code to match.
 - convert all struct emul definitions to use named initializers.
 - change the pid allocator to allow multiple pids to refer to the same proc.
 - remove a few fields from struct proc that are no longer needed.
 - disable the non-functional "vdso" code in linux32/amd64,
   glibc works fine without it.
 - fix a race in the futex code where we could miss a wakeup after
   a requeue operation.
 - redo futex locking to be a little more efficient.
2010-07-07 01:30:32 +00:00
hannken 1423e65b26 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.
2010-06-24 12:58:48 +00:00
pooka cd4f4c9856 Remove nfssvc non-emulations I missed yesterday. 2010-03-03 11:02:34 +00:00
martin 5b7db4a698 Add prototype and forward declarations to make the empty nfs stub compile. 2010-03-03 10:56:47 +00:00
he 7a30544200 When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
2010-03-03 08:20:38 +00:00
pooka e4fb143734 regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
2010-03-02 21:14:43 +00:00
pooka 808ba2d476 remove nfssvc emulation (or non-emulation) 2010-03-02 21:09:21 +00:00
pooka c20692bba4 Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional.  nfs server was just a fancy
NOP anyway for all except Ultrix.  I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
2010-03-02 21:07:21 +00:00