]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
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

6 years agoMFC r330527:
brooks [Fri, 9 Mar 2018 01:21:22 +0000 (01:21 +0000)]
MFC r330527:

Use umtx_copyin_umtx_time32() in __umtx_op_lock_umutex_compat32().

Non-NULL timeouts where copied in improperly and could produce failures
due to incompatible data structures.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14587

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

6 years agoMFC r330034
dab [Thu, 8 Mar 2018 17:14:16 +0000 (17:14 +0000)]
MFC r330034

Fix a memory leak in syslogd

A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak.

PR: 198385
Submitted by: Sreeram <sreeramabs@yahoo.com>
Reported by: Sreeram <sreeramabs@yahoo.com>
Sponsored by: Dell EMC

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

6 years agoFixup the AH patch to properly compile.
gordon [Wed, 7 Mar 2018 16:55:15 +0000 (16:55 +0000)]
Fixup the AH patch to properly compile.

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

6 years agoDocument EN-18:01, EN-18:02, SA-18:01, SA-18:02.
gjb [Wed, 7 Mar 2018 15:02:13 +0000 (15:02 +0000)]
Document EN-18:01, EN-18:02, SA-18:01, SA-18:02.

Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r329714: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks
avg [Wed, 7 Mar 2018 13:40:15 +0000 (13:40 +0000)]
MFC r329714: MFV r329713: 8731 ASSERT3U(nui64s, <=, UINT16_MAX) fails for large blocks

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

6 years agoMFC r316339,317396,317829,326010,329554: less v530.
delphij [Wed, 7 Mar 2018 06:39:00 +0000 (06:39 +0000)]
MFC r316339,317396,317829,326010,329554: less v530.

Relnotes: yes

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

6 years agoPort r329561 to stable/10. There were structural changes preventing MFC.
gordon [Wed, 7 Mar 2018 05:47:48 +0000 (05:47 +0000)]
Port r329561 to stable/10. There were structural changes preventing MFC.

Check packet length to not make an out of bounds access. Also, save ah_nxt
value to use later, since the ah pointer can become invalid.

Reviewed by: ae@
Approved by: so
Security: CVE-2018-6916
Security: FreeBSD-SA-18:01.ipsec

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

6 years agoMFC r329855
davidcs [Tue, 6 Mar 2018 23:17:56 +0000 (23:17 +0000)]
MFC r329855
  1. Added support to offline a port if is error recovery on successful.
  2. Sysctls to enable/disable driver_state_dump and error_recovery.
  3. Sysctl to control the delay between hw/fw reinitialization and
     restarting the fastpath.
  4. Stop periodic stats retrieval if interface has IFF_DRV_RUNNING flag off.
  5. Print contents of PEG_HALT_STATUS1 and PEG_HALT_STATUS2 on heartbeat
     failure.
  6. Speed up slowpath shutdown during error recovery.
  7. link_state update using atomic_store.
  8. Added timestamp information on driver state and minidump captures.
  9. Added support for Slowpath event logging
  10.Added additional failure injection types to simulate failures.

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

6 years agoMFC r324940:
asomers [Mon, 5 Mar 2018 20:43:43 +0000 (20:43 +0000)]
MFC r324940:

Fix the error message when creating a zpool on a too-small device

Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path.
It's redundant with the check in vdev_open, and failing to attach here
results in the wrong error message being printed.  However, still check for
it in some other situations:

* When opening by guids, so we don't get bogged down reading from slow
  devices like floppy drives.
* In vdev_geom_read_pool_label for the same reason, because we iterate over
  all providers.
* If the caller requests that we verify the guid, because then we'll have to
  read from the device before vdev_open verifies the size.

PR: 222227
Reported by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed by: avg, mav
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12531

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

6 years agoMFC r326401:
asomers [Mon, 5 Mar 2018 20:28:49 +0000 (20:28 +0000)]
MFC r326401:

Fix assertion when ZFS fails to open certain devices

"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR: 221066
Reported by: David NewHamlet <wheelcomplex@gmail.com>
Reviewed by: avg
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13278

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

6 years agoMFC r320726, r320727
asomers [Mon, 5 Mar 2018 19:02:32 +0000 (19:02 +0000)]
MFC r320726, r320727

r320726:
Expect :snprintf_float to segfault

This issue started occurring within the past month or so.

PR:   220502
Reported by:  Jenkins (amd64-head job)

r320727:
:snprintf_float: don't blindly set RLIMIT_DATA and RLIMIT_AS to 1 MB -- raise
the limit to 32MB instead.

Require user=root and memory=64MB+ first so one can be reasonably sure that
the test will function appropriately.

MFC with:     r320726
PR:   220502

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

6 years agoMFC r330027
dab [Mon, 5 Mar 2018 16:00:05 +0000 (16:00 +0000)]
MFC r330027

iconv uses strlen directly on user supplied memory

`iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the
size of user strings, such that several out of bounds reads could have
been possible.

static int
iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
{
struct iconv_converter_class *dcp;
struct iconv_cspair *csp;
struct iconv_add_in din;
struct iconv_add_out dout;
int error;

error = SYSCTL_IN(req, &din, sizeof(din));
if (error)
return error;
if (din.ia_version != ICONV_ADD_VER)
return EINVAL;
if (din.ia_datalen > ICONV_CSMAXDATALEN)
return EINVAL;
if (strlen(din.ia_from) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_to) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN)
return EINVAL;
...

Since the `din` struct is directly copied from userland, there is no
guarantee that the strings supplied will be NULL terminated. The
`strlen` calls could continue reading past the designated buffer
sizes.

Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`:

struct iconv_add_in {
int ia_version;
char ia_converter[ICONV_CNVNMAXLEN];
char ia_to[ICONV_CSNMAXLEN];
char ia_from[ICONV_CSNMAXLEN];
int ia_datalen;
const void *ia_data;
};

Our strings are followed by the `ia_datalen` member, which is checked
before the `strlen` calls:

if (din.ia_datalen > ICONV_CSMAXDATALEN)

Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`),
this ensures that `din.ia_datalen` contains at least 1 byte of 0, so
it is not possible to trigger a read out of bounds of the `struct`
however, this code is fragile and could introduce subtle bugs in the
future if the `struct` is ever modified.

PR: 207302
Submitted by: CTurt <cturt@hardenedbsd.org>
Reported by: CTurt <cturt@hardenedbsd.org>
Sponsored by: Dell EMC

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

6 years agoMFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
eugen [Mon, 5 Mar 2018 12:21:36 +0000 (12:21 +0000)]
MFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
when kernel already has options MAC_PORTACL.

PR: 183817
Approved by: avg (mentor)

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

6 years agoMFC r329930: route(8): make it possible to manually delete pinned route
eugen [Mon, 5 Mar 2018 12:06:41 +0000 (12:06 +0000)]
MFC r329930: route(8): make it possible to manually delete pinned route

Reported by: Andreas Longwitz <longwitz@incore.de>
Approved by: avg (mentor)

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

6 years agoMFC r325776:
bdrewery [Sun, 4 Mar 2018 23:36:58 +0000 (23:36 +0000)]
MFC r325776:

  Rework r325568 so all 'make LINT' targets work.

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

6 years agoMFC r330127:
bdrewery [Sun, 4 Mar 2018 23:34:04 +0000 (23:34 +0000)]
MFC r330127:

  Allow overriding .MAKE.MAKEFILE_PREFERENCE.

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

6 years agoMFC r329271:
bdrewery [Sun, 4 Mar 2018 23:31:25 +0000 (23:31 +0000)]
MFC r329271:

  nanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR].

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

6 years agoDocument SA-17:12 and correct EN-17:09 link [1]
delphij [Sat, 3 Mar 2018 08:52:02 +0000 (08:52 +0000)]
Document SA-17:12 and correct EN-17:09 link [1]

Reported by: eadler [1]

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

6 years agoMFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.
jhb [Sat, 3 Mar 2018 00:54:12 +0000 (00:54 +0000)]
MFC 328608: Export tcp_always_keepalive for use by the Chelsio TOM module.

This used to work by accident with ld.bfd even though always_keepalive
was marked as static. LLD honors static more correctly, so export this
variable properly (including moving it into the tcp_* namespace).

Relative to HEAD the MFC includes two additional changes:
- The t3_tom module used for cxgb(4) is also patched.
- A strong reference from the new name (tcp_always_keepalive) to the old
  name (always_keepalive) has been added to preserve the KBI for existing
  modules.

Suggested by: kib (strong reference)
Sponsored by: Chelsio Communications

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

6 years agoMFC of 329880.
mckusick [Fri, 2 Mar 2018 04:43:07 +0000 (04:43 +0000)]
MFC of 329880.

Add error number to "fsync: giving up on dirty" message.

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

6 years agoMFC r330033:
gjb [Thu, 1 Mar 2018 16:41:37 +0000 (16:41 +0000)]
MFC r330033:
 Bump the size of virtual machine disk images from 20G to 30G,
 providing more space for a local buildworld to succeed without
 attaching separate disks for /usr/src and /usr/obj.

Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed...
avg [Thu, 1 Mar 2018 10:57:50 +0000 (10:57 +0000)]
MFC r329314: MFV r329313: 8857 zio_remove_child() panic due to already destroyed parent zio

PR: 223803

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

6 years agoMFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable
avg [Thu, 1 Mar 2018 08:30:08 +0000 (08:30 +0000)]
MFC r329711: MFV r329710: 8966 use after end of the lifetime of a local variable

PR: 225162

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

6 years agoMFC r330104: MFV r330102: ntp 4.2.8p11
delphij [Thu, 1 Mar 2018 04:06:49 +0000 (04:06 +0000)]
MFC r330104: MFV r330102: ntp 4.2.8p11

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

6 years agoMFC 328630:
jhb [Wed, 28 Feb 2018 22:39:47 +0000 (22:39 +0000)]
MFC 328630:
Clarify that the additional arguments to makecontext() are of type int.

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

6 years agoMFC 328610: Ensure 'name' is not NULL before passing to strcmp().
jhb [Wed, 28 Feb 2018 22:33:07 +0000 (22:33 +0000)]
MFC 328610: Ensure 'name' is not NULL before passing to strcmp().

This avoids a nested page fault when obtaining a stack trace in DDB if
the address from the first frame does not resolve to a known symbol.

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

6 years agoMFC r329843:
rpokala [Wed, 28 Feb 2018 10:00:02 +0000 (10:00 +0000)]
MFC r329843:

jedec_dimm(4): report asset info and temperatures for DDR3 and DDR4 DIMMs

A super-set of the functionality of jedec_ts(4). jedec_dimm(4) reports asset
information (Part Number, Serial Number) encoded in the "Serial Presence
Detect" (SPD) data on JEDEC DDR3 and DDR4 DIMMs. It also calculates and
reports the memory capacity of the DIMM, in megabytes. If the DIMM includes
a "Thermal Sensor On DIMM" (TSOD), the temperature is also reported.

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

6 years agoMFC r329848:
pfg [Wed, 28 Feb 2018 02:49:48 +0000 (02:49 +0000)]
MFC r329848:
__printf_render_int(): small type change to match use.

Variable l is consistently used as an int rather than a char.
Sort names while here.

Obtained from: Apple's Libc-1244.30.3

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

6 years agoMFC r329846:
pfg [Wed, 28 Feb 2018 02:39:38 +0000 (02:39 +0000)]
MFC r329846:
getpeereid(3): Fix behavior on failure to match documentation.

According to the getpeereid(3) documentation, on failure the value -1 is
returned and the global variable errno is set to indicate the error. We
were returning the error instead.

Obtained from: Apple's Libc-1244.30.3

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

6 years agoMFC r329682:
rpokala [Wed, 28 Feb 2018 00:30:03 +0000 (00:30 +0000)]
MFC r329682:

mountd: Return proper errno values in a few error paths

When attempting to mount a non-directory which exists, return ENOTDIR
instead of ENOENT. If stat() or statfs() failed, don't pass part of the
invalid (struct statfs) to ex_search(). In that same case, preserve the
value of "bad" rather than overwriting with EACCES.

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

6 years agoAvoid using the C++11 auto keyword, which was introduced in r328555, as
dim [Tue, 27 Feb 2018 19:02:49 +0000 (19:02 +0000)]
Avoid using the C++11 auto keyword, which was introduced in r328555, as
part of an upstream change.  This is not supported by gcc 4.2.1, which
is still the default system compiler for some architectures.

Direct commit to stable/9 and stable/10, since this does not apply to
stable/11 and head.

Reported by: jau@iki.fi
PR: 202665,226068

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

6 years agoMFC r329556,r329820 remove an assert in zfsctl_snapdir_lookup to match r323578
avg [Tue, 27 Feb 2018 14:51:21 +0000 (14:51 +0000)]
MFC r329556,r329820 remove an assert in zfsctl_snapdir_lookup to match r323578

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

6 years agoMFC r329364: move vintr_intercept_enabled under INVARIANTS
avg [Tue, 27 Feb 2018 14:47:56 +0000 (14:47 +0000)]
MFC r329364: move vintr_intercept_enabled under INVARIANTS

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

6 years agoMFC r328996: exec_map_first_page: fix an inverse condition introduced in r254138
avg [Tue, 27 Feb 2018 14:45:55 +0000 (14:45 +0000)]
MFC r328996: exec_map_first_page: fix an inverse condition introduced in r254138

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

6 years agoMFC r329016: remove a duplicate assignment
avg [Tue, 27 Feb 2018 14:43:19 +0000 (14:43 +0000)]
MFC r329016: remove a duplicate assignment

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

6 years agoMFC r328881: zfs: move a utility function, ioflags, closer to its consumers
avg [Tue, 27 Feb 2018 14:41:35 +0000 (14:41 +0000)]
MFC r328881: zfs: move a utility function, ioflags, closer to its consumers

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

6 years agoMFC r328217: zfs: no need to check that size of zfs_cmd_t is not greater than IOCPARM_MAX
avg [Tue, 27 Feb 2018 14:23:43 +0000 (14:23 +0000)]
MFC r328217: zfs: no need to check that size of zfs_cmd_t is not greater than IOCPARM_MAX

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

6 years agoMFC 328134: Update various statements in vmstat(8) to match reality.
jhb [Tue, 27 Feb 2018 01:28:19 +0000 (01:28 +0000)]
MFC 328134: Update various statements in vmstat(8) to match reality.

- The process stats are actually thread counts rather than process
  counts.
- Simplify various descriptions to remove mention of stats that are
  updated every 5 seconds (all VM related stats are now "instant",
  only the load average is updated every 5 seconds).
- Don't make any mention of special treatment for processes that have
  been active in the last 20 seconds.  We don't track that stat.
- Rework the description of active virtual memory.  Call it mapped
  virtual memory and explicitly point out it is not the same as the
  active page queue (which corresponds to "Active" in top(1)), and
  also hint at the possible bogusness of the value (e.g. if a process
  maps a single page out of a multiple GB file, the entire file's size
  is considered mapped).
- Simplify a few descriptions that implied their output was a value
  per interval.  All of the "rate" values are per-second rates scaled
  across the interval.
- Update a few comments for 'struct vmtotal' along similar lines.

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

6 years agoMFC r329195:
hselasky [Mon, 26 Feb 2018 07:57:56 +0000 (07:57 +0000)]
MFC r329195:
Add new USB quirk.

PR: 225844
Sponsored by: Mellanox Technologies

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

6 years agoFix for LINT-{NOINET,NOINET6,NOIP} kernel builds.
hselasky [Sun, 25 Feb 2018 11:29:55 +0000 (11:29 +0000)]
Fix for LINT-{NOINET,NOINET6,NOIP} kernel builds.

This is a direct commit.

Reported by: rpokala@
Sponsored by: Mellanox Technologies

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

6 years agoFix after incomplete MFC r326012: correctly delete loopback route
eugen [Sat, 24 Feb 2018 16:50:57 +0000 (16:50 +0000)]
Fix after incomplete MFC r326012: correctly delete loopback route
while removing interface address.

Reported by: Andreas Longwitz <longwitz@incore.de>
Approved by: avg (mentor)

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

6 years agoMFC of 329749.
mckusick [Fri, 23 Feb 2018 23:07:41 +0000 (23:07 +0000)]
MFC of 329749.

Fix a read past the end of a buffer in fsck.

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

6 years agoMFC r323508:
rpokala [Fri, 23 Feb 2018 16:46:49 +0000 (16:46 +0000)]
MFC r323508:

When doing a non-interactive installation, don't display an interactive
warning about a filesystem which doesn't have a mountpoint. Presumably, the
person who wrote the install script knew what they were doing.

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

6 years agoFix for LINT kernel build.
hselasky [Thu, 22 Feb 2018 20:48:02 +0000 (20:48 +0000)]
Fix for LINT kernel build.

This is a direct commit.

Discussed with: np@
Reported by: rpokala@
Sponsored by: Mellanox Technologies

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

6 years agoFix for LINT-NOINET kernel build.
hselasky [Thu, 22 Feb 2018 20:09:21 +0000 (20:09 +0000)]
Fix for LINT-NOINET kernel build.

This is a direct commit.

Reported by: rpokala@
Sponsored by: Mellanox Technologies

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

6 years agoMFC r329295:
rpokala [Thu, 22 Feb 2018 19:40:03 +0000 (19:40 +0000)]
MFC r329295:

Panasas discovered that ioctl(SIOCGLAGGPORT) returns ENOTTY for mxge(4) when
the NIC is not a member of a lagg. This came as a surprise, because the
SIOCGLAGGPORT handler in if_lagg.c only returns ENOENT (if run against the
laggX interface, rather than a physical port) or EINVAL (if run against a
non-member physical port). This behavior was not seen with other drivers,
such as bge(4), igb(4), and cxl(4). When I compared their respective ioctl
handlers, I found that they all called ether_ioctl() for the default (i.e.
unhandled) case; by contrast, mxge(4) only calls ether_ioctl() for two
specific cases, and returns ENOTTY for the default case.

Remove the two cases which explicitly call ether_ioctl(), and let the
default case call it instead. This matches what the vast majority of the NIC
drivers do.

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

6 years agoMFC r329525:
brooks [Wed, 21 Feb 2018 18:32:57 +0000 (18:32 +0000)]
MFC r329525:

Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids).

The description of kern.ipc.shmsegs was wrong since 2005.  I updated the
others (which were more correct) to match.

PR: 225933
Reviewed by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14391

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

6 years agoMFC r329254:
kib [Wed, 21 Feb 2018 11:31:29 +0000 (11:31 +0000)]
MFC r329254:
Ensure memory consistency on COW.

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

6 years agoMFC r328864 (Synaptics part only):
wulf [Sun, 18 Feb 2018 22:12:20 +0000 (22:12 +0000)]
MFC r328864 (Synaptics part only):

psm(4): Fix panic occuring soon after PS/2 packet has been rejected by
synaptics sanity checker.

After packet has been rejected contents of packet buffer is not cleared
with setting of inputbytes counter to 0. So when this packet buffer is
filled again being an element of circular queue, new data appends to old
data rather than overwrites it. This leads to packet buffer overflow
after 10 rounds.

Fix it with setting of packet's inputbytes counter to 0 after rejection.

While here add extra logging of rejected packets.

PR: 222667 (for reference)
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>

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

6 years agoMFC r328622: vmm/svm: post LAPIC interrupts using event injection
avg [Thu, 15 Feb 2018 17:10:42 +0000 (17:10 +0000)]
MFC r328622: vmm/svm: post LAPIC interrupts using event injection

PR: 215972

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

6 years agoMFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
avg [Thu, 15 Feb 2018 16:31:35 +0000 (16:31 +0000)]
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037

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

6 years agoMFC r328163:
hselasky [Thu, 15 Feb 2018 08:57:14 +0000 (08:57 +0000)]
MFC r328163:
Add new USB ID to U3G driver.

PR: 134299
Sponsored by: Mellanox Technologies

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

6 years agoMFC r328830:
hselasky [Thu, 15 Feb 2018 08:52:58 +0000 (08:52 +0000)]
MFC r328830:
Add new USB ID.

PR: 225641
Submitted by: Ryan <ryanwinter@outlook.com>
Sponsored by: Mellanox Technologies

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

6 years agoMFC r328591:
hselasky [Thu, 15 Feb 2018 08:48:04 +0000 (08:48 +0000)]
MFC r328591:
Move the mlx5 core device pointer first in the mlx5en priv. This help simplify
checks to recognize own network devices when using mlx5ib. This patch fixes
an issues where mlx5ib fails to recognize mceX network devices for use with
RoCE.

Sponsored by: Mellanox Technologies

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

6 years agoMFC r328876:
ae [Mon, 12 Feb 2018 13:52:58 +0000 (13:52 +0000)]
MFC r328876:
  Modify ip6_get_prevhdr() to be able use it safely.

  Instead of returning pointer to the previous header, return its offset.
  In frag6_input() use m_copyback() and determined offset to store next
  header instead of accessing to it by pointer and assuming that the memory
  is contiguous.

  In rip6_input() use offset returned by ip6_get_prevhdr() instead of
  calculating it from pointers arithmetic, because IP header can belong
  to another mbuf in the chain.

  Reported by: Maxime Villard <max at m00nbsd dot net>

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

6 years agoMFC r328895: Correct Russia spelling in regdomain.xml
emaste [Sat, 10 Feb 2018 22:36:42 +0000 (22:36 +0000)]
MFC r328895: Correct Russia spelling in regdomain.xml

PR: 225658

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

6 years agojedec_ts(4) uses a sysctl format specifier of "IK4", to indicate that it
rpokala [Thu, 8 Feb 2018 09:24:23 +0000 (09:24 +0000)]
jedec_ts(4) uses a sysctl format specifier of "IK4", to indicate that it
reports milliKelvin. However, sysctl(8) on stable/10 only knows about "IK",
without a numeric suffix, which represents deciKelvin.

Adjust the format specifier, and round the temperature value reported.

Reviewed by: avg
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D14055

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

6 years agoMFC r328412: vt: add Ctrl+/ key mapping
emaste [Thu, 8 Feb 2018 00:42:02 +0000 (00:42 +0000)]
MFC r328412: vt: add Ctrl+/ key mapping

This matches Xorg's handling of Ctrl+/ and may be useful as a tmux
escape.

PR: 212197
Submitted by: martin at sugioarto.com

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

6 years agoAdjust MFC in r328946 to stable/10.
mckusick [Wed, 7 Feb 2018 22:50:10 +0000 (22:50 +0000)]
Adjust MFC in r328946 to stable/10.
This is a direct commit to the branch.

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

6 years agoMFC of 328647.
mckusick [Tue, 6 Feb 2018 19:17:40 +0000 (19:17 +0000)]
MFC of 328647.

avoid segment fault in g_journal

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

6 years agoMFC of 328643.
mckusick [Tue, 6 Feb 2018 19:14:53 +0000 (19:14 +0000)]
MFC of 328643.

fix vn_printf listing of its union

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

6 years agoMFC of 328304 and 328382.
mckusick [Tue, 6 Feb 2018 19:09:49 +0000 (19:09 +0000)]
MFC of 328304 and 328382.

Do not dedup egid (group entry 0)

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

6 years agoMFC r328273 (kevlo): Document how to load nmdm(4) from a kernel module.
delphij [Tue, 6 Feb 2018 07:50:30 +0000 (07:50 +0000)]
MFC r328273 (kevlo): Document how to load nmdm(4) from a kernel module.

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

6 years agoMFC r328770:
ae [Mon, 5 Feb 2018 09:25:53 +0000 (09:25 +0000)]
MFC r328770:
  Merge r1.120 from NetBSD:
    Fix a pretty simple, yet pretty tragic typo: we should return IPPROTO_DONE,
    not IPPROTO_NONE. With IPPROTO_NONE we will keep parsing the header chain
    on an mbuf that was already freed.

  Reported by: Maxime Villard <max at m00nbsd dot net>

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

6 years agoMFC r323683:
eadler [Mon, 5 Feb 2018 08:50:34 +0000 (08:50 +0000)]
MFC r323683:

MFV r323678: file 5.32

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

6 years agoMFC r327775: amdsbwd: fix handling of timeout values beyond the supported range
avg [Sun, 4 Feb 2018 13:58:29 +0000 (13:58 +0000)]
MFC r327775: amdsbwd: fix handling of timeout values beyond the supported range

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

6 years agoMFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive
avg [Sun, 4 Feb 2018 13:54:43 +0000 (13:54 +0000)]
MFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive

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

6 years agoMFH r328332:
mm [Sat, 3 Feb 2018 02:17:25 +0000 (02:17 +0000)]
MFH r328332:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

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

6 years agoMFC of 328444.
mckusick [Fri, 2 Feb 2018 01:28:14 +0000 (01:28 +0000)]
MFC of 328444.

Eliminate "fsync: giving up on dirty" messages.

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

6 years agoMFC r328623:
hselasky [Thu, 1 Feb 2018 13:16:11 +0000 (13:16 +0000)]
MFC r328623:
Properly implement the cond_resched() function macro in the LinuxKPI.

Sponsored by: Mellanox Technologies

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

6 years agoMFC r328497:
pfg [Thu, 1 Feb 2018 02:00:36 +0000 (02:00 +0000)]
MFC r328497:
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

MFC after: 5 days
Reviewed by: kp
Obtained from: DragonFlyBSD (git e3cdbf6c)

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

6 years agoMFC r328350:
ae [Wed, 31 Jan 2018 09:26:28 +0000 (09:26 +0000)]
MFC r328350:
  Merge revision 1.35 from NetBSD:
    fix pointer/offset mistakes in handling of IPv4 options

  Reported by:  Maxime Villard <maxv at NetBSD.org>

MFC r328352:
  Adopt revision 1.76 and 1.77 from NetBSD:
    Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
    crash the kernel with a single packet.

    In this loop we need to increment 'ad' by two, because the length field
    of the option header does not count the size of the option header itself.

    If the length is zero, then 'count' is incremented by zero, and there's
    an infinite loop. Beyond that, this code was written with the assumption
    that since the IPv6 packet already went through the generic IPv6 option
    parser, several fields are guaranteed to be valid; but this assumption
    does not hold because of the missing '+2', and there's as a result a
    triggerable buffer overflow (write zeros after the end of the mbuf,
    potentially to the next mbuf in memory since it's a pool).

    Add the missing '+2', this place will be reinforced in separate commits.

  Reported by:  Maxime Villard <maxv at NetBSD.org>

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

6 years agoMFC 327561:
jhb [Mon, 29 Jan 2018 23:43:04 +0000 (23:43 +0000)]
MFC 327561:
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Sponsored by: DARPA / AFRL

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

6 years agoRevert a local change and sync. with head. No functional change.
jkim [Mon, 29 Jan 2018 18:21:50 +0000 (18:21 +0000)]
Revert a local change and sync. with head.  No functional change.

Note this is a direct commit because head has OpenSSL 1.0.2.

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

6 years agoPull in r217197 from upstream clang trunk (by Richard Smith):
dim [Mon, 29 Jan 2018 18:11:27 +0000 (18:11 +0000)]
Pull in r217197 from upstream clang trunk (by Richard Smith):

  PR20844: If we fail to list-initialize a reference, map to the
  referenced type before retrying the initialization to produce
  diagnostics. Otherwise, we may fail to produce any diagnostics, and
  silently produce invalid AST in a -Asserts build. Also add a note to
  this codepath to make it more clear why we were trying to create a
  temporary.

This should fix assertions when parsing some forms of incomplete list
intializers.

Direct commit to stable/9 and stable/10, since stable/11 and head
already have this upstream fix.

Reported by: ajcbowhill@gmail.com
PR: 202665

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

6 years agopsm: Log syncmask[1], not syncmask[0] twice
dumbbell [Sat, 27 Jan 2018 17:24:59 +0000 (17:24 +0000)]
psm: Log syncmask[1], not syncmask[0] twice

MFC of: r328208

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

6 years agoMFC r328055: Import tzdata 2018a
philip [Sat, 27 Jan 2018 13:34:14 +0000 (13:34 +0000)]
MFC r328055: Import tzdata 2018a
MFC r328318: Import tzdata 2018c

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

6 years agoMFC r328283, r328284:
gjb [Fri, 26 Jan 2018 04:32:31 +0000 (04:32 +0000)]
MFC r328283, r328284:

 r328283:
  When CHROOTBUILD_SKIP is set, evaluate the existence of /bin/sh
  within the CHROOTDIR.  If it does not exist, unset CHROOTBUILD_SKIP
  to prevent build failures.

 r328284:
  Bump Copyright year.

Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r328297:
brooks [Fri, 26 Jan 2018 00:35:33 +0000 (00:35 +0000)]
MFC r328297:

Don't escape '?'s in protocol output.

This isn't required by mandoc and is nonfunctional in groff.

PR: 224632
Reported by: w.schwarzenfeld@utanet.at
Differential Revision: https://reviews.freebsd.org/D13779

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

6 years agoMFC 287600,287602: Fixes for fork following tests.
jhb [Thu, 25 Jan 2018 00:08:13 +0000 (00:08 +0000)]
MFC 287600,287602: Fixes for fork following tests.

287600:
Properly size the children[] arrays in the follow fork tests.

287602:
Use _exit() instead of exit() in child processes created during tests.

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

6 years agoMFC 325028,328344: Discard the correct thread event reported for a ptrace stop.
jhb [Wed, 24 Jan 2018 21:48:39 +0000 (21:48 +0000)]
MFC 325028,328344: Discard the correct thread event reported for a ptrace stop.

325028:
Discard the correct thread event reported for a ptrace stop.

When multiple threads wish to report a tracing event to a debugger,
both threads call ptracestop() and one thread will win the race to be
the reporting thread (p->p_xthread).  The debugger uses PT_LWPINFO
with the process ID to determine which thread / LWP is reporting an
event and the details of that event.  This event is cleared as a side
effect of the subsequent ptrace event that resumed the process
(PT_CONTINUE, PT_STEP, etc.).  However, ptrace() was clearing the
event identified by the LWP ID passed to the resume request even if
that wasn't the 'p_xthread'.  This could result in clearing an event
that had not yet been observed by the debugger and leaving the
existing event for 'p_thread' pending so that it was reported a second
time.

Specifically, if the debugger stopped due to a software breakpoint in
one thread, but then switched to another thread that was used to
resume (e.g. if the user switched to a different thread and issued a
step), the resume request (PT_STEP) cleared a pending event (if any)
for the thread being stepped.  However, the process immediately
stopped and the first thread reported it's breakpoint event a second
time.  The debugger decremented the PC for "both" breakpoint events
which resulted in the PC now pointing into the middle of an
instruction (on x86) and a SIGILL fault when the process was resumed a
second time.

To fix, always clear the pending event for 'p_xthread' when resuming a
process.  ptrace() still honors the requested LWP ID when enabling
single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).

328344:
Mark the unused argument to continue_thread() as such.

clang in HEAD and 11 does not warn about this, but clang in 10 does.

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

6 years agoMFC 326953:
jhb [Wed, 24 Jan 2018 00:32:02 +0000 (00:32 +0000)]
MFC 326953:
Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies.

Some of the ptrace tests need to wait for a child process to become a
zombie before preceding.  The parent process polls the child process
via the kern.proc.pid sysctl to wait for it to become a zombie.
Previously the code polled until the sysctl failed with ESRCH.  Now it
will poll until either the sysctl fails with ESRCH (for compatiblity
with older kernels) or returns a kinfo_proc structure with the ki_stat
field set to SZOMB.

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

6 years agoMFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests.
jhb [Tue, 23 Jan 2018 18:22:41 +0000 (18:22 +0000)]
MFC 325835: Use #if instead of #ifdef for __BSD_VISIBLE tests.

__BSD_VISIBLE is always defined and it's value instead needs to be
tested via #if to determine if FreeBSD-specific APIs should be
exposed.

PR: 196226

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

6 years agoMFC r327675
kp [Tue, 23 Jan 2018 05:03:26 +0000 (05:03 +0000)]
MFC r327675

pf: Avoid integer overflow issues by using mallocarray() iso. malloc()

pfioctl() handles several ioctl that takes variable length input, these
include:
- DIOCRADDTABLES
- DIOCRDELTABLES
- DIOCRGETTABLES
- DIOCRGETTSTATS
- DIOCRCLRTSTATS
- DIOCRSETTFLAGS

All of them take a pfioc_table struct as input from userland. One of
its elements (pfrio_size) is used in a buffer length calculation.
The calculation contains an integer overflow which if triggered can lead
to out of bound reads and writes later on.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

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

6 years agoMFC r327674, r327796
kp [Tue, 23 Jan 2018 04:37:31 +0000 (04:37 +0000)]
MFC r327674, r327796

Introduce mallocarray() in the kernel

Similar to calloc() the mallocarray() function checks for integer
overflows before allocating memory.
It does not zero memory, unless the M_ZERO flag is set.

Additionally, move the overflow check logic out to WOULD_OVERFLOW() for
consumers to have a common means of testing for overflowing allocations.
WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just
because an allocation won't overflow size_t does not mean it is a sane size
to request.  Callers should be imposing reasonable allocation limits far,
far, below overflow.

Obtained from: OpenBSD

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

6 years agoMFC r327718:
cy [Tue, 23 Jan 2018 04:01:48 +0000 (04:01 +0000)]
MFC r327718:

When growing the state, also grow the seed array. Otherwise memory
that was not allocated will be accessed.

This necessitated refactoring state seed allocation from
ipf_state_soft_init() into a new common ipf_state_seed_alloc() function
as it is now also used by ipf_state_rehash() when changing the size of
the state hash table in addition to by ipf_state_soft_init() during
initialization.

According to Christos Zoulas <christos@NetBSD.org>:

The bug was encountered by a NetBSD vendor who's customer machines had
large ipfilter states. The bug was reliably triggered by resizing the
state variables using "ipf -T".

Submitted by: Christos Zoulas <christos@NetBSD.org>
Reviewed by: delphij, rgrimes
Obtained from: NetBSD ip_state.c CVS revs r1.9 and r1.10
Differential Revision: https://reviews.freebsd.org/D13755

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

6 years agoMFC r327497, r327498: fix memory disclosure in hpt* ioctls
emaste [Tue, 23 Jan 2018 02:29:39 +0000 (02:29 +0000)]
MFC r327497, r327498: fix memory disclosure in hpt* ioctls

r327497: hpt27xx: plug info leak in hpt_ioctl

The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

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

Reported by:  Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)

r327498: hpt{nr,rr}: plug info leak in hpt_ioctl

The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

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

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Security: memory disclosure in root-only ioctls
Sponsored by: The FreeBSD Foundation

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

6 years agoMFC r317806 by glebius:
emaste [Tue, 23 Jan 2018 02:16:06 +0000 (02:16 +0000)]
MFC r317806 by glebius:

The nandsim(4) simulator driver doesn't have any protection against
races at least in its ioctl handler, and at the same time it creates
device entry with 0666 permissions.

To plug possible issues in it:
- Mark it as needing Giant.
- Switch device mode to 0600.

Submitted by: C Turt
Reviewed by: imp
Security: Possible double free in ioctl handler

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

6 years agoMFC r327913:
cy [Sat, 20 Jan 2018 18:04:08 +0000 (18:04 +0000)]
MFC r327913:

Remove redundant variable.

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

6 years agoMFC r327912:
cy [Sat, 20 Jan 2018 18:00:42 +0000 (18:00 +0000)]
MFC r327912:

Though this block of code is not used by FreeBSD, correct a call to
sprintf() with a macro call to SNPRINTF similar to other calls to
SNPRINTF within this same block.

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

6 years agoMFC r327724: usbdevs: add ASMedia vendor ID
avg [Tue, 16 Jan 2018 11:25:08 +0000 (11:25 +0000)]
MFC r327724: usbdevs: add ASMedia vendor ID

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

6 years agoMFC r327725: zfs_mount: restore a bit of ifdef-out illumos code
avg [Tue, 16 Jan 2018 11:22:07 +0000 (11:22 +0000)]
MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code

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

6 years agoMFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block structure
avg [Mon, 15 Jan 2018 12:17:26 +0000 (12:17 +0000)]
MFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block structure

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

6 years agoMFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'
avg [Mon, 15 Jan 2018 12:15:04 +0000 (12:15 +0000)]
MFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'

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

6 years agoMFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices
avg [Mon, 15 Jan 2018 12:00:34 +0000 (12:00 +0000)]
MFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices

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

6 years agoMFC 327737:
cy [Fri, 12 Jan 2018 02:49:18 +0000 (02:49 +0000)]
MFC 327737:

USNO and possibly others have misinterpreted the maining of the
leapseconds last-update field and incorrectly increment it when changing
the file even though the leapsecond data has not changed. For instance,
if a leapsecond file is obtained from USNO, when it expires it will not
be replaced by a newer file from other sources because it has an
incorrect later last-update (version).

This corrects r304780.

PR: 225029
Submitted by: ian

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

6 years agoMFC r284406:
bdrewery [Thu, 11 Jan 2018 21:31:10 +0000 (21:31 +0000)]
MFC r284406:

  Use cpp -I$includedir

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

6 years agoMFC r327289:
pfg [Wed, 10 Jan 2018 21:24:03 +0000 (21:24 +0000)]
MFC r327289:
rpc.sprayd: Bring some changes from NetBSD.

Most notable, other than some style issues:
CVS 1.11:
  do not use LOG_CONS.
CVS 1.13:
  consistently use exit instead of return in main().
  use LOG_WARNING instead of LOG_ERR for non critical errors.

Obtained from: NetBSD

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

6 years agoMFC r327540:
cy [Tue, 9 Jan 2018 06:10:57 +0000 (06:10 +0000)]
MFC r327540:

Correct function name in description block.

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