History log of /freebsd-current/sys/amd64/linux/linux.h
Revision Date Author Comments
# 4fe77990 04-Oct-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Deduplicate SystemV IPC defines from amd64/linux

MFC after: 1 week


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 3d0addcd 18-May-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Make ptrace_pokeusr machine dependent

Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week


# dd2a6cd7 18-May-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Make ptrace_peekusr machine dependend

And partially implement it for x86_64.

Differential Revision: https://reviews.freebsd.org/D40095
MFC after: 1 week


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 19973638 28-Apr-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Move dev_t type declaration under /compat/linux

As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Move it into the MI linux.h under /compat/linux.


# e0bfe0d6 28-Apr-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Make struct newstat to match actual Linux one

In the struct stat the st_dev, st_rdev are unsigned long.


# 56c5230a 22-Apr-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Fix LINUX_AT_COUNT comments

Differential Revision: https://reviews.freebsd.org/D39645
MFC after: 1 month


# 7d8c9839 22-Apr-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Deduplicate linux_copyout_auxargs()

Export default MINSIGSTKSZ value for the x86 until we do not preserve AVX
registers in the signal context.

Differential Revision: https://reviews.freebsd.org/D39644
MFC after: 1 month


# 9e7f03e9 03-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Drop unncessary struct l_ifconf declaration from amd64/linux

Its needed only for amd64/linux32 Linuxulator.

Differential Revision: https://reviews.freebsd.org/D38793


# cabbfb60 03-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Reduce code duplication between MD files

Move struct ifnet definitions under compat/linux.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38791


# 575e48f1 01-Feb-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Deduplicate MI futex structures.

MFC after: 1 week


# d416ee86 22-Jun-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraint

MFC after: 2 weeks


# 2ca34847 30-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Reduce duplication between MD parts of the Linuxulator

Move sigprocmask actions defines under compat/linux,
they are identical across all Linux architectures.

MFC after: 2 weeks


# af557e64 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Rework the definition of struct siginfo to match Linux actual one

Rework the defintion of struct siginfo so that the array padding
struct siginfo to SI_MAX_SIZE can be placed in a union along side of the
rest of the struct siginfo members. The result is that we no longer need
the __ARCH_SI_PREAMBLE_SIZE or SI_PAD_SIZE definitions.

Move struct siginfo definition under /compat/linux to reduce MD part.
To avoid headers polution include linux_siginfo.h in the MD linux.h

MFC after: 2 weeks


# 21f24617 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Move sigframe definitions to separate headers

The signal trampoine-related definitions are used only in the MD part
of code, wherefore moved from everywhere used linux.h to separate MD
headers.

MFC after: 2 weeks


# ba279bcd 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Cleanup signal trampolines

This is the first stage of a signal trampolines refactoring.

From trampolines retired emulation of the 'call' instruction, which is
replaced by direct call of a signal handler. The signal handler address
is in the register.

The previous trampoline implemenatation used semi-Linux-way to call
a signal handler via the 'jmp' instruction. Wherefore the trampoline
emulated a 'call' instruction to into the stack the return address for
signal handler's 'ret' instruction. Wherefore handmade DWARD annotations
was used.

While here rephrased and removed excessive comments.

MFC after: 2 weeks


# 0bf8d5d5 09-Nov-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux: Replace ifdefs in ptrace with per-architecture callbacks

It's a cleanup; no (intended) functional changes.

Sponsored By: EPSRC
Reviewed By: kib
Differential Revision: https://reviews.freebsd.org/D32888


# f0d9a6a7 30-Oct-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux: make PTRACE_SETREGS use a correct struct

Note that this is largely untested at this point, as was
the previous version; I'm committing this mostly to get
rid of `struct linux_pt_reg`.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32735


# 3417c298 23-Oct-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux: Constify bsd_to_linux_regset()

No functional changes.

Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D32599


# 1ca6b15b 20-Jul-2021 Dmitry Chagin <dchagin@FreeBSD.org>

Drop "All rights reserved" from my copyright statements.

Add email and fixup years while here.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30912
MFC after: 2 weeks


# 26795a03 21-Jun-2021 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Rework Linux ppoll system call.

For now the Linux emulation layer uses in kernel ppoll(2) without
conversion of user supplied fd 'events', and does not convert the
kernel supplied fd 'revents'.

At least POLLRDHUP is handled by FreeBSD differently than by
Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's
unlike FreeBSD, which does more strictly check and fails.

Rework the Linux ppoll, using kern_poll and converting 'events'
and 'revents' values.
While here, move poll events defines to the MI part of code as they
mostly identical on all arches except arm.

Differential Revision: https://reviews.freebsd.org/D30716
MFC after: 2 weeks


# 19593f77 31-May-2021 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4); Retire unnecessary __packed attribute from some struct's
definition.

Differential Revision: https://reviews.freebsd.org/D30482
MFC after: 2 weeks


# 95c19e1d 21-May-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux: refactor bsd_to_linux_regset() out of linux_ptrace.c

This will be used for Linux coredump support.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30365


# 916f3dba 06-May-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes

This is largely a no-op, to make future debugging slightly easier.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30035


# ca6e1fa3 12-Apr-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linux: adjust ordering of Linux auxv and add dummy AT_HWCAP2

This should be a no-op; the purpose of this is to reduce
a spurious difference between Linuxulator and Linux, to make
debugging core dumps slightly easier.

Note that AT_HWCAP2 we pass to Linux binaries is always 0,
instead of being equal to 'cpu_feature2'. This matches what
I've observed under Ubuntu Focal VM.

Reviewed By: chuck, dchagin
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29609


# 562894f0 14-Apr-2020 Brooks Davis <brooks@FreeBSD.org>

Centralize compatability translation macros.

Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files.

Input from: cem, jhb
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24275


# c5156c77 13-May-2019 Dmitry Chagin <dchagin@FreeBSD.org>

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
Reviewed by: trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20178


# d151344d 03-May-2019 Dmitry Chagin <dchagin@FreeBSD.org>

In order to reduce duplication between MD parts of the Linuxulator
move bits that are MI out into the headers in compat/linux.
For that remove bogus _packed attribute from struct l_sockaddr
and use MI types for struct members.

And continue to move into the linux_common module a code that is
intended for both Linuxulator modules (both instruction set - 32 & 64 bit)
or for external modules like linsysfs or linprocfs.

To avoid header pollution introduce new sys/compat/linux_common.h header.

Reviewed by: emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20137


# 931e2a1a 15-Jun-2018 Ed Maste <emaste@FreeBSD.org>

linuxulator: do not include legacy syscalls on arm64

Existing linuxulator platforms (i386, amd64) support legacy syscalls,
such as non-*at ones like open, but arm64 and other new platforms do
not.

Wrap these in #ifdef LINUX_LEGACY_SYSCALLS, #defined in the MD linux.h
files. We may need finer grained control in the future but this is
sufficient for now.

Reviewed by: andrew
Sponsored by: Turing Robotic Industries
Differential Revision: https://reviews.freebsd.org/D15237


# 023b850b 01-Mar-2018 Ed Maste <emaste@FreeBSD.org>

Rationalize license text on Linuxolator files

Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text. To avoid license proliferation switch to
the standard 2-clause FreeBSD license for those files where I have
permission from each of the listed copyright holders. Additional files
still waiting on permission from others are listed in review D14210.

Approved by: dchagin, rdivacky, sos
MFC after: 1 week
MFC with: r329370
Sponsored by: The FreeBSD Foundation


# 132f90c6 05-Feb-2018 Ed Maste <emaste@FreeBSD.org>

Linuxolator whitespace cleanup

A version of each of the MD files by necessity exists for each CPU
architecture supported by the Linuxolator. Clean these up so that new
architectures do not inherit whitespace issues.

Clean up shared Linuxolator files while here.

Sponsored by: Turing Robotic Industries Inc.


# 9811d215 28-May-2017 Dmitry Chagin <dchagin@FreeBSD.org>

In r246085 some bits that are MI movied out into headers in compat/linux,
but I missed that when I commited x86_64 Linuxulator. So remove the duplicates.

MFC after: 1 week


# 7ece126e 08-Apr-2017 Tai-hwa Liang <avatar@FreeBSD.org>

Trying to be more compatible with Linux if.h definitions:
- renaming l_ifreq::ifru_metric to l_ifreq::ifru_ivalue;
- adding a definition for ifr_ifindex which points to l_ifreq::ifru_ivalue.

A quick search indicates that Linux already got the above changes since 2.1.14.

Reviewed by: kib, marcel, dchagin
MFC after: 1 week


# 85712939 18-Mar-2017 Dmitry Chagin <dchagin@FreeBSD.org>

To reduce code duplication move socket defines to the MI path.

MFC after: 1 week


# ab60bc84 07-Mar-2017 Dmitry Chagin <dchagin@FreeBSD.org>

Reduce code duplication between MD Linux code by moving SYSV IPC 64-bit
related struct definitions out into the MI path.

Invert the native ipc structs to the Linux ipc structs convesion logic.
Since 64-bit variant of ipc structs has more precision convert native ipc
structs to the 64-bit Linux ipc structs and then truncate 64-bit values
into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the
values do not fit.

Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit.

MFC after: 1 month


# 97d06da6 10-Jul-2016 Dmitry Chagin <dchagin@FreeBSD.org>

Fix a copy/paste bug introduced during X86_64 Linuxulator work.
FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation
use READ_IMPLIES_EXEC flag, introduced in r302515.

While here move common part of mmap() and mprotect() code to the files in compat/linux
to reduce code dupcliation between Linuxulator's.

Reported by: Johannes Jost Meixner, Shawn Webb

MFC after: 1 week
XMFC with: r302515, r302516


# 7c598200 27-Mar-2016 Dmitry Chagin <dchagin@FreeBSD.org>

Revert r297310 as the SOL_XXX are equal to the IPPROTO_XX except SOL_SOCKET.

Pointed out by: ae@


# c826fcfe 27-Mar-2016 Dmitry Chagin <dchagin@FreeBSD.org>

iConvert Linux SOL_IPV6 level.

MFC after: 1 week


# f1389991 23-Jan-2016 Dmitry Chagin <dchagin@FreeBSD.org>

Fix a typo.

MFC after: 3 days


# b7aaa9fd 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Reduce duplication between MD Linux code by moving msg related
struct definitions out into the compat/linux/linux_socket.h


# 4ab7403b 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Rework signal code to allow using it by other modules, like linprocfs:

1. Linux sigset always 64 bit on all platforms. In order to move Linux
sigset code to the linux_common module define it as 64 bit int. Move
Linux sigset manipulation routines to the MI path.

2. Move Linux signal number definitions to the MI path. In general, they
are the same on all platforms except for a few signals.

3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion
tables to avoid conversion errors.

4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside
of allowed on Linux signal numbers.

PR: 197216


# a7ac4576 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

According to Linux man sigaltstack(3) shall return EINVAL if the ss
argument is not a null pointer, and the ss_flags member pointed to by ss
contains flags other than SS_DISABLE. However, in fact, Linux also
allows SS_ONSTACK flag which is simply ignored.

For buggy apps (at least mono) ignore other than SS_DISABLE
flags as a Linux do.

While here move MI part of sigaltstack code to the appropriate place.

Reported by: abi at abinet dot ru


# 3e89b641 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Put the correct value for the abi_nfdbits parameter of kern_select() for
all supported Linuxulators.

Differential Revision: https://reviews.freebsd.org/D1093
Reviewed by: trasz


# 4d0f380d 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

To avoid code duplication move open/fcntl definitions to the MI
header file.

Differential Revision: https://reviews.freebsd.org/D1087
Reviewed by: trasz


# 4048f59c 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Add AT_RANDOM and AT_EXECFN auxiliary vector entries which are used by
glibc. At list since glibc version 2.16 using AT_RANDOM is mandatory.

Differential Revision: https://reviews.freebsd.org/D1080


# b2f58791 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Add preliminary support for x86-64 Linux binaries.

Differential Revision: https://reviews.freebsd.org/D1076