Commit Graph

5731 Commits

Author SHA1 Message Date
msaitoh 2a1efa7be4 KNF. No functional change. 2019-04-17 09:21:57 +00:00
msaitoh d6117c1651 Rename ifreqo2n() and ifreqo2n() to IFREQO2N_43() and IFREQN2O_43():
- ifreqo2n() and ifreqn2o() are for COMPAT_43, so add _43 to the name.
 - Uppercase to make it clear those are macros.
2019-04-16 04:31:42 +00:00
pgoyette a17761b205 Clean up this mess and simplify, so that all the socket options get
handled correctly whether or not the compat_50 module is loaded.
2019-04-15 10:53:17 +00:00
pgoyette 68c01b4b73 Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c
and into its own source file, which is now included in the compat_50
module.

(Not sure how this got missed during the original [pgoyette-compat] work)
2019-04-15 02:07:11 +00:00
pgoyette 7757535d97 Only need to #include sys/vnode.h once 2019-04-14 11:35:54 +00:00
msaitoh 207c6b8a34 Restore sys/ioccom.h. 2019-04-11 04:43:40 +00:00
msaitoh 93496269b0 Remove unused macro definitions. OK'd by pgoyette. 2019-04-11 04:42:08 +00:00
msaitoh c18a0f90f4 Whitespace change. No functional change. 2019-04-10 04:37:00 +00:00
msaitoh b2878dcb9a Fix ifdata"o2n"() macro. This is not a real bug because this macro is not used
from anywhere. Both of SIOCGIFDATA and SIOCZIFDATA use "n2o" because
ZIFDATA is almost the same as GIFDATA except zeroing after read.
2019-04-10 04:28:03 +00:00
kre f0c708aa35 Revert previous (1.5) and return to the one before that (1.4), and
just allow things to be broken if this is used on a system where
register_t is int (32 bits) and long is 64 bits.    Badly broken...
2019-04-06 17:42:28 +00:00
kre c3497bd6b1 Revert previous. Instead change ufetch_long() to ufetch_int() in
both calls (and also remove the cast on the earlier).

These replaced fuword, to fetch a register_t (ie: int).
2019-04-06 17:27:58 +00:00
kre ada06fa419 If using a cast for &code to make it a u_long * is acceptable a
few lines earlier, it should work here too.
2019-04-06 16:22:09 +00:00
thorpej 91bfaeb675 Overhaul the API used to fetch and store individual memory cells in
userspace.  The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms.  The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
2019-04-06 03:06:23 +00:00
christos 03d46ac0fc make this compile again. 2019-03-26 02:05:28 +00:00
maxv ba0aa175c4 Remove compat_osf1, discussed on tech-kern@. 2019-03-25 19:24:29 +00:00
maxv 27667013cc regen 2019-03-24 16:39:46 +00:00
maxv ddc423bf95 Remove Alpha's compat_linux dependency on compat_osf1. Each function is
copied as-is from compat_osf1 with no functional change. Discussed on
tech-kern@, ok @thorpej.
2019-03-24 16:24:19 +00:00
maxv 6300e1b8c4 Disable preemption when setting PCB_COMPAT32, to prevent a context switch
before cpu_fsgs_reload() finishes, otherwise we write garbage in the GDT.
On NetBSD-current it is harmless, however in NetBSD-8 it might cause
panics, because NetBSD-8 uses the old SegRegs model and under this model
we reload %fs and %gs during switches.
2019-03-24 15:58:32 +00:00
maxv 46e1422377 Fix a tiny race in setregs and linux_setregs. Between the moment we set
pcb_flags to zero, and the moment cpu_segregs64_zero resets pcb_gs, we may
be preempted.

If this happens, and if the calling LWP was a 32bit thread, when switching
back to that LWP, the context switcher sees that PCB_COMPAT32 is not set in
pcb_flags and tries to perform a 64bit context switch; but pcb_gs contains
a 32bit GDT descriptor, and not a 64bit GS.base value. The wrmsr therefore
faults because the value is non-canonical, and this fault is fatal.

Rearrange the code so that the update of pcb_flags and pcb_gs/pcb_fs is non
interruptible. This fixes the problem, tested with a reproducer (which
therefore doesn't work anymore).

Likely fixes PR/53993.
2019-03-24 13:15:42 +00:00
christos 790b0fb0cc fix the build: include the needed osf1 files for compat_linux on alpha 2019-03-17 14:11:48 +00:00
pgoyette 95d5f8653d Regen 2019-03-03 22:26:58 +00:00
pgoyette f84972dd9b The compat_09_{get,set}domainname() syscalls should not be defined
based on existence of COMPAT_09.  Make them modular instead, and
reference the compat_09 module.
2019-03-03 22:26:30 +00:00
pgoyette b50e3080b4 Fix the required-list for compat_ultrix. With the merge of the
[pgoyette-compat] branch there is no longer a "compat" module;
instead we have lots of version-specific compat_xx modules.

Code inspection shows compat_ultrix uses compat_13 (and newer)
stuff, so set the requirements list accordingly.

Should fix PR port-pmax/54037
2019-03-03 22:25:00 +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
mrg 5c93bf3d7c this file was moved to netbsd32_compat_14_sysv.c. 2019-02-27 03:01:08 +00:00
rin 47c94a5c39 Push AT_STACKBASE. Otherwise, pthread_attr_getstack(3) cannot
find the stack address for initial thread (LID 1).

Now, rust for i386 and armv7 work on amd64 and aarch64,
respectively.
2019-02-26 06:28:43 +00:00
mrg fccaa949ae include libkern.h or strings.h. should fix i386 build issues. 2019-02-21 08:25:00 +00:00
mrg 543c86fd13 fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)
2019-02-21 05:02:20 +00:00
mrg 39e3203eaa for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles.  there
     are at least 3 different ones changed here.
2019-02-21 03:37:18 +00:00
mrg 2ca163b231 use KASSERTMSG() in netbsd32_ptr32i(). 2019-02-20 06:04:28 +00:00
mrg db4c90ad36 compat_sunos depends upon compat_09. fixes:
[   1.8785495] WARNING: module error: built-in module compat_sunos can't find builtin dependency `compat_09'
[   1.8785495] WARNING: module error: built-in module compat_sunos prerequisite compat_09 failed, error 2
2019-02-12 07:16:55 +00:00
mrg 109c3f6558 - expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
  inclusing an overflow check for NETBSD32PTR32PLUS().
2019-02-09 11:30:13 +00:00
pgoyette 92d3a36f58 Update compat_freebsd requirements list to use compat_09 vs compat 2019-02-05 00:40:15 +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
mrg c29615453d don't assume _LP64 == supports COMPAT_NETBSD32.
this is not true for alpha, ia64 and arm32 ports, and the first two
were not building because of it, and the latter would be missing
the oabi support (likely not a big deal, but still wrong.)

add a makefile fragment that tells you if it is supported and include
it where needed to define COMPAT_NETBSD32 when building the normal
kernel (ie, modules & rump.)


fixes alpha build, probably fixes ia64 build.


XXX: still leaves some netbsd32 code in rf_netbsdkintf.c, that should
     be moved into some hooks, but first the configuration setup
     needs to be moved into a common function the netbsd32 code can
     call into, vs living in the switch case itself.
2019-02-04 21:57:47 +00:00
mrg fd676684f8 - avoid uninitialised memory usage 2019-02-04 04:37:50 +00:00
thorpej 68e270a267 Implement support for "pshared" POSIX semaphores.
Fixes lib/53273 (and Firefox's multi-process tab feature).
2019-02-03 03:20:23 +00:00
mrg fbffadb9f8 - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily
2019-02-03 03:19:25 +00:00
isaki c23eabedab Correct debug messages. 2019-02-02 05:02:03 +00:00
isaki 8b1980912d Fix minor bugs of SNDCTL_DSP_GETISPACE.
- hiwat is playback-only parameter.
- 'bytes' should not be rounded down.
2019-02-02 04:52:16 +00:00
christos 909cb6d3de remove unused variable 2019-01-31 16:03:50 +00:00
pgoyette 4af666e3d9 Remove #ifdef COMPAT_80
The file will only be selected if "options COMPAT_80" is defined in
the config file.  The COMPAT_80 macro is defined only if the option
is explicitly defined, and not if it is implicitly defined due to
inclusion of lesser-version COMPATs.
2019-01-30 02:00:02 +00:00
isaki b29c14eced Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
  negative value.
- 'bytes' should not be rounded down.
2019-01-29 12:01:20 +00:00
pgoyette c1283e70fa Normalize all the compat hooks' names to the form
<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
2019-01-29 09:28:50 +00:00
pgoyette d35e644178 Rename the if43_20_hook to if43_cvtcmd_20_hook 2019-01-29 04:10:10 +00:00
pgoyette 88446f58e4 The if43_20_hook function returns an errno; use it to determine whether
to allow conversion of the ioctl cmd --> ncmd

Should address issue reported by msaitoh@ on irc as well as via e-mail
from Patrick Welche and Ryo ONODERA.
2019-01-29 04:01:45 +00:00
christos 40fd447032 - Don't expose random data conversion functions, but expose the high level
entry point (such as ioctl) instead.
- Attempt to autoload the module before using it.

Naming: Should the names of the hooks be:
    <category>_<version>_<function>_hook_t
or:
    <category>_<function>_<version>_hook_t

We should make those consistent.
2019-01-28 21:13:58 +00:00
mlelstv ac807d9782 add missing includes 2019-01-28 18:53:52 +00:00
christos c3850d5f86 - provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
2019-01-28 15:46:49 +00:00
pgoyette 9d6a100f98 Add the appropriate module glue. Seems to have gotten lost during
the merge.
2019-01-28 13:13:02 +00:00