Commit Graph

933 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
mlelstv
ac807d9782 add missing includes 2019-01-28 18:53:52 +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
pgoyette
8688c9b2af Include new compatability header 2019-01-28 01:09:52 +00:00
christos
d0aa71af11 remove dup 2019-01-27 02:55:02 +00:00
pgoyette
d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
maxv
563de8ca79 Fix kernel info leaks.
+ Possible info leak: [len=80, leaked=10]
	| #0 0xffffffff80bad7a7 in kleak_copyout
	| #1 0xffffffff8048e71b in netbsd32___msgctl50
	| #2 0xffffffff8022fb5b in netbsd32_syscall
	| #3 0xffffffff802096dd in handle_syscall
2018-12-27 09:57:16 +00:00
mrg
9ac9b69c0c remove duplicated prototypes and dated XXX comments. 2018-12-26 08:01:40 +00:00
mrg
95801aa71d quotactl is always included, regardless of options QUOTA. 2018-12-24 22:47:19 +00:00
mrg
299d0f9161 regen. 2018-12-24 21:27:37 +00:00
mrg
52745eef3f move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat.  mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
2018-12-24 21:27:05 +00:00
mrg
80c6128809 move rlimit and quota code into their own modules.
(netbsd32_netbsd.c should have only simple shims.  anything more
than copying arguments from one args struct to the other should
not be placed in this file.  still a couple more to move out.)
2018-12-24 20:44:39 +00:00
mrg
e939376101 fix style consistency.
remove obsolete comments or commented code.
NFC.
2018-12-24 20:39:17 +00:00
mrg
a00881118e pset_create() takes a pointer so it needs special handling. 2018-12-24 20:27:57 +00:00
mlelstv
c16d8e94b7 Restore netbsd32 compat code for new NPF ABI. 2018-11-25 17:58:29 +00:00
hannken
d22a72be5c Apply the recent fixes to {send,recv}mmsg() to their compat variants. 2018-11-14 17:51:37 +00:00
maxv
52b3c20338 Fix inverted logic, which leads to buffer overflow. Detected by kASan. 2018-11-12 06:53:43 +00:00
riastradh
1c1a78241c Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.
These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
2018-10-30 14:43:38 +00:00
rin
2d366d5dbb PR kern/53666
Correct misleading names of dummy variables. No binary changes intended.
2018-10-12 05:06:05 +00:00
christos
91dfd1d87a PR/53666: Rin Okuyama: tcpdump for i386 does not work with COMPAT_NETBSD32
on amd64. Add BIOCSRTIMEOUT32.
2018-10-11 15:23:22 +00:00
christos
013326ee26 comment out unused 2018-10-06 15:22:16 +00:00
rmind
39013e66c1 NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
  a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
  previous versions.  Also, different serialisation format means NPF
  connection/config saving and loading is not compatible with the
  previous versions either.

Thanks to christos@ for extra testing.
2018-09-29 14:41:35 +00:00
jdolecek
87baea7b5c fix DIOCLWEDGES to at least not fail with ENOTTY due to struct size difference,
but probably more needs to be done to work if any actual wedges are configured
2018-09-24 21:15:39 +00:00
jdolecek
d7f371cd0e add support for DIOCGSTRATEGY and DIOCSSTRATEGY 2018-09-24 21:08:08 +00:00
maxv
f922b0f6bd Remove the network ATM code. 2018-09-06 06:41:59 +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
maxv
b05dff87b2 remove dead references to IPF; also remove references to netccitt/, it was
removed 12 years ago.
2018-09-02 16:13:42 +00:00
mrg
1e7fd28d77 support nullfs in netbsd32. 2018-08-11 03:41:06 +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
rjs
e16227fa75 regen. 2018-07-31 21:02:00 +00:00
rjs
a7e2a2ec3f Add getsockopt2(). 2018-07-31 21:00:02 +00:00
maxv
62c8988166 Remove the kernel PMC code. Sent yesterday on tech-kern@.
This change:

 * Removes "options PERFCTRS", the associated includes, and the associated
   ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
   good.

 * Removes the PMC code of ARM XSCALE.

 * Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

 * Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
   definitions are put in sysarch.h.

 * Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
   and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
   netbsd32 and rump.

 * Removes the pmc_evid_t and pmc_ctr_t types.

 * Removes all the associated man pages. The sets are marked as obsolete.
2018-07-12 10:46:40 +00:00
kamil
c2b9ec1954 Fix sysctl(3):vm.minaddress in compat_netbsd32(8)
Cast minaddress from LP64-specific long (64-bit) to 32-bit long (int).

This value is usually 0 or 0+PAGE_SIZE. There is need to change type in
order to keep original code functional, without prompting the value with
'long long' or a similar approach.


There are more CTLTYPE_LONG with a need for fixes in the compat code:

uipc_usrreq.c
1975 CTLTYPE_LONG, "sendspace",
1981 CTLTYPE_LONG, "recvspace",
1987 CTLTYPE_LONG, "sendspace",
1993 CTLTYPE_LONG, "recvspace",
vfs_bio.c
1921 CTLTYPE_LONG, "bufmem",
1928 CTLTYPE_LONG, "bufmem_lowater",
1935 CTLTYPE_LONG, "bufmem_hiwater",

Sponsored by <The NetBSD Foundation>
2018-05-26 21:07:47 +00:00
kamil
d959277a02 Handle vm.maxaddress in compat_netbsd32(8)
Return VM_MAXUSER_ADDRESS32 instead of the 64-bit specific address.

Use CTLTYPE_INT instead of CTLTYPE_LONG in order to retain the same integer
type between 64-bit native kernel and 32-bit emulated program.

There probably should be CTLTYPE_LONG32 available for this purpose.

On NetBSD/i386:
vm.maxaddress=bfeff000

On NetBSD/amd64:
vm.maxaddress=7fbfdfeff000

On NetBSD/amd64 running i386 program:
vm.maxaddress=fffff000

A 32-bit program on the 64-bit kernel can use larger user space, this
difference is on purpose and expected.

Sponsored by <The NetBSD Foundation>
2018-05-26 18:18:19 +00:00
christos
2bd1a590c2 PR/53280: Andreas Gustafsson: Fix panic in the fdpass test. This is probably
the only 32 bit binary in the tests...
2018-05-13 00:04:23 +00:00
christos
8c3024a5dc regen 2018-05-10 02:36:26 +00:00
christos
255beb6c9c add {send,recv}mmsg 2018-05-10 02:36:07 +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