]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
6 years agoMFC r326278 (manu):
gjb [Wed, 18 Apr 2018 16:22:23 +0000 (16:22 +0000)]
MFC r326278 (manu):

 growfs: Commit the changes after expanding the partition

 This fix the problem in arm snapshot present since at least 6 months
 where growfs was failing at firstboot and dropped you in a single
 user shell.

Note: In addition to this merge, kern.geom.part.mbr.enforce_chs has
been enabled on the build machine to mitigate against the issue in
the PR referenced.

PR: 226536
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332731 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332421: vt: add three more cp437 mappings for vga textmode
emaste [Tue, 17 Apr 2018 12:52:30 +0000 (12:52 +0000)]
MFC r332421: vt: add three more cp437 mappings for vga textmode

In UTF-8 locales mandoc uses a number of characters outside of the Basic
Latin group, e.g. from general punctuation or miscellaneous mathematical
symbols, and these rendered as ? in text mode.

This change adds (char, replacement, code point, description):

    – - U+2013 En Dash
    ⟨ < U+27E8 Mathematical Left Angle Bracket
    ⟩ > U+27E9 Mathematical Right Angle Bracket

This change addresses some common cases; there are others that still
need to be added after a more thorough review.

PR: 227409
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332644 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 331324: Ensure thread library is initialized in pthread_testcancel().
jhb [Mon, 16 Apr 2018 20:45:21 +0000 (20:45 +0000)]
MFC 331324: Ensure thread library is initialized in pthread_testcancel().

Call _thr_check_init() before reading curthread in pthread_testcancel().

If a constructor in a library creates a semaphore via sem_init() and
then waits for it via sem_wait(), the program can core dump in
_pthread_testcancel() called from sem_wait().  This is because the
semaphore implementation lives in libc, so the library's constructors
can be run before libthr's constructors.

Sponsored by: DARPA / AFRL

git-svn-id: svn://svn.freebsd.org/base/stable/10@332633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329606:
asomers [Mon, 16 Apr 2018 16:42:16 +0000 (16:42 +0000)]
MFC r329606:

tail: fix "tail -r" for piped input that begins with '\n'

A subtle logic bug, probably introduced in r311895, caused tail to print the
first two lines of piped input in forward order, if the very first character
was a newline.

PR: 222671
Reported by: Jim Long <freebsd-bugzilla@umpquanet.com>, pprocacci@gmail.com
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@332610 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331546:
kp [Mon, 16 Apr 2018 16:02:54 +0000 (16:02 +0000)]
MFC r331546:

pf: reload and resync do the same thing

The reload and resync commands for the startup script do exactly the same
thing, so implement one as a call to the other.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332591 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332142:
kp [Sat, 14 Apr 2018 00:20:47 +0000 (00:20 +0000)]
MFC r332142:

pf: Improve ioctl validation

Ensure that multiplications for memory allocations cannot overflow, and
that we'll not try to allocate M_WAITOK for potentially overly large
allocations.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332497 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332107:
kp [Fri, 13 Apr 2018 22:33:18 +0000 (22:33 +0000)]
MFC r332107:

pf: Improve ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and DIOCRSETTFLAGS

These ioctls can process a number of items at a time, which puts us at
risk of overflow in mallocarray() and of impossibly large allocations
even if we don't overflow.

Limit the allocation to required size (or the user allocation, if that's
smaller). That does mean we need to do the allocation with the rules
lock held (so the number doesn't change while we're doing this), so it
can't M_WAITOK.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332494 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332136:
kp [Fri, 13 Apr 2018 21:19:06 +0000 (21:19 +0000)]
MFC r332136:

pf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT

These ioctls can process a number of items at a time, which puts us at
risk of overflow in mallocarray() and of impossibly large allocations
even if we don't overflow.

There's no obvious limit to the request size for these, so we limit the
requests to something which won't overflow. Change the memory allocation
to M_NOWAIT so excessive requests will fail rather than stall forever.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332492 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332101:
kp [Fri, 13 Apr 2018 19:23:06 +0000 (19:23 +0000)]
MFC r332101:

pf: Improve ioctl validation for DIOCRADDTABLES and DIOCRDELTABLES

The DIOCRADDTABLES and DIOCRDELTABLES ioctls can process a number of
tables at a time, and as such try to allocate <number of tables> *
sizeof(struct pfr_table). This multiplication can overflow. Thanks to
mallocarray() this is not exploitable, but an overflow does panic the
system.

Arbitrarily limit this to 65535 tables. pfctl only ever processes one
table at a time, so it presents no issues there.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332487 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r332075
rgrimes [Fri, 13 Apr 2018 03:47:41 +0000 (03:47 +0000)]
MFC: r332075

Exit with usage when extra arguments are on command line
preventing mistakes such as "halt 0p" for "halt -p".
Approved by: bde (mentor, implicit), phk (mentor,implicit)
MFC after: 1 week

git-svn-id: svn://svn.freebsd.org/base/stable/10@332465 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument EN-18:03, EN-18:04, SA-18:04, SA-18:05.
gjb [Tue, 10 Apr 2018 14:07:29 +0000 (14:07 +0000)]
Document EN-18:03, EN-18:04, SA-18:04, SA-18:05.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332370 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331180: Plug a possible memory leak.
delphij [Tue, 10 Apr 2018 03:15:07 +0000 (03:15 +0000)]
MFC r331180: Plug a possible memory leak.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332348 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332151:
brooks [Mon, 9 Apr 2018 16:32:49 +0000 (16:32 +0000)]
MFC r332151:

ifconf(): correct handling of sockaddrs smaller than struct sockaddr.

Portable programs that use SIOCGIFCONF (e.g. traceroute) assume
that each pseudo ifreq is of length MAX(sizeof(struct ifreq),
sizeof(ifr_name) + ifr_addr.sa_len).  For short sockaddrs we copied
too much from the source sockaddr resulting in a heap leak.

I believe only one such sockaddr exists (struct sockaddr_sco which
is 8 bytes) and it is unclear if such sockaddrs end up on interfaces
in practice.  If it did, the result would be an 8 byte heap leak on
current architectures.

admbugs: 869
Reviewed by: kib
Obtained from: CheriBSD
Security: kernel heap leak
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14981

git-svn-id: svn://svn.freebsd.org/base/stable/10@332332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331225:
kp [Mon, 9 Apr 2018 15:29:14 +0000 (15:29 +0000)]
MFC r331225:

pf: Fix memory leak in DIOCRADDTABLES

If a user attempts to add two tables with the same name the duplicate table
will not be added, but we forgot to free the duplicate table, leaking memory.
Ensure we free the duplicate table in the error path.

Reported by: Coverity
CID: 1382111

git-svn-id: svn://svn.freebsd.org/base/stable/10@332330 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331053: ANSIfy i386/vm86.c
emaste [Mon, 9 Apr 2018 13:01:43 +0000 (13:01 +0000)]
MFC r331053: ANSIfy i386/vm86.c

git-svn-id: svn://svn.freebsd.org/base/stable/10@332325 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r282920: vtfontcvt: Allow 6 digits in verbose output
emaste [Mon, 9 Apr 2018 13:00:03 +0000 (13:00 +0000)]
MFC r282920: vtfontcvt: Allow 6 digits in verbose output

Some fonts (e.g. GNU Unifont) have more than 100,000 (half-)glyphs.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332324 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r296920: vtfontcvt: support .hex fonts with chars beyond Unicode BMP
emaste [Mon, 9 Apr 2018 12:58:53 +0000 (12:58 +0000)]
MFC r296920: vtfontcvt: support .hex fonts with chars beyond Unicode BMP

This is already supported by the vt(4) vfnt format mapping from code
points to glyphs. Update the .hex font parser to accept up to six hex
digits.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332323 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331935: vtfontcvt: allow .bdf characters less than full height
emaste [Mon, 9 Apr 2018 12:57:08 +0000 (12:57 +0000)]
MFC r331935: vtfontcvt: allow .bdf characters less than full height

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332322 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327529: ath: fix possible memory disclosure in ioctl handler
emaste [Mon, 9 Apr 2018 12:55:09 +0000 (12:55 +0000)]
MFC r327529: ath: fix possible memory disclosure in ioctl handler

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@332321 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC ath(4) potential memory disclosure fixes
emaste [Mon, 9 Apr 2018 12:53:15 +0000 (12:53 +0000)]
MFC ath(4) potential memory disclosure fixes

[1] r327499: ath: fix memory disclosure from ath_btcoex_ioctl

The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
returned it to userland without writing to it.

The device has permissions only for root so this is not urgent, and the
fix can be MFCd and considered for a future EN.

[2] r327500: ath: fix possible memory disclosures in ioctl handlers

Apply the fix from r327499 to additional ioctl handlers.

Note: related fix in r327529 does not apply directly to stable/10 and
will be addressed in a followup commit.

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> [1]
Reported by: Ilja van Sprundel <ivansprundel@ioactive.com> [1,2]
Reviewed by: adrian [1]
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332320 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332087:
brooks [Sun, 8 Apr 2018 17:23:33 +0000 (17:23 +0000)]
MFC r332087:

ifconf(): Always zero the whole struct ifreq.

The previous split of zeroing ifr_name and ifr_addr seperately is safe
on current architectures, but would be unsafe if pointers were larger
than 8 bytes. Combining the zeroing adds no real cost (a few
instructions) and makes the security property easier to verify.

Reviewed by: kib, emaste
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14912

git-svn-id: svn://svn.freebsd.org/base/stable/10@332295 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331737:
brooks [Sun, 8 Apr 2018 17:03:39 +0000 (17:03 +0000)]
MFC r331737:

GC never enabled support for SIOCGADDRROM and SIOCGCHIPID.

When de(4) was imported in 1997 the world was not ready for these ioctls.
In over 20 years that hasn't changed so it seems safe to assume their
time will never come.

Reviewed by: imp, jhb
Approved by: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14889

git-svn-id: svn://svn.freebsd.org/base/stable/10@332291 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix an assignment to force the level to be in the required interval.
tuexen [Sun, 8 Apr 2018 16:29:24 +0000 (16:29 +0000)]
Fix an assignment to force the level to be in the required interval.

CID: 1008428

git-svn-id: svn://svn.freebsd.org/base/stable/10@332284 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327205:
tuexen [Sun, 8 Apr 2018 16:26:16 +0000 (16:26 +0000)]
MFC r327205:

Fix an assignment. While there, do some whitespace cleanups.

CID: 1008936

git-svn-id: svn://svn.freebsd.org/base/stable/10@332283 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327203:
tuexen [Sun, 8 Apr 2018 16:24:37 +0000 (16:24 +0000)]
MFC r327203:

Allow the first (and second) argument of sn_calloc() be a sum.
This fixes a bug reported in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224103

PR: 224103

git-svn-id: svn://svn.freebsd.org/base/stable/10@332282 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331654, r331869
brooks [Sun, 8 Apr 2018 15:35:57 +0000 (15:35 +0000)]
MFC r331654, r331869

r331654:
Don't access userspace directly from the kernel in nxge(4).

Update to what the previous code seemed to be doing via the correct
interfaces.  Further issues exist in xge_ioctl_registers(), but this is
debugging code in a driver that has few users and they don't appear to
be crashes or leaks.

Reviewed by: jhb (prior version)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14848

r331869:
Fix the build on arches with default unsigned char.  Capture the fubyte()
return value in an int as well as the char, and test the full int value
for fubyte() failure.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332280 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331648:
brooks [Sat, 7 Apr 2018 00:04:28 +0000 (00:04 +0000)]
MFC r331648:

Improve copy-and-pasted versions of SIOCGIFADDR.

The original implementation used a reference to ifr_data and a cast to
do the equivalent of accessing ifr_addr. This was copied multiple
times since 1996.

Approved by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14873

git-svn-id: svn://svn.freebsd.org/base/stable/10@332160 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331761: align i386 cpu_reset() with amd64 version
avg [Fri, 6 Apr 2018 12:39:47 +0000 (12:39 +0000)]
MFC r331761: align i386 cpu_reset() with amd64 version

git-svn-id: svn://svn.freebsd.org/base/stable/10@332098 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330977: g_access: deal with races created by geoms that drop the topology lock
avg [Fri, 6 Apr 2018 12:23:59 +0000 (12:23 +0000)]
MFC r330977: g_access: deal with races created by geoms that drop the topology lock

PR: 225960

git-svn-id: svn://svn.freebsd.org/base/stable/10@332096 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330295: ZFS: fix adding vdevs to very large pools
avg [Fri, 6 Apr 2018 11:48:12 +0000 (11:48 +0000)]
MFC r330295: ZFS: fix adding vdevs to very large pools

PR: 226096

git-svn-id: svn://svn.freebsd.org/base/stable/10@332094 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331374:
kib [Thu, 5 Apr 2018 13:39:53 +0000 (13:39 +0000)]
MFC r331374:
Fixes for ptrace(PT_GETXSTATE_INFO) related to the padding in struct
ptrace_xstate_info).

git-svn-id: svn://svn.freebsd.org/base/stable/10@332069 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331757: Correct comment typo in Hyper-V
emaste [Thu, 5 Apr 2018 12:59:49 +0000 (12:59 +0000)]
MFC r331757: Correct comment typo in Hyper-V

PR: 226665
Submitted by: Ryo ONODERA

git-svn-id: svn://svn.freebsd.org/base/stable/10@332067 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332042: Fix kernel memory disclosure in linux_ioctl_socket
emaste [Thu, 5 Apr 2018 12:54:10 +0000 (12:54 +0000)]
MFC r332042: Fix kernel memory disclosure in linux_ioctl_socket

strlcpy is used to copy a string into a buffer to be copied to userland,
previously leaving uninitialized data after the terminating NUL.  Zero
the buffer first to avoid a kernel memory disclosure.

admbugs: 765, 811
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reported by: Vlad Tsyrklevich
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332064 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r332034: linux_ioctl_hdio: fix kernel memory disclosure
emaste [Thu, 5 Apr 2018 12:50:47 +0000 (12:50 +0000)]
MFC r332034: linux_ioctl_hdio: fix kernel memory disclosure

Stack-allocated struct linux_hd_big_geometry has undeclared padding
copied to userland.

admbugs: 765
Reported by: Vlad Tsyrklevich
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@332063 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331739
davidcs [Wed, 4 Apr 2018 23:58:35 +0000 (23:58 +0000)]
MFC r331739
1. Add additional debug prints.
2. Break transmit when IFF_DRV_RUNNING is OFF.
3. set desc_count=0 for default case in switch in ql_rcv_isr()

git-svn-id: svn://svn.freebsd.org/base/stable/10@332053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix build: correct variable names on stable/10
emaste [Wed, 4 Apr 2018 17:45:05 +0000 (17:45 +0000)]
Fix build: correct variable names on stable/10

r332032 merged r330356 from HEAD but did not account for a renamed
variable (of a different type) between stable/10 and HEAD.  Further
fix to r332036.

git-svn-id: svn://svn.freebsd.org/base/stable/10@332039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoFix build: use correct variable name on stable/10
emaste [Wed, 4 Apr 2018 16:28:30 +0000 (16:28 +0000)]
Fix build: use correct variable name on stable/10

r332032 merged r330356 from HEAD but did not account for a renamed
variable (of a different type) between stable/10 and HEAD.

Reported by: lwhsu

git-svn-id: svn://svn.freebsd.org/base/stable/10@332036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330356 (eadler): sys/linux: Fix a few potential infoleaks in Linux IPC
emaste [Wed, 4 Apr 2018 14:12:07 +0000 (14:12 +0000)]
MFC r330356 (eadler): sys/linux: Fix a few potential infoleaks in Linux IPC

admbugs: 765, 812, 813, 814
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reported by: Vlad Tsyrklevich

git-svn-id: svn://svn.freebsd.org/base/stable/10@332032 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330354 (eadler): sys/fuse: fix off by one error
emaste [Wed, 4 Apr 2018 13:16:00 +0000 (13:16 +0000)]
MFC r330354 (eadler): sys/fuse: fix off by one error

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@332023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331642:
hselasky [Wed, 4 Apr 2018 08:45:41 +0000 (08:45 +0000)]
MFC r331642:
Add support for right and middle click with integrated button to WSP
USB trackpad driver.

Submitted by: James Wright <james.wright@jigsawdezign.com>
PR: 226961
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@331997 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331981:
gordon [Wed, 4 Apr 2018 05:26:33 +0000 (05:26 +0000)]
MFC r331981:

Limit glyph count in vtfont_load to avoid integer overflow.

Invalid font data passed to PIO_VFONT can result in an integer overflow
in glyphsize.  Characters may then be drawn on the console using glyph
map entries that point beyond the end of allocated glyph memory,
resulting in a kernel memory disclosure.

Submitted by:   emaste
Reported by:    Dr. Silvio Cesare of InfoSect
Security:       CVE-2018-6917
Security:       FreeBSD-SA-18:04.vt
Sponsored by:   The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331983 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331630: Fix instructions in the zfsboot manual page.
eugen [Tue, 3 Apr 2018 14:09:34 +0000 (14:09 +0000)]
MFC r331630: Fix instructions in the zfsboot manual page.

zfsloader(8) fails to probe a slice containing ZFS pool if its second sector
contains traces of BSD label (DISKMAGIC == 0x82564557).
Fix manual page to show working example erasing such traces.

_M   .
M    sys/boot/i386/zfsboot/zfsboot.8

git-svn-id: svn://svn.freebsd.org/base/stable/10@331928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r327056: Use resume_cpus() instead of restart_cpus() to resume from ACPI suspension.
avg [Tue, 3 Apr 2018 07:52:06 +0000 (07:52 +0000)]
MFC r327056: Use resume_cpus() instead of restart_cpus() to resume from ACPI suspension.

The merge needed fixing because common x86 code changed by the original
commit is still split between i386 and amd64 in this branch.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331910 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331806:
gjb [Mon, 2 Apr 2018 13:25:38 +0000 (13:25 +0000)]
MFC r331806:
 Add logic for "families" for GCE images.

 This allows for GCE consumers to easily detect the latest major
 version of FreeBSD when using the gcloud command line utility.

 To ensure snapshot builds do not conflict with release-style
 builds (ALPHA, BETA, RC, RELEASE), the '-snap' suffix is appended
 to the GCE image family name.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331876 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331696, r331697:
gjb [Sat, 31 Mar 2018 01:37:14 +0000 (01:37 +0000)]
MFC r331696, r331697:

 r331696:
  Update the Release Engineering article URL to the modern version.

 r331697:
  Add an example for building SD card images for the RPI-B and RPI3.

Note, this commit manually fixes a merge conflict caused by r325096,
which does a seemingly recursive http -> https update, which this
commit was never marked for MFC.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331835 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMF11 r331330: Fix kernel memory disclosure in svr4_sys_getdents64
emaste [Thu, 29 Mar 2018 22:31:14 +0000 (22:31 +0000)]
MF11 r331330: Fix kernel memory disclosure in svr4_sys_getdents64

svr4_sys_getdents64() copies a dirent structure to userland.  When
calculating the record length for any given dirent entry alignment is
performed.  However, the aligned bytes are not cleared, this will
trigger an info leak.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Security: Kernel memory disclosure (801)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331562 (manu):
gjb [Thu, 29 Mar 2018 19:29:12 +0000 (19:29 +0000)]
MFC r331562 (manu):
 release: arm: Copy boot.scr from ports

 Latest u-boot update need u-boot script to load and start ubldr.
 (See D14230 for more details)
 Copy this file for our arm release on the fat partition.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 331345:
rpokala [Thu, 29 Mar 2018 15:01:01 +0000 (15:01 +0000)]
MFC 331345:

jedec_dimm: Use correct string length when populating sc->slotid_str

Don't limit the copy to the size of the target string *pointer* (always
4 on 32-bit / 8 on 64-bit). Instead, just use strdup().

git-svn-id: svn://svn.freebsd.org/base/stable/10@331734 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323006 and r324386.
np [Thu, 29 Mar 2018 01:20:58 +0000 (01:20 +0000)]
MFC r323006 and r324386.

This brings the cxgbe(4) firmware up to 1.16.63.0.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@331719 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331559:
gjb [Thu, 29 Mar 2018 00:42:44 +0000 (00:42 +0000)]
MFC r331559:
 Escape trailing newlines in a long variable list for consistency.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331717 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331329: Fix kernel memory disclosure in ibcs2_getdents
emaste [Wed, 28 Mar 2018 13:44:02 +0000 (13:44 +0000)]
MFC r331329: Fix kernel memory disclosure in ibcs2_getdents

ibcs2_getdents() copies a dirent structure to userland.  The ibcs2
dirent structure contains a 2 byte pad element.  This element is never
initialized, but copied to userland none-the-less.

Note that ibcs2 has not built on HEAD since r302095.

Submitted by: Domagoj Stolfa <ds815@cam.ac.uk>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Security: Kernel memory disclosure (803)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331671 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331481: Import tzdata 2018d
philip [Wed, 28 Mar 2018 07:45:57 +0000 (07:45 +0000)]
MFC r331481: Import tzdata 2018d

git-svn-id: svn://svn.freebsd.org/base/stable/10@331663 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 318387: Add support for child devices that aren't ports.
jhb [Tue, 27 Mar 2018 20:49:47 +0000 (20:49 +0000)]
MFC 318387: Add support for child devices that aren't ports.

Invoke any identify routines of child drivers during attach before attaching
children, and delete any remaining devices after deleting ports.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@331647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330949:
brooks [Tue, 27 Mar 2018 17:52:52 +0000 (17:52 +0000)]
MFC r330949:

Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.

This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.

Reviewed by: cem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14672

git-svn-id: svn://svn.freebsd.org/base/stable/10@331637 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330876, r330945
brooks [Tue, 27 Mar 2018 17:48:39 +0000 (17:48 +0000)]
MFC r330876, r330945

r330876:
Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.

For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
When the caddr_t stores an int, dereferencing addr as an (int *) results
in truncation on little-endian 64-bit systems and corruption (owing to
extracting top bits) on big-endian 64-bit systems. In practice the
value of chan was probably always zero on systems of the latter type as
all such FreeBSD platforms use a register-based calling convention.

Reviewed by: mav
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14673

r330945:
Add opt_compat.h to isp(4) as required by r330876.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331635 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330820:
brooks [Tue, 27 Mar 2018 17:43:03 +0000 (17:43 +0000)]
MFC r330820:

Reject ioctls to SCSI enclosures from 32-bit compat processes.

The ioctl objects contain pointers and require translation and some
refactoring of the infrastructure to work. For now prevent opertion
on garbage values. This is very slightly overbroad in that ENCIOC_INIT
is safe.

Reviewed by: imp, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14671

git-svn-id: svn://svn.freebsd.org/base/stable/10@331633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330819, r330885, r330934
brooks [Tue, 27 Mar 2018 17:42:04 +0000 (17:42 +0000)]
MFC r330819, r330885, r330934

r330819:
Reject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.

These take a union ccb argument which is full of kernel pointers.
Substantial translation efforts would be required to make this work.
By rejecting the request we avoid processing or returning entierly
wrong data.

Reviewed by: imp, ken, markj, cem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14654

r330885:
We need opt_compat.h after r330819 and 330820.

Add opt_compat.h to fix the stand-alone build case.

Sponsored by: Netflix.

r330934:
This should have been += so clean builds work.

Noticed by: hps@

git-svn-id: svn://svn.freebsd.org/base/stable/10@331632 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset
avg [Tue, 27 Mar 2018 11:34:34 +0000 (11:34 +0000)]
MFC r330974: MFV r330973: 9164 assert: newds == os->os_dsl_dataset

PR: 225877

git-svn-id: svn://svn.freebsd.org/base/stable/10@331612 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331364:
gjb [Mon, 26 Mar 2018 14:13:42 +0000 (14:13 +0000)]
MFC r331364:
 Remove google_accounts_manager from VM_RC_LIST in the GCE configuration
 file, no longer needed.

PR: 221714
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322665
sevan [Sun, 25 Mar 2018 01:33:51 +0000 (01:33 +0000)]
MFC r322665

Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

git-svn-id: svn://svn.freebsd.org/base/stable/10@331517 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316464
sevan [Sun, 25 Mar 2018 01:31:16 +0000 (01:31 +0000)]
MFC r316464

Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
was the first release of an OS to ship with it.
Heads up by Ingo Schwarze.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331516 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 321881
sevan [Sun, 25 Mar 2018 01:24:02 +0000 (01:24 +0000)]
MFC 321881

For the udp-client example, instruct user to add an entry for a udp based
service.
For tcp-client & udp-client, use the same port in configuration snippet as used
in the comment prior to remove any ambiguity on the port number which needs to
be specified.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331513 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316721 r331274
sevan [Sun, 25 Mar 2018 01:17:40 +0000 (01:17 +0000)]
MFC r316721 r331274

Most wireless drivers don't support altq(4).

Extend the description of ALTQ to call it a system which is a framework in
altq(4) to match altq(9). This makes preserving the history section as the
author of ALTQ easier in the history section, rather than calling it a framework
in the description & a system in the history.
Add a history section to altq(4) and extend the history section in altq(9)

git-svn-id: svn://svn.freebsd.org/base/stable/10@331512 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 330872:
jhb [Sat, 24 Mar 2018 00:26:42 +0000 (00:26 +0000)]
MFC 330872:
Add a "jail" keyword to list the name of a jail rather than its ID.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331333: Fix kernel memory disclosure in drm_infobufs
emaste [Fri, 23 Mar 2018 02:38:31 +0000 (02:38 +0000)]
MFC r331333: Fix kernel memory disclosure in drm_infobufs

drm_infobufs() has a structure on the stack, fills it out and copies it
to userland.  There are 2 elements in the struct that are not filled out
and left uninitialized.  This will leak uninitialized kernel stack data
to userland.

Submitted by: Domagoj Stolfa <ds815@cam.ac.uk>
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Security: Kernel memory disclosure (798)

git-svn-id: svn://svn.freebsd.org/base/stable/10@331412 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331339: Correct signedness bug in drm_modeset_ctl
emaste [Fri, 23 Mar 2018 02:34:45 +0000 (02:34 +0000)]
MFC r331339: Correct signedness bug in drm_modeset_ctl

drm_modeset_ctl() takes a signed in from userland, does a boundscheck,
and then uses it to index into a structure and write to it.  The
boundscheck only checks upper bound, and never checks for nagative
values.  If the int coming from userland is negative [after conversion]
it will bypass the boundscheck, perform a negative index into an array
and write to it, causing memory corruption.

Note that this is in the "old" drm driver; this issue does not exist
in drm2.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by: cem
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331410 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322794:
gjb [Thu, 22 Mar 2018 17:46:38 +0000 (17:46 +0000)]
MFC r322794:
 Use py-google-compute-engine instead for releasing Google Compute
 Engine (GCE) images with an updated version of Google's tools.

PR: 221714
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@331363 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330668: bktr: correct Japan IF frequency
emaste [Thu, 22 Mar 2018 00:55:36 +0000 (00:55 +0000)]
MFC r330668: bktr: correct Japan IF frequency

PR: 36451
Submitted by: Hijiri Umemoto <hijiri at umemoto.org>

git-svn-id: svn://svn.freebsd.org/base/stable/10@331338 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoAdd mergeinfo. This should have been part of r331320.
np [Thu, 22 Mar 2018 00:52:53 +0000 (00:52 +0000)]
Add mergeinfo.  This should have been part of r331320.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331336 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328315:
np [Wed, 21 Mar 2018 20:13:24 +0000 (20:13 +0000)]
MFC r328315:

cxgb(4): Validate offset/len in the GET_EEPROM ioctl.

Sponsored by: Chelsio Communications.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331320 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330793: fix r297857, do not modify CPU extension bits under virtual machines
avg [Wed, 21 Mar 2018 15:13:47 +0000 (15:13 +0000)]
MFC r330793: fix r297857, do not modify CPU extension bits under virtual machines

PR: 213155

git-svn-id: svn://svn.freebsd.org/base/stable/10@331305 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330374: db_script_exec: use a saved script name when reporting commands executed
avg [Wed, 21 Mar 2018 15:05:45 +0000 (15:05 +0000)]
MFC r330374: db_script_exec: use a saved script name when reporting commands executed

git-svn-id: svn://svn.freebsd.org/base/stable/10@331301 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC 330105:
kp [Wed, 21 Mar 2018 09:57:29 +0000 (09:57 +0000)]
MFC 330105:

pf: Do not flush on reload

pfctl only takes the last '-F' argument into account, so this never did what
was intended.

Moreover, there is no reason to flush rules before reloading, because pf keeps
track of the rule which created a given state. That means that existing
connections will keep being processed according to the rule which originally
created them. Simply reloading the (new) rules suffices. The new rules will
apply to new connections.

PR: 127814
Submitted by: Andreas Longwitz <longwitz at incore.de>

git-svn-id: svn://svn.freebsd.org/base/stable/10@331289 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330108:
kp [Wed, 21 Mar 2018 09:55:49 +0000 (09:55 +0000)]
MFC r330108:

pf: Apply $pf_flags when verifying the pf.conf file

When checking the validity of the pf.conf file also include the user supplied
pf_flags. These flags might overrule macros or specify anchors, which we will
apply when actually applying the pf.conf file, so we must also take them into
account when verifying the validity.

Submitted by: Andreas Longwitz <longwitz at incore.de>

git-svn-id: svn://svn.freebsd.org/base/stable/10@331287 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330745:
ian [Tue, 20 Mar 2018 22:57:14 +0000 (22:57 +0000)]
MFC r330745:

Make root mount timeout logic work for filesystems other than ufs.

The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5)
file allow specifying a wait timeout for the device(s) hosting the root
filesystem to become usable.  The current mechanism for waiting for devices
and detecting their availability can't be used for zfs-hosted filesystems.
See the comment #20 in the PR for some expanded detail on these points.

This change adds retry logic to the actual root filesystem mount.  That is,
insted of relying on device availability using device name lookups, it uses
the kernel_mount() call itself to detect whether the filesystem can be
mounted, and loops until it succeeds or the configured timeout is exceeded.

These changes are based on the patch attached to the PR, but it's rewritten
enough that all mistakes belong to me.

PR: 208882

git-svn-id: svn://svn.freebsd.org/base/stable/10@331276 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r331015:
dab [Mon, 19 Mar 2018 17:38:35 +0000 (17:38 +0000)]
MFC r331015:

Modify rc.d/fsck to handle new status from fsck/fsck_ffs

r328013 introduced a new error code from fsck_ffs that indicates that
it could not completely fix the file system; this happens when it
prints the message PLEASE RERUN FSCK. However, this status can happen
when fsck is run in "preen" mode and the rc.d/fsck script does not
handle that error code. Modify rc.d/fsck so that if "fsck -p"
("preen") returns the new status code (16) it will run "fsck -y", as
it currently does for a status code of 8 (the "standard error exit").

Reported by:    markj
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@331217 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r328834
marius [Mon, 19 Mar 2018 14:28:58 +0000 (14:28 +0000)]
MFC: r328834

o Let rtld(1) set up psABI user trap handlers prior to executing the
  objects' init functions instead of doing the setup via a constructor
  in libc as the init functions may already depend on these handlers
  to be in place. This gets us rid of:
  - the undefined order in which libc constructors as __guard_setup()
    and jemalloc_constructor() are executed WRT __sparc_utrap_setup(),
  - the requirement to link libc last so __sparc_utrap_setup() gets
    called prior to constructors in other libraries (see r122883).
  For static binaries, crt1.o still sets up the user trap handlers.
o Move misplaced prototypes for MD functions in to the MD prototype
  section of rtld.h.
o Sprinkle nitems().

git-svn-id: svn://svn.freebsd.org/base/stable/10@331206 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330792:
ae [Mon, 19 Mar 2018 09:54:16 +0000 (09:54 +0000)]
MFC r330792:
  Do not try to reassemble IPv6 fragments in "reass" rule.

  ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets
  that it gets. Until proper IPv6 fragments handling function will be
  implemented, pass IPv6 packets to next rule.

  PR: 170604

git-svn-id: svn://svn.freebsd.org/base/stable/10@331202 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329950:
kp [Sun, 18 Mar 2018 11:26:07 +0000 (11:26 +0000)]
MFC r329950:

pf: Cope with overly large net.pf.states_hashsize

If the user configures a states_hashsize or source_nodes_hashsize value we may
not have enough memory to allocate this. This used to lock up pf, because these
allocations used M_WAITOK.

Cope with this by attempting the allocation with M_NOWAIT and falling back to
the default sizes (with M_WAITOK) if these fail.

PR: 209475
Submitted by: Fehmi Noyan Isi <fnoyanisi AT yahoo.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@331117 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).
eugen [Fri, 16 Mar 2018 15:10:13 +0000 (15:10 +0000)]
MFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).

Submitted by: ale
Approved by: mav (mentor)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9270

git-svn-id: svn://svn.freebsd.org/base/stable/10@331059 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327929
marius [Thu, 15 Mar 2018 23:02:52 +0000 (23:02 +0000)]
MFC: r327929

Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by: Masanobu SAITOH

git-svn-id: svn://svn.freebsd.org/base/stable/10@331039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327355, r327926
marius [Thu, 15 Mar 2018 23:01:04 +0000 (23:01 +0000)]
MFC: r327355, r327926

- Don't allow userland to switch partitions; it's next to impossible
  to recover from that, especially when something goes wrong.
- When userland changes EXT_CSD, update the kernel copy before using
  relevant EXT_CSD bits in mmcsd_switch_part().

git-svn-id: svn://svn.freebsd.org/base/stable/10@331037 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327339, r327924
marius [Thu, 15 Mar 2018 22:58:34 +0000 (22:58 +0000)]
MFC: r327339, r327924

- There is no need to keep the tuning error and re-tuning interrupts
  enabled (though, no interrupt generation enabled for them) all the
  time as soon as (re-)tuning is supported; only enable them and let
  them generate interrupts when actually using (re-)tuning.
- Also disable all interrupts except SDHCI_INT_DATA_AVAIL ones while
  executing tuning and not just their signaling.
- Set the tuning error and re-tuning interrupt enable bits based on
  the SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag,
  i. e. only when (re-)tuning is actually used. Currently, this change
  makes no net difference, though.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r327315
marius [Thu, 15 Mar 2018 22:51:13 +0000 (22:51 +0000)]
MFC: r327315

Add quirks for Intel Denverton eMMC 5.0 controllers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331033 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: r287805
marius [Thu, 15 Mar 2018 22:42:28 +0000 (22:42 +0000)]
MFC: r287805

Unconditionally build CTF tools in the bootstrap-tools phase of the build.

Stale CTF tools are a frequent source of DTrace issues, and they compile
quickly enough that the increase in build time is negligible.

Apart from what's described in the original commit message above, this
change also fixes building GENERIC kernels, i. e. kernel configurations
having "makeoptions WITH_CTF=1", when the host world has been built with
WITHOUT_CDDL.

git-svn-id: svn://svn.freebsd.org/base/stable/10@331031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it
avg [Thu, 15 Mar 2018 11:04:30 +0000 (11:04 +0000)]
MFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it

git-svn-id: svn://svn.freebsd.org/base/stable/10@330989 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r322245,r329717: MFV r322242: 8373 TXG_WAIT in ZIL commit path
avg [Thu, 15 Mar 2018 11:00:55 +0000 (11:00 +0000)]
MFC r322245,r329717: MFV r322242: 8373 TXG_WAIT in ZIL commit path

MFC r322245: MFV r322242: 8373 TXG_WAIT in ZIL commit path
MFC r329717: MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue

git-svn-id: svn://svn.freebsd.org/base/stable/10@330987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330667: asmc: update temperature sensor name/description
emaste [Thu, 15 Mar 2018 00:44:34 +0000 (00:44 +0000)]
MFC r330667: asmc: update temperature sensor name/description

PR: 225911
Submitted by: Trev

git-svn-id: svn://svn.freebsd.org/base/stable/10@330961 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC: 327314
marius [Wed, 14 Mar 2018 23:59:52 +0000 (23:59 +0000)]
MFC: 327314

With the advent of interrupt remapping, Intel has repurposed bit 11
(now: Interrupt_Index[15]) and assigned the previously reserved bits
55:48 (Interrupt_Index[14:0] goes into 63:49 while Destination Field
used 63:56 and bit 48 now is Interrupt_Format) in the IO redirection
tables (see the VT-d specification, "5.1.5.1 I/OxAPIC Programming").
Thus, when not using interrupt remapping, ensure that all previously
reserved bits in the high part of the RTEs are zero instead of doing
a read-modify-write for their Destination Field bits only.
Otherwise, on machines based on Apollo Lake and its derivatives such
as Denverton, typically some of the previously preserved bits remain
set after boot when not employing interrupt remapping. The result is
that INTx interrupts are not getting delivered.
Note: With an AMD IOMMU, interrupt remapping apparently bypasses the
IO APIC altogether.

Submitted by: loos (modulo comment)
Reviewed by: jhb (modulo comment)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330959 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoConvert pci_delete_child() to a bus_child_deleted() method.
jhb [Wed, 14 Mar 2018 19:04:40 +0000 (19:04 +0000)]
Convert pci_delete_child() to a bus_child_deleted() method.

Instead of providing a wrapper around device_delete_child() that the PCI
bus and child bus drivers must call explicitly, move the bulk of the logic
from pci_delete_child() into a bus_child_deleted() method
(pci_child_deleted()).  This allows PCI devices to be safely deleted via
device_delete_child().
- Add a bus_child_deleted method to the ACPI PCI bus which clears the
  device_t associated with the corresponding ACPI handle in addition to
  the normal PCI bus cleanup.
- Change cardbus_detach_card to call device_delete_children() and move
  CardBus-specific delete logic into a new cardbus_child_deleted() method.
- Use device_delete_child() instead of pci_delete_child() in the SRIOV code.
- Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which
  frees the OpenFirmware device info for each PCI device.

To preserve KBI, a pci_delete_child() function is left in place that
just calls device_delete_child().

PR: 226562
Requested by: dexuan

git-svn-id: svn://svn.freebsd.org/base/stable/10@330938 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329105: ppp(8): fix code producing debugging logs
eugen [Mon, 12 Mar 2018 17:37:38 +0000 (17:37 +0000)]
MFC r329105: ppp(8): fix code producing debugging logs

  ppp(8): fix code producing debugging logs

  Fix several cases when long buffer is copied to shorter one
  using snprintf that results in contents truncation and
  clobbering unsaved errno value and creation of misleading logs.

PR: 218517
Approved by: mav (mentor)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330805 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330409:
brooks [Mon, 12 Mar 2018 16:04:10 +0000 (16:04 +0000)]
MFC r330409:

Refer to SysV IPC permissions as numeric constants.

POSIX defines no macros for these permissions.

Also remove unneeded headers from synopsis.

PR: 225905
Reviewed by: wblock
Differential Revision: https://reviews.freebsd.org/D14461

git-svn-id: svn://svn.freebsd.org/base/stable/10@330801 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r323314, r323338, r328849
asomers [Sat, 10 Mar 2018 04:17:01 +0000 (04:17 +0000)]
MFC r323314, r323338, r328849

r323314:
Audit userspace geom code for leaking memory to disk

Any geom class using g_metadata_store, as well as geom_virstor which
duplicated g_metadata_store internally, would dump sectorsize - mdsize bytes
of userspace memory following the metadata block stored. This is most or all
geom classes (gcache, gconcat, geli, gjournal, glabel, gmirror, gmultipath,
graid3, gshsec, gstripe, and geom_virstor).

PR: 222077 (comment #3)
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: des
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12269

r323338:
Fix information leak in geli(8) integrity mode

In integrity mode, a larger logical sector (e.g., 4096 bytes) spans several
physical sectors (e.g., 512 bytes) on the backing device.  Due to hash
overhead, a 4096 byte logical sector takes 8.5625 512-byte physical sectors.
This means that only 288 bytes (256 data + 32 hash) of the last 512 byte
sector are used.

The memory allocation used to store the encrypted data to be written to the
physical sectors comes from malloc(9) and does not use M_ZERO.

Previously, nothing initialized the final physical sector backing each
logical sector, aside from the hash + encrypted data portion.  So 224 bytes
of kernel heap memory was leaked to every block :-(.

This patch addresses the issue by initializing the trailing portion of the
physical sector in every logical sector to zeros before use.  A much simpler
but higher overhead fix would be to tag the entire allocation M_ZERO.

PR: 222077
Reported by: Maxim Khitrov <max AT mxcrypt.com>
Reviewed by: emaste
Security: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12272

r328849:
geom: don't write stack garbage in disk labels

Most consumers of g_metadata_store were passing in partially unallocated
memory, resulting in stack garbage being written to disk labels. Fix them by
zeroing the memory first.

gvirstor repeated the same mistake, but in the kernel.

Also, glabel's label contained a fixed-size string that wasn't
initialized to zero.

PR: 222077
Reported by: Maxim Khitrov <max@mxcrypt.com>
Reviewed by: cem
X-MFC-With: 323314
X-MFC-With: 323338
Differential Revision: https://reviews.freebsd.org/D14164

git-svn-id: svn://svn.freebsd.org/base/stable/10@330737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329265, r329384
asomers [Sat, 10 Mar 2018 04:10:57 +0000 (04:10 +0000)]
MFC r329265, r329384

r329265:
Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

zfsctl_common_pathconf will report all the same variables that regular ZFS
volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
except that you can't read xattrs or edit attributes.

Fixes a bug where "ls .zfs" will occasionally print something like:
ls: .zfs/.: Operation not supported

PR: 225793
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14365

r329384:
Handle generic pathconf attributes in the .zfs ctldir

MFC instructions: change the value of _PC_LINK_MAX to INT_MAX

Reported by: jhb
X-MFC-With: 329265
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@330736 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r329067:
asomers [Sat, 10 Mar 2018 04:02:51 +0000 (04:02 +0000)]
MFC r329067:

Fix "zpool add" crash when a replacing vdev has a spare child

Fix an assertion in zpool that causes a crash when running any "zpool add"
command on a spare that contains a replacing vdev with a spare child.

This likely affects Illumos, too.

PR: 225546
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14138

git-svn-id: svn://svn.freebsd.org/base/stable/10@330735 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r328011,329162
tychon [Sat, 10 Mar 2018 00:44:33 +0000 (00:44 +0000)]
MFC r328011,329162

r328011:

Provide some mitigation against CVE-2017-5715 by clearing registers
upon returning from the guest which aren't immediately clobbered by
the host.  This eradicates any remaining guest contents limiting their
usefulness in an exploit gadget.

r329162:

Provide further mitigation against CVE-2017-5715 by flushing the
return stack buffer (RSB) upon returning from the guest.

git-svn-id: svn://svn.freebsd.org/base/stable/10@330713 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r285885 by brueffer:
emaste [Fri, 9 Mar 2018 17:59:22 +0000 (17:59 +0000)]
MFC r285885 by brueffer:

In tmpfs_chtimes(), remove checks on the nanosecond level when
determining whether a node changed.

Other filesystems, e.g., UFS, only check on seconds, when determining
whether something changed.

This also corrects the birthtime case, where we checked tv_nsec
twice, instead of tv_sec and tv_nsec (PR).

PR: 201284

git-svn-id: svn://svn.freebsd.org/base/stable/10@330700 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330245:
dab [Fri, 9 Mar 2018 14:45:47 +0000 (14:45 +0000)]
MFC r330245:

Allow the "@" and "!" characters in passwd file GECOS fields.

Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.

PR:             152084, 210187
Submitted by:   jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by:    jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330695 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330085:
dab [Fri, 9 Mar 2018 14:39:28 +0000 (14:39 +0000)]
MFC r330085:

dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP

When dhclient first starts, if an old IP address exists in the
dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s)
in an attempt to re-obtain the old IP address again. These messages
contain the old IP as a requested-IP-address option in the message
body (correct) but also use the old IP address as the packet's source
IP (incorrect).

RFC2131 sec 4.1 states:

  DHCP messages broadcast by a client prior to that client obtaining
  its IP address must have the source address field in the IP header
  set to 0.

The use of the old IP as the packet's source address is incorrect if
(a) the computer is now on a different network or (b) it is on the
same network, but the old IP has been reallocated to another host.

Fix dhclient to use 0.0.0.0 as the source IP in this circumstance
without removing any existing functionality. Any previously-used old
IP is still requested in the body of an early DHCPREQUEST message.

PR:             199378
Submitted by:   J.R. Oldroyd <fbsd@opal.com>
Reported by:    J.R. Oldroyd <fbsd@opal.com>
Sponsored by:   Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@330693 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r330304: imcsmb(4): Intel integrated Memory Controller (iMC) SMBus
rpokala [Fri, 9 Mar 2018 02:55:27 +0000 (02:55 +0000)]
MFC r330304: imcsmb(4): Intel integrated Memory Controller (iMC) SMBus
controller driver

imcsmb(4) provides smbus(4) support for the SMBus controller functionality
in the integrated Memory Controllers (iMCs) embedded in Intel Sandybridge-
Xeon, Ivybridge-Xeon, Haswell-Xeon, and Broadwell-Xeon CPUs. Each CPU
implements one or more iMCs, depending on the number of cores; each iMC
implements two SMBus controllers (iMC-SMBs).

*** IMPORTANT NOTE ***
Because motherboard firmware or the BMC might try to use the iMC-SMBs for
monitoring DIMM temperatures and/or managing an NVDIMM, the driver might
need to temporarily disable those functions, or take a hardware interlock,
before using the iMC-SMBs. Details on how to do this may vary from board to
board, and the procedure may be proprietary. It is strongly suggested that
anyone wishing to use this driver contact their motherboard vendor, and
modify the driver as described in the manual page and in the driver itself.
(For what it's worth, the driver as-is has been tested on various SuperMicro
motherboards.)

git-svn-id: svn://svn.freebsd.org/base/stable/10@330680 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f