| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
To prevent a signed integer overflow in futex_requeue add a sanity check
to catch negative values of nrwake or nrrequeue.
Approved by: so
Security: EN-21:22.linux_futex
(cherry picked from commit 25b09d6f398ea8a260ee8e2e8209fd76c61e13ee)
(cherry picked from commit 43a58daffe7256f0948ce895fed9fae55dec98fc)
|
| |
|
|
|
|
|
|
|
|
|
| |
Add a trivial linux(4) splice(2) implementation, which simply
returns EINVAL. Fixes grep (grep-3.1-2build1).
PR: 218699
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=365034
|
| |
|
|
|
|
|
| |
Fix handling of ancillary data on non-AF_UNIX Linux sockets.
Notes:
svn path=/stable/12/; revision=364743
|
| |
|
|
|
|
|
|
|
| |
Implement an approximation of Linux MADV_DONTNEED semantics.
PR: 230160
Notes:
svn path=/stable/12/; revision=364729
|
| |
|
|
|
|
|
|
|
| |
Don't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364717
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add linux_madvise(2) instead of having Linux apps call the native
FreeBSD madvise(2) directly. While some of the flag values match,
most don't.
PR: kern/230160
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364715
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linuxulator depends on a fundamental kernel settings such as SMP. Many
of them listed in opt_global.h which is not generated while building
modules outside of a kernel and such modules never match real cofigured
kernel.
So, we should prevent our users from building obviously defective modules.
Therefore, remove the root cause of the building of modules outside of a
kernel - the possibility of building modules with DEBUG or KTR flags.
And remove all of DEBUG printfs as it is incomplete and in threaded
programms not informative, also a half of system call does not have DEBUG
printf. For debuging Linux programms we have dtrace, ktr and ktrace ability.
PR: 222861
Notes:
svn path=/stable/12/; revision=364712
|
| |
|
|
|
|
|
|
|
| |
Minor code cleanup; no functional changes.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364710
|
| |
|
|
|
|
|
|
|
|
| |
Make linux(4) use kern_setsockopt(9) instead of going through
sys_setsockopt. Just a cleanup; no functional changes.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364709
|
| |
|
|
|
|
|
|
|
|
| |
Make linux(4) use kern_getsockopt(9) instead of going through
sys_getsockopt(). It's a cleanup; no functional changes.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364708
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix Linux recvmsg(2) when msg_namelen returned is 0. Previously
it would fail with EINVAL, breaking some of the Python regression
tests.
While here, cap the user-controlled message length.
Note that the code doesn't seem to be copying out the new length
in either (success or failure) case. This will be addressed separately.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364707
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rework linux accept(2). This makes the code flow easier to follow,
and fixes a bug where calling accept(2) could result in closing fd 0.
Note that the code still contains a number of problems: it makes
assumptions about l_sockaddr_in being the same as sockaddr_in,
the EFAULT-related code looks like it doesn't work at all, and the
socket type check is racy. Those will be addressed later on;
I'm trying to work in small steps to avoid breaking one thing while
fixing another.
It fixes Redis, among other things.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364706
|
| |
|
|
|
|
|
|
|
|
| |
Make linux(4) support SO_PROTOCOL. Running Python test suite
with python3.8 from Focal triggers those.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364705
|
| |
|
|
|
|
|
|
|
| |
Make linux(4) warn about unsupported CMSG level/type.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364704
|
| |
|
|
|
|
|
|
|
| |
Don't use newlines with linux_msg(). No functional changes.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364703
|
| |
|
|
|
|
|
|
|
|
|
| |
Make linux(4) create /dev/shm. Linux applications often expect
a tmpfs to be mounted there, and because they like to verify it's
actually a mountpoint, a symlink won't do.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364702
|
| |
|
|
|
|
|
|
|
| |
Fix naming clash.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364700
|
| |
|
|
|
|
|
|
| |
Linux does not support MSG_OOB for unix(4) or non-stream oriented socket,
return EOPNOTSUPP as a Linux does.
Notes:
svn path=/stable/12/; revision=364699
|
| |
|
|
|
|
|
| |
Do not leak sa in linux_recvmsg() call if kern_recvit() fails.
Notes:
svn path=/stable/12/; revision=364698
|
| |
|
|
|
|
|
| |
Do not use uninitialised sa.
Notes:
svn path=/stable/12/; revision=364697
|
| |
|
|
|
|
|
| |
Do not leak sa in linux_recvfrom() call if kern_recvit() fails.
Notes:
svn path=/stable/12/; revision=364696
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Linux send() call returns EAGAIN instead of ENOTCONN in case when the
socket is non-blocking and connect() is not finished yet.
Initial patch developed by Steven Hartland in 2008 and adopted by me.
PR: 129169
Notes:
svn path=/stable/12/; revision=364695
|
| |
|
|
|
|
|
| |
Linuxulator getpeername() returns EINVAL in case then namelen less then 0.
Notes:
svn path=/stable/12/; revision=364694
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions
alter the userspace sockaddr to convert the format between linux and BSD versions.
That's the minimum 3 of copyin/copyout operations for one syscall.
Also some syscall uses linux_sa_put() and linux_getsockaddr() when load
sockaddr to userspace or from userspace accordingly.
To avoid this chaos, especially converting sockaddr in the userspace,
rewrite these 4 functions to convert sockaddr only in kernel and leave
only 2 of this functions.
Also in order to reduce duplication between MD parts of the Linuxulator put
struct sockaddr conversion functions that are MI out into linux_common module.
PR: 232920
Notes:
svn path=/stable/12/; revision=364693
|
| |
|
|
|
|
|
|
|
|
| |
Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
as documented in the man page.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364692
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).
It is documented as a raw hardware-based clock not subject to NTP or
incremental adjustments. With this "not as precise as CLOCK_MONOTONIC"
description in mind, map it to our CLOCK_MONOTNIC_FAST (the same
mapping as for the linux CLOCK_MONOTONIC_COARSE).
This is needed for the webcomponent of steam (chromium) and some
other steam component or game.
The linux-steam-utils port contains a LD_PRELOAD based fix for this.
There this is mapped to CLOCK_MONOTONIC.
As an untrained ear/eye (= the majority of people) is normaly not
noticing a difference of jitter in the 10-20 ms range, specially
if you don't pay attention like for example in a browser session
while watching a video stream, the mapping to CLOCK_MONOTONIC_FAST
seems more appropriate than to CLOCK_MONOTONIC.
MFC r363130 by netchild:
Fix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)),
by realy using the MONOTONIC version and not the REALTIME version.
Notes:
svn path=/stable/12/; revision=364691
|
| |
|
|
|
|
|
|
|
| |
Add warnings for unsupported Linux clockids.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364690
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix clock_gettime() and clock_getres() for cpu clocks:
- handle the CLOCK_{PROCESS,THREAD}_CPUTIME_ID specified directly;
- fix thread id calculation as in the Linuxulator we should
convert the user supplied thread id to struct thread * by linux_tdfind();
- fix CPUCLOCK_SCHED case by using kern_{process,thread}_cputime()
directly as native get_cputime() used by kern_clock_gettime() uses
native tdfind()/pfind() to find proccess/thread.
PR: 240990
Notes:
svn path=/stable/12/; revision=364689
|
| |
|
|
|
|
|
|
| |
linux_to_native_clockid() properly initializes nwhich variable (or return error),
so don't initialize nwhich in declaration and remove stale comment from r161304.
Notes:
svn path=/stable/12/; revision=364687
|
| |
|
|
|
|
|
|
|
|
| |
Make linux getcpu(2) report the domain.
Submitted by: markj
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364686
|
| |
|
|
|
|
|
|
|
|
| |
Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK,
when being passed O_NOFOLLOW. This fixes LTP testcase openat02:5.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364685
|
| |
|
|
|
|
|
|
|
| |
Replace LINUX_FASYNC with LINUX_O_ASYNC; no functional changes.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364683
|
| |
|
|
|
|
|
| |
Remove "emulation" of clone(CLONE_PARENT | CLONE_THREAD).
Notes:
svn path=/stable/12/; revision=364680
|
| |
|
|
|
|
|
| |
Fix a lock leak when emulating futex(FUTEX_WAIT_BITSET).
Notes:
svn path=/stable/12/; revision=364679
|
| |
|
|
|
|
|
|
|
| |
Support O_CLOEXEC in linux(4) open(2) and openat(2).
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364677
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Return ENOTSUP for Linux FS_IOC_FIEMAP ioctl.
Linux man(1) calls it for no good reason; this avoids the console spam
(eg '(man): ioctl fd=4, cmd=0x660b ('f',11) is not implemented').
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364670
|
| |
|
|
|
|
|
|
|
|
|
| |
Fix linuxulator prlimit64(2) with pid == 0. This makes 'ulimit -a'
return something reasonable, and helps linux binaries which attempt
to close all the files, eg apt(8).
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364669
|
| |
|
|
|
|
|
|
|
|
|
| |
Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam.
PR: kern/240432
Analyzed by: Alex S <iwtcex@gmail.com>
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364668
|
| |
|
|
|
|
|
|
|
|
| |
Add compat.linux.debug sysctl, to make it possible to silence down
the debug messages. While here, clean up some variable naming.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364667
|
| |
|
|
|
|
|
|
|
|
|
| |
Make linux(4) set the openfiles soft resource limit to 1024 for Linux
applications, which often depend on this being the case. There's a new
sysctl, compat.linux.default_openfiles, to control this behaviour.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364666
|
| |
|
|
|
|
|
|
|
|
|
| |
Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
only defined by linux_common kernel module and not both linux and linux64
modules.
Reported by: Yuri Pankov <ypankov@fastmail.com>
Notes:
svn path=/stable/12/; revision=364665
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
linuxulator: Map scheduler priorities to Linux priorities.
On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR
scheduling policies is [1,99]. For SCHED_OTHER the single valid priority is
0. On FreeBSD it is [0,31] for all policies. Programs are supposed to
query the valid range using sched_get_priority_(min|max), but of course some
programs assume the Linux values are valid.
This commit adds a tunable compat.linux.map_sched_prio. When enabled
sched_get_priority_(min|max) return the Linux values and sched_setscheduler
and sched_(get|set)param translate between FreeBSD and Linux values.
Because there are more Linux levels than FreeBSD levels, multiple Linux
levels map to a single FreeBSD level, which means pre-emption might not
happen as it does on Linux, so the tunable allows to disable this behaviour.
It is enabled by default because I think it is unlikely that anyone runs
real-time software under Linux emulation on FreeBSD that critically relies
on correct pre-emption.
This fixes FMOD, a commercial sound library used by several games.
PR: 240043
Tested by: Alex S <iwtcex@gmail.com>
Notes:
svn path=/stable/12/; revision=364664
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add compat.linux.ignore_ip_recverr sysctl. This is a workaround
for missing IP_RECVERR setsockopt(2) support. Without it, DNS
resolution is broken for glibc >= 2.30 (glibc BZ #24047).
From the user point of view this fixes "yum update" on recent
CentOS 8.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364663
|
| |
|
|
|
|
|
|
|
|
| |
Add a hack to make ^T work for Linux binaries, enabled with
'compat.linux.preserve_vstatus=1' sysctl.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364662
|
| |
|
|
|
|
|
|
|
| |
Make linux(4) handle SO_REUSEPORT.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364661
|
| |
|
|
|
|
|
|
|
|
| |
Add TCP_CORK support to linux(4). This fixes one of the things Nginx
trips over.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364660
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Make linux(4) handle MAP_32BIT.
This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic);
previously would crash on "amd64_is_imm32" assert.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364659
|
| |
|
|
|
|
|
|
|
|
|
| |
Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the
standard SO_SNDBUF/SO_RCVBUF. Mostly cosmetics, to get rid
of the warning during 'apt upgrade'.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364658
|
| |
|
|
|
|
|
|
|
| |
Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364657
|
| |
|
|
|
|
|
|
|
| |
Implement Linux BLKGETSIZE64 ioctl.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/stable/12/; revision=364581
|