History log of /freebsd-10-stable/sys/i386/linux/linux_sysvec.c
Revision Date Author Comments
# 326814 12-Dec-2017 pfg

MFC r326282: (by fsu)

Remap ENOATTR to ENODATA in the linuxulator.
In the linux ENOADATA is frequently #defined as ENOATTR. The change is
required for an xattrs support implementation.


# 321024 15-Jul-2017 dchagin

MFC r297597 (by bapt@):

Add kern.features flags for linux and linux64 modules

kern.features.linux: 1 meaning linux 32 bits binaries are supported
kern.features.linux64: 1 meaning linux 64 bits binaries are supported

The goal here is to help 3rd party applications (including ports) to determine
if the host do support linux emulation

Relnotes: yes


# 298653 26-Apr-2016 pfg

MFC r298482:
Cleanup redundant parenthesis from existing howmany()/roundup() macro uses.

Requested by: dchagin


# 294901 27-Jan-2016 delphij

MFC r294900:

Implement AT_SECURE properly.

AT_SECURE auxv entry has been added to the Linux 2.5 kernel to pass a
boolean flag indicating whether secure mode should be enabled. 1 means
that the program has changes its credentials during the execution.
Being exported AT_SECURE used by glibc issetugid() call.

Submitted by: imp, dchagin
Security: FreeBSD-SA-16:10.linux
Security: CVE-2016-1883


# 294136 16-Jan-2016 dchagin

MFC r293613:

Implement vsyscall hack. Prior to 2.13 glibc uses vsyscall
instead of vdso. An upcoming linux_base-c6 needs it.


# 293609 09-Jan-2016 dchagin

MFC r289055 (by mjg@):

linux: fix handling of out-of-bounds syscall attempts

Due to an off by one the code would read an entry past the table, as
opposed to the last entry which contains the nosys handler.

This fixes my fault.

MFC r289058 (by cem@):

Fix missing semi-colon from r289055.

MFC r289768 (by jhb@):

Merge r289055 to amd64/linux32:

linux: fix handling of out-of-bounds syscall attempts

Due to an off by one the code would read an entry past the table, as
opposed to the last entry which contains the nosys handler.


# 293575 09-Jan-2016 dchagin

MFC r283474:

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


# 293569 09-Jan-2016 dchagin

MFC r283467:

Call nosys in case when the incorrect syscall number is specified.

Its my fault, fixed by mjg@ at r289055.


# 293540 09-Jan-2016 dchagin

MFC r283436:

Use the BSD_TO_LINUX_SIGNAL() wherever there is no need
to check the ABI as it is known.


# 293535 09-Jan-2016 dchagin

MFC r283431:

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.


# 293527 09-Jan-2016 dchagin

MFC r283421:

Introduce a new module linux_common.ko which is intended for the
following primary purposes:

1. Remove the dependency of linsysfs and linprocfs modules from linux.ko,
which will be architecture specific on amd64.

2. Incorporate into linux_common.ko general code for platforms on which
we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).

3. Move malloc(9) declaration to linux_common.ko, to enable getting memory
usage statistics properly.

Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c
and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.

Temporarily remove dtrace garbage from linux_mib.c and linux_util.c


# 293517 09-Jan-2016 dchagin

MFC r283411:

Remove stale comment about a signal trampoline which
is moved to the shared page at r219609.


# 293516 09-Jan-2016 dchagin

MFC r283410:

Put linux_platform into the vdso to avoid copying it onto the stack at
every exec.


# 293514 09-Jan-2016 dchagin

MFC r283407:

Implement vdso - virtual dynamic shared object. Through vdso Linux
exposes functions from kernel with proper DWARF CFI information so that
it becomes easier to unwind through them.
Using vdso is a mandatory for a thread cancelation && cleanup
on a modern glibc.


# 293495 09-Jan-2016 dchagin

MFC r283385:

Some style(9) && whitespaces fixes. No functional changes.


# 293493 09-Jan-2016 dchagin

MFC r283383:

Switch linuxulator to use the native 1:1 threads.

The reasons:
1. Get rid of the stubs/quirks with process dethreading,
process reparent when the process group leader exits and close
to this problems on wait(), waitpid(), etc.
2. Reuse our kernel code instead of writing excessive thread
managment routines in Linuxulator.

Implementation details:

1. The thread is created via kern_thr_new() in the clone() call with
the CLONE_THREAD parameter. Thus, everything else is a process.
2. The test that the process has a threads is done via P_HADTHREADS
bit p_flag of struct proc.
3. Per thread emulator state data structure is now located in the
struct thread and freed in the thread_dtor() hook.
Mandatory holdig of the p_mtx required when referencing emuldata
from the other threads.
4. PID mangling has changed. Now Linux pid is the native tid
and Linux tgid is the native pid, with the exception of the first
thread in the process where tid and pid are one and the same.

Ugliness:

In case when the Linux thread is the initial thread in the thread
group thread id is equal to the process id. Glibc depends on this
magic (assert in pthread_getattr_np.c). So for system calls that
take thread id as a parameter we should use the special method
to reference struct thread.


# 276080 22-Dec-2014 jhb

MFC 273991:
MFamd64: Move extern declaration of _ucodesel and _udatasel to
<machine/md_var.h>


# 267561 17-Jun-2014 dchagin

Revert MFC r266925 because it can lead to instant panic at fexecve():

To allow to run interpreter itself add a new ELF branding type.

Pointed out by: kib, mjg


# 266999 03-Jun-2014 dchagin

MFC r266925:

To allow to run the interpreter itself add a new ELF branding type.
Allow Linux ABI to run ELF interpreter.


# 258559 25-Nov-2013 emaste

MFC r258135: x86: Allow users to change PSL_RF via ptrace(PT_SETREGS...)

Debuggers may need to change PSL_RF. Note that tf_eflags is already stored
in the signal context during signal handling and PSL_RF previously could
be modified via sigreturn, so this change should not provide any new
ability to userspace.

For background see the thread at:
http://lists.freebsd.org/pipermail/freebsd-i386/2007-September/005910.html

Reviewed by: jhb, kib

Sponsored by: DARPA, AFRL
Approved by: re (gjb)


# 276080 22-Dec-2014 jhb

MFC 273991:
MFamd64: Move extern declaration of _ucodesel and _udatasel to
<machine/md_var.h>


# 267561 17-Jun-2014 dchagin

Revert MFC r266925 because it can lead to instant panic at fexecve():

To allow to run interpreter itself add a new ELF branding type.

Pointed out by: kib, mjg


# 266999 03-Jun-2014 dchagin

MFC r266925:

To allow to run the interpreter itself add a new ELF branding type.
Allow Linux ABI to run ELF interpreter.


# 258559 25-Nov-2013 emaste

MFC r258135: x86: Allow users to change PSL_RF via ptrace(PT_SETREGS...)

Debuggers may need to change PSL_RF. Note that tf_eflags is already stored
in the signal context during signal handling and PSL_RF previously could
be modified via sigreturn, so this change should not provide any new
ability to userspace.

For background see the thread at:
http://lists.freebsd.org/pipermail/freebsd-i386/2007-September/005910.html

Reviewed by: jhb, kib

Sponsored by: DARPA, AFRL
Approved by: re (gjb)