Commit Graph

7028 Commits

Author SHA1 Message Date
kib
00696f008c MFC r300305, r300332:
Check for overflow and return EINVAL if detected.  Use unsigned index.
2016-05-23 00:58:52 +00:00
avg
3a90d30e3f MFC r298737: fix up r300036 2016-05-17 08:36:54 +00:00
avg
cfc0337581 MFC r298736: ensure that initial local apic id is sane on AMD 10h systems 2016-05-17 08:33:40 +00:00
kib
60a7096da4 MFC r299350:
Add locking annotations to amd64 struct md_page members.
2016-05-17 07:55:49 +00:00
avg
ecc2c61c90 MFC r297857: re-enable AMD Topology extension on certain models if
disabled by BIOS
2016-05-04 11:53:30 +00:00
mav
896cbb26a0 MFC r297243: Polish wbwd(4) driver and add more supported chips. 2016-05-03 07:48:52 +00:00
pfg
1df61c536d MFC r298482:
Cleanup redundant parenthesis from existing howmany()/roundup() macro uses.

Requested by:	dchagin
2016-04-26 17:39:54 +00:00
avg
d401a99e64 MFC r297846: [amd64] dtrace_invop handler is to be called only for
kernel exceptions
2016-04-26 07:40:07 +00:00
hselasky
28b34f7466 MFC r294526:
Add missing atomic wrapper macro.

Reviewed by:	alfred @
Sponsored by:	Mellanox Technologies
2016-04-07 07:21:27 +00:00
dchagin
dfb7b90783 MFC r297062:
Regen for r297061 (fstatfs64 Linux syscall).
2016-03-27 06:17:19 +00:00
dchagin
ce9255cc9f MFC r297061;
Implement fstatfs64 system call.

PR:		181012
Submitted by:	John Wehle
2016-03-27 06:10:51 +00:00
glebius
4c0b9655c9 Merge r296956:
Due to invalid use of a signed intermediate value in the bounds checking
  during argument validity verification, unbound zero'ing of the process LDT
  and adjacent memory can be initiated from usermode.

Submitted by:   CORE Security
Patch by:       kib
Security:       SA-16:15
2016-03-16 22:35:55 +00:00
kib
6f44a5bccb MFC r296908:
Force the desired alignment of the user save area.
2016-03-16 16:42:01 +00:00
kib
ad5b5f3479 MFC r295966:
Return dst as the result from memcpy(9) on amd64.

PR:	207422
2016-03-09 10:21:13 +00:00
kib
bac8688b17 MFC r294311:
Clear whole XMM register file instead of only XMM0.  Also clear x87
registers.  This brings amd64 on par with i386, providing consistent
initial FPU state.

PR:	206370

MFC r294312:
Use ANSI definitions.  Wrap long line.

MFC r294313:
Adjust i386 comment to match amd64 one after r294311.

Approved by:	re (gjb)
2016-02-02 14:16:07 +00:00
grehan
83c1d10f0c MFC r284539, r284630, r284688, r284877, r285217, r285218,
r286837, r286838, r288470, r288522, r288524, r288826,
    r289001

Pull in bhyve bug fixes and changes to allow UEFI booting.
This provides Windows support.

Tested on Intel and AMD with:
  - Arch Linux i386+amd64 (kernel 4.3.3)
  - Ubuntu 15.10 server 64-bit
  - FreeBSD-CURRENT/amd64 20160127 snap
  - FreeBSD 10.2 i386+amd64
  - OpenBSD 5.8 i386+amd64
  - SmartOS latest
  - Windows 10 build 1511'

Huge thanks to Yamagi Burmeister who submitted the patch
and did the majority of the testing.

r284539 - bootrom mem allocation support
r284630 - Add SO_REUSEADDR when starting debug port
r284688 - Fix a regression in "movs" emulation
r284877 - verify_gla() non-zero segment base fix
r285217 - Always assert DCD and DSR in the uart
r285218 - devmem nodes moved to /dev/vmm.io/
r286837 - Add define for SATA Check-Power-Mode
r286838 - Add simple (no-op) SATA cmd emulations
r288470 - Increase virtio-blk indirect descs
r288522 - Firmware guest query interface
r288524 - Fix post-test typo
r288826 - Clean up SATA unimplemented cmd msg
r289001 - Add -l option to specify userboot path

Submitted by:	Yamagi Burmeister
Approved by:	re (kib)
2016-02-01 14:56:11 +00:00
delphij
00bfa82a7b 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
2016-01-27 07:28:55 +00:00
dchagin
1b8c6467ee MFC r294620:
Fix a typo.

MFC r294621:

  Remove obsolete comment.
2016-01-26 06:05:55 +00:00
ian
33902405d5 MFC r293045, r293046:
Make the 'env' directive described in config(5) work on all architectures,
  providing compiled-in static environment data that is used instead of any
  data passed in from a boot loader.

  Previously 'env' worked only on i386 and arm xscale systems, because it
  required the MD startup code to examine the global envmode variable and
  decide whether to use static_env or an environment obtained from the boot
  loader, and set the global kern_envp accordingly.  Most startup code wasn't
  doing so.  Making things even more complex, some mips startup code uses an
  alternate scheme that involves calling init_static_kenv() to pass an empty
  buffer and its size, then uses a series of kern_setenv() calls to populate
  that buffer.

  Now all MD startup code calls init_static_kenv(), and that routine provides
  a single point where envmode is checked and the decision is made whether to
  use the compiled-in static_kenv or the values provided by the MD code.

  The routine also continues to serve its original purpose for mips; if a
  non-zero buffer size is passed the routine installs the empty buffer ready
  to accept kern_setenv() values.  Now if the size is zero, the provided buffer
  full of existing env data is installed.  A NULL pointer can be passed if the
  boot loader provides no env data; this allows the static env to be installed
  if envmode is set to do so.

  Most of the work here is a near-mechanical change to call the init function
  instead of directly setting kern_envp.  A notable exception is in xen/pv.c;
  that code was originally installing a buffer full of preformatted env data
  along with its non-zero size (like mips code does), which would have allowed
  kern_setenv() calls to wipe out the preformatted data.  Now it passes a zero
  for the size so that the buffer of data it installs is treated as
  non-writeable.

  Also, revert accidental change that snuck into r293045.
2016-01-24 21:04:06 +00:00
jhb
24f353ebf7 Regen for r294368. 2016-01-20 01:11:01 +00:00
jhb
77733541d4 MFC 289769,289822,290143,290144:
Rename remaining linux32 symbols from linux_* to linux32_*.

289769:
Rename remaining linux32 symbols such as linux_sysent[] and
linux_syscallnames[] from linux_* to linux32_* to avoid conflicts with
linux64.ko.  While here, add support for linux64 binaries to systrace.
- Update NOPROTO entries in amd64/linux/syscalls.master to match the
  main table to fix systrace build.
- Add a special case for union l_semun arguments to the systrace
  generation.
- The systrace_linux32 module now only builds the systrace_linux32.ko.
  module on amd64.
- Add a new systrace_linux module that builds on both i386 and amd64.
  For i386 it builds the existing systrace_linux.ko.  For amd64 it
  builds a systrace_linux.ko for 64-bit binaries.

289822:
Fix build for the KTR-enabled kernels.

290143:
Fix build with DEBUG defined.

290144:
Update for LINUX32 rename.  The assembler didn't complain about undefined
symbols but just used 0 after the rename.
2016-01-20 01:09:53 +00:00
jhb
e6d9c6386f MFC 290728:
Export various helper variables describing the layout and size of
certain kernel structures for use by debuggers. This mostly aids
in examining cores from a kernel without debug symbols as a debugger
can infer these values if debug symbols are available.

One set of variables describes the layout of 'struct linker_file' to
walk the list of loaded kernel modules.

A second set of variables describes the layout of 'struct proc' and
'struct thread' to walk the list of processes in the kernel and the
threads in each process.

The 'pcb_size' variable is used to index into the stoppcbs[] array.

The 'vm_maxuser_address' is used to distinguish kernel virtual addresses
from user addresses. This doesn't have to be perfect, and
'vm_maxuser_address' is a cheap and simple way to differentiate kernel
pointers from simple values like TIDs and PIDs.

While here, annotate the fields in struct pcb used by kgdb on amd64
and i386 to note that their ABI should be preserved.  Annotations for
other platforms will be added in the future.
2016-01-18 18:27:21 +00:00
emaste
800cde159e MFC r293343: Move amd64 metadata.h to x86 and share with i386 2016-01-18 15:52:07 +00:00
emaste
31c7f199a4 MFC r281381: Use explicitly sized types in EFI module metadata
This will allow the same metadata struct to be used on all platforms.
2016-01-18 15:43:00 +00:00
dchagin
ed08737097 MFC r293613:
Implement vsyscall hack. Prior to 2.13 glibc uses vsyscall
instead of vdso. An upcoming linux_base-c6 needs it.
2016-01-16 07:56:49 +00:00
glebius
924e9fd65e o Fix SCTP ICMPv6 error message vulnerability. [SA-16:01.sctp]
o Fix Linux compatibility layer incorrect futex handling. [SA-16:03.linux]
o Fix Linux compatibility layer setgroups(2) system call. [SA-16:04.linux]
o Fix TCP MD5 signature denial of service. [SA-16:05.tcp]
o Fix insecure default bsnmpd.conf permissions. [SA-16:06.bsnmpd]

Security:	FreeBSD-SA-16:01.sctp, CVE-2016-1879
Security:	FreeBSD-SA-16:03.linux, CVE-2016-1880
Security:	FreeBSD-SA-16:04.linux, CVE-2016-1881
Security:	FreeBSD-SA-16:05.tcp, CVE-2016-1882
Security:	FreeBSD-SA-16:06.bsnmpd, CVE-2015-5677
2016-01-14 09:11:42 +00:00
dchagin
07e5594c02 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.
2016-01-09 18:32:52 +00:00
dchagin
d1e4a825ff MFC r284159:
Futex is an aligned 32-bit integer. Use the proper instruction and
operand when dereferencing futex pointer.
2016-01-09 18:19:18 +00:00
dchagin
1fd2c934ac MFC r283544:
When I merged the lemul branch I missied kib@'s r282708 commit.
This is not the final fix as I need properly cleanup thread resources
before other threads suicide.
2016-01-09 18:07:48 +00:00
dchagin
6470ace45c Regen for r293592. 2016-01-09 17:56:04 +00:00
dchagin
ddaf8065bb MFC r283492:
Implement Linux specific syncfs() system call.
2016-01-09 17:54:37 +00:00
dchagin
87e0367fbe Regen for r293588. 2016-01-09 17:51:17 +00:00
dchagin
bbbcfd1903 MFC r283488:
Implement recvmmsg() and sendmmsg() system calls.
2016-01-09 17:50:13 +00:00
dchagin
2e5298109d MFC r283487:
Reduce duplication between MD Linux code by moving msg related
struct definitions out into the compat/linux/linux_socket.h
2016-01-09 17:49:05 +00:00
dchagin
a803e87674 Regen for r293585. 2016-01-09 17:47:57 +00:00
dchagin
735299091c MFC r283484:
Implement epoll_pwait() system call.
2016-01-09 17:45:02 +00:00
dchagin
e412c865a0 Regen for r293582. 2016-01-09 17:42:25 +00:00
dchagin
1e80f16f0f MFC r283480:
Add utimensat() system call.
2016-01-09 17:41:00 +00:00
dchagin
48b0af056f MFC r283479:
The kernel sends signals to the processes via ABI specific sv_sendsig method.
Native ABI do not need signal conversion, only emulators may want this. Usually
emulators implements its own sv_sendsig method. For now only ibcs2 emulator does
not have own sv_sendsig implementation and depends on native sendsig() method.
So, remove any extra attempts to convert signal numbers from native sendsig()
methods except from i386 where ibsc2 is living.
2016-01-09 17:39:41 +00:00
dchagin
05243c7228 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
2016-01-09 17:29:08 +00:00
dchagin
858c17f9b3 MFC r283471:
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.
2016-01-09 17:22:51 +00:00
dchagin
1aaf87d264 Regen for r293569. 2016-01-09 17:20:19 +00:00
dchagin
8ab518aec9 MFC r283467:
Call nosys in case when the incorrect syscall number is specified.

Its my fault, fixed by mjg@ at r289055.
2016-01-09 17:18:03 +00:00
dchagin
c4895a81f6 Regen for r293567. 2016-01-09 17:15:03 +00:00
dchagin
5b01285f9b MFC r283465:
Add preliminary fallocate system call implementation
to emulate posix_fallocate() function.
2016-01-09 17:13:43 +00:00
dchagin
09f25351da Regen for r293555. 2016-01-09 17:00:15 +00:00
dchagin
682bdd605d MFC r283451:
Implement ppoll() system call.
2016-01-09 16:58:57 +00:00
dchagin
9d7b3777ea MFC r283446:
Include opt_compat.h, so that COMPAT_LINUX32 is defined, and we can
access to the semop structs and functions.
2016-01-09 16:52:25 +00:00
dchagin
b7022d5321 Regen for r293549. 2016-01-09 16:50:09 +00:00
dchagin
1eeab3feb9 MFC r283444:
Implement eventfd system call.
2016-01-09 16:48:50 +00:00