Commit Graph

416 Commits

Author SHA1 Message Date
msaitoh 90313c06e6 Remove ryo@'s mail addresses. 2024-02-07 04:20:25 +00:00
christos 69e4d6a089 Add linux waitid(2) from GSoC 2023 (Theodore Preduta) 2023-08-18 19:41:18 +00:00
riastradh 695ce1f326 linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.

XXX pullup-8
XXX pullup-9
XXX pullup-10
2023-06-20 15:22:15 +00:00
riastradh 9234d94be5 compat_linux32: KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 12:29:26 +00:00
andvar e1541cea4e s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments. 2022-12-24 15:23:02 +00:00
ryo a9611366cf Fixed a bug in sigreturn that sigmask was not restored. 2021-12-03 09:20:23 +00:00
ryo dc0b6747b2 regen 2021-12-02 04:39:44 +00:00
ryo 8f021900d7 add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32 2021-12-02 04:29:47 +00:00
ryo 32432d676d regen 2021-11-27 21:15:53 +00:00
ryo 91864278e8 Add pselect6(2) system call to COMPAT_LINUX32 2021-11-27 21:15:07 +00:00
ryo d8c022cbc1 The changes on compat/linux/common/linux_termios.c should also
be applied to compat/linux32/common/linux_termios.c, and reduce diff.

- remove duplicate fd_putfile(). This will be done after "goto out;".
- catch up from compat/linux/common/linux_termios.c r1.26  TIOCSPTLCK
- catch up from compat/linux/common/linux_termios.c r1.37  (TCOOFF/TCOON) of the TCXONC
- catch up from compat/linux/common/linux_termios.c r1.39  FIOCLEX and FIONCLEX
2021-11-26 19:28:37 +00:00
christos e39d5bda2b Remove #error, fixes the build. I don't understand why this would not work
on big endian. We use this construct to convert pointers everywhere else.
2021-11-26 13:32:38 +00:00
ryo bbb9625b59 - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
2021-11-26 08:56:28 +00:00
ryo 2f5e5e7356 add support COMPAT_LINUX32 for aarch64 2021-11-25 03:08:03 +00:00
ryo beadc1746d Extra arguments for AT_HWCAP and AT_PLATFORM are now passed when executing linux32 binaries.
AT_SYSINFO (vsyscall) feature seems to be broken, so leave it commented out.
2021-11-25 02:48:00 +00:00
ryo 4c7a6a2247 The default name of the `exec_setup_stack' function for linux32 should be `linux32_exec_setup_stack',
and it should be defined in each arch.
declaration of linux32_exec_setup_stack() in linux32/amd64 has been removed because it does not exist.

NFC.
2021-11-25 02:38:56 +00:00
ryo b32efcfdb0 - Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.
2021-11-25 02:35:00 +00:00
ryo 5fe0554c47 - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
  sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
  common to linux_statat(), so that it can be used not only by
  linux32_sys_fstatat64() but also by other *statat() variants.
2021-11-25 02:27:08 +00:00
thorpej 0a15a2c8dc Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name.  NFC.
2021-11-01 05:07:15 +00:00
thorpej d007899a77 Regen for preadv(2) / pwritev(2). 2021-09-20 02:20:30 +00:00
thorpej 4d7b9c0523 Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-20 02:20:02 +00:00
thorpej 7a09b9c725 Regen for eventfd. 2021-09-20 00:09:33 +00:00
thorpej 4d055d8a83 Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-20 00:09:01 +00:00
thorpej 302264731f Regen for timerfd. 2021-09-19 23:52:07 +00:00
thorpej 185d6cd739 Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-19 23:51:36 +00:00
thorpej a108364ef2 Regen for POSIX timer syscalls. 2021-09-19 23:02:22 +00:00
thorpej 555b185132 Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
2021-09-19 23:01:49 +00:00
thorpej 378fefbc77 Remove redundant linux32_to_native_timespec() prototype. 2021-09-19 22:32:45 +00:00
thorpej f8497a9ef8 Add routines to convert from linux32 to native sigevent_t. 2021-09-19 22:30:28 +00:00
thorpej 7784aaf6db G/C some unused (and unnecessary) definitions. 2021-09-19 22:09:31 +00:00
riastradh 41aa5859b6 sys/compat: Memset zero before copyout.
Just in case of uninitialized padding which would lead to kernel
stack disclosure.  If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
2021-09-07 11:43:02 +00:00
msaitoh 0be10c48cf Don't accept negative value.
Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
2020-07-16 15:02:08 +00:00
ad ba90a6ba38 Counter tweaks:
- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
  each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
  for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one().  It has no users and doesn't save a whole lot.
  For the cheap option, give cpu_count_sync() a boolean parameter indicating
  that a cached value is okay, and rate limit the updates for cached values
  to hz.
2020-06-11 22:21:05 +00:00
ad 4b8a875ae2 uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched.  It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
2020-06-11 19:20:42 +00:00
thorpej 6430fcd5ce Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG.  This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object.  Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
2020-05-03 01:06:55 +00:00
thorpej d69d0e707c Oops, fix a silly mistake in the Linux futex syscall stubs -- we also
copy in the timeout for FUTEX_WAIT_BITSET.
2020-04-29 01:44:03 +00:00
thorpej cb9aba0e17 Regen for native futex calls. 2020-04-26 19:18:52 +00:00
thorpej 276ef22378 Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
2020-04-26 18:53:31 +00:00
thorpej a29147fa13 - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs.  It's now done
  in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
2020-04-19 20:31:59 +00:00
pgoyette 4af030e5b6 Deal with having to teardown sysctl entries in multiple sub-trees.
(This used to work, but I broke it recently.)
2020-03-21 16:28:56 +00:00
pgoyette 9120d4511b Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself.  These are not changed.
2020-03-16 21:20:09 +00:00
ad 5c06357c90 Rename uvm_free() -> uvm_availmem(). 2019-12-31 13:07:09 +00:00
ad ddd3a0be1e uvmexp.free -> uvm_free() 2019-12-21 13:00:20 +00:00
jdolecek d61dd23cbc regen 2019-11-09 23:45:07 +00:00
jdolecek 54412fca0b add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
2019-11-09 23:44:31 +00:00
kamil db47bebf8c Avoid signed integer overflow when convering linux timeval to timespec
Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.
2019-09-20 15:25:19 +00:00
maxv c72226f2f3 Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.
2019-08-23 13:49:12 +00:00
maxv 6efe604024 Put the printf under DEBUG_LINUX. 2019-08-23 12:49:59 +00:00
maxv db6b4ab166 Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.
2019-08-23 12:09:17 +00:00
maxv a447d94848 Fix info leaks in sigaltstack. 2019-08-23 08:31:11 +00:00