Commit Graph

5996 Commits

Author SHA1 Message Date
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
andvar d7fca1ab3d fix typos in asymmetry, asymmetric(al), symmetrical. 2021-08-09 19:57:57 +00:00
skrll 075d1d6791 need <sys/param.h> for COHERENCY_UNIT
Minor KNF along the way.
2021-07-21 06:35:44 +00:00
pgoyette 8edb9139f9 PR port-xen/53130 was fixed and closed some time ago, so now we can
belatedly re-enable inclusion of the compat_60 x86 microcode code in
the loadable module.  (It was already being included in the built-in
version of the module.)
2021-05-25 16:50:49 +00:00
christos 25aecf51e6 All mips64 has compat_netbsd32 2021-04-25 22:27:08 +00:00
simonb a90ebf65fd Compile in compat32 syscall names all the time, as we do for native
syscall names.  Needed for dtrace.
2021-04-17 03:57:42 +00:00
mlelstv 0e3291df0d Add DIOCGDISKINFO compat. 2021-04-14 16:26:23 +00:00
christos 7ddbe09f70 regen 2021-04-14 02:45:58 +00:00
christos 51ba1c5af8 regen 2021-04-13 23:57:23 +00:00
mrg cb095f8494 GCC 10 does not like casting from one identical anonymous enum
to another enum.  supply some quietening cast.
2021-04-13 05:28:16 +00:00
simonb af1c0e7ba9 Centralise the setitimer() timer type validation in dosetitimer() as is
done with dogetitimer().
2021-04-03 12:57:21 +00:00
simonb a6c0d32ea0 In the compat setitimer(2) calls, don't validate which timer is being
used since dosetitimer() does this anyway.  The compat functions hadn't
been updated since ITIMER_MONOTONIC was introduced, so they reported
that that ITIMER_MONOTONIC timer was invalid.
2021-02-18 12:54:03 +00:00
simonb 562353e3cc In netbsd32___mount50() zero out the native fs_args union before use so
we don't pass stack garbage to the lower layers in the MNT_GETARGS case.

Fixes random errors like "Bad address" from "mount -vv" with nfs mounts.
2021-02-16 14:47:20 +00:00
skrll 496e2b659f G/C some old code that was for acorn26 2021-02-01 19:31:34 +00:00
wiz 833b5e5e34 Fix syntax error 2021-01-19 08:10:17 +00:00
simonb 3daa70af17 The read/write/send/recv system calls return ssize_t because -1 is
returned on error.  Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
2021-01-19 03:41:22 +00:00
simonb 650cb29c0b KNF consistency: No parentheses are needed around the return value. 2021-01-19 03:20:13 +00:00
simonb 59099a5539 Whitespace nits. 2021-01-19 02:40:07 +00:00
simonb d625a73d15 Also print mmap return value and error code #ifdef DEBUG_MMAP. 2021-01-19 01:47:58 +00:00
simonb ec694a9214 s/u_intN_t/uintN_t/ 2021-01-18 23:14:22 +00:00
simonb 9742d8845a Handle the SIOCGNBRINFO_IN6 ioctl for compat32. ndp -a works with
compat32 now.
2021-01-17 10:50:01 +00:00
simonb ee136dc536 Remove unused LIMITCHECK() macro (now contained in netbsd32_rlimit.c). 2021-01-15 03:51:41 +00:00
simonb 66fc845698 Remove some blank lines to group the VND and FSS ioctls together. 2021-01-14 23:30:50 +00:00
simonb 2b90ec0a6e Handle the KFILTER_BYFILTER and KFILTER_BYNAME ioctls for compat32.
Passes "atf kernel/kqueue/t_ioctl".
2021-01-14 08:22:51 +00:00
simonb f89159bb0d Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.
2021-01-14 08:00:45 +00:00
simonb 57e3a030a7 Handle rev 1.62 of kern/sys_lwp.c
make _lwp_park return the remaining time to sleep in the "ts" argument
   if it is a relative timestamp, as discussed in tech-kern.
for compat32.  Thanks skrll@ for some cleanup tips.
2021-01-14 02:51:52 +00:00
simonb e07073e587 Use netbsd32_* types instead of relying on __packed in the vnd ioctl
structures.  __packed didn't work on archs where 64-bit types were
64-bit aligned with a 32-bit ABI (eg MIPS n32).

OK mrg@
2021-01-14 02:43:04 +00:00
thorpej 1142b3532f malloc(9) -> kmem(9) 2020-12-19 22:10:56 +00:00
thorpej 30e584e46a Rewrite linux_sys_alarm() to use dogetitimer() / dosetitimer(), rather
than fiddling with process timers directly.
2020-12-04 00:26:16 +00:00
rin e07975543c Fix typo; s/__LP64/_LP64/ 2020-11-08 07:30:09 +00:00
pgoyette 7f78906306 Use opt_execfmt.h to get build options.
Only include elf32 hooks if we have elf32 defined and elf32 is not the
"native" emulation.  This allows for having compat_netbsd32 without
elf32 (although it's probably not too useful), and also enables arm's
old-ABI usage of compat_netbsd32.
2020-11-04 20:54:20 +00:00
christos f5c7935f9c PR/55780: Bernd Sieker: setsockopt in Linux emulation misses some options 2020-11-03 22:08:44 +00:00
pgoyette 575be43dde Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!
2020-11-01 18:51:02 +00:00
mgorny 62a92db07d Fix compat with Linux programs that use longer namelen for sockets
Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*.  If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
2020-10-24 09:01:56 +00:00
rin 7e5bbe7eb4 wait4(2): make error paths match with that of native wait4(2):
https://nxr.netbsd.org/xref/src/sys/kern/kern_exit.c#720
2020-10-15 23:06:06 +00:00
christos 0a6d6ce0fd TIOCGSID is used by tcgetsid() so it is not really compat :-)
This should reduce loading the compat module.
2020-10-10 15:59:41 +00:00
rin 94d6852a4a regen for getrandom(2) 2020-10-10 00:03:52 +00:00
rin 99d6145575 Teach about getrandom(2) to COMPAT_NETBSD32. 2020-10-10 00:00:54 +00:00
nia c32467e149 tty_43: Check a bitset from userspace is valid before shifting it
Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.

The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.

Found by UBSan.

Reported-by: syzbot+39cd551a05298b222756@syzkaller.appspotmail.com
2020-10-09 10:41:53 +00:00
christos 7c02b47ba1 make MAXTSIZ optional 2020-10-06 13:38:49 +00:00
msaitoh 811d5a8b03 s/parition/partition/ 2020-09-29 02:49:55 +00:00
mrg b8b349010a remove __packed from struct netbsd32_lsdisable. the structure
is already properly aligned (the embedded int64 already has
align(4) marker applied where needed.)

same size structure generated.
2020-09-07 03:12:51 +00:00
riastradh 9fc453562f 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@
2020-09-05 16:30:10 +00:00
thorpej c1a69249ed The conversion of FPU tracking to PCU rendered the fpcurlwp variable
unmaintained, which broke FP status info in the COMPAT_LINUX sigcontext.
Use the new API, which will at least be closer to correct.
2020-09-03 14:26:31 +00:00
christos c988d5c135 PR/55547: Dan Plassche: Fix BSD/OS binary emulation.
Centralize lcall sniffer and recognize the BSD/OS flavor.
2020-08-08 19:08:48 +00:00
christos bed7e9544b Fix the OTIOCGETD emulation. Line discipline 0 is NTTYDISC. 2020-08-08 19:04:58 +00:00
simonb 41b59d1a20 Add lockstat(1) ioctl handling.
mrg@: "looks ok."
2020-07-21 05:33:51 +00:00
maxv fdf397881b don't include opt_user_ldt.h when it is not needed 2020-07-19 13:55:08 +00:00
jmcneill 3e4f2cbfff Add BIOCSETWF32 (bpf) 2020-07-18 12:46:19 +00:00
msaitoh 0be10c48cf Don't accept negative value.
Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
2020-07-16 15:02:08 +00:00