]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r341068:
David Bright [Fri, 30 Nov 2018 01:45:54 +0000 (01:45 +0000)]
MFC r341068:

Make whitespace more consistent in libkqueue tests.

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
originally space-based, not tab-spaced, and so the correction should
have been to get rid of the tabs that had been introduced in previous
changes, not the spaces. This change does that. This is a whitespace
only change; no functional change is intended.

Reported by: jmg@
Sponsored by: Dell EMC Isilon

5 years agoMFV: r341039, MFC: r341041
Marius Strobl [Thu, 29 Nov 2018 21:10:18 +0000 (21:10 +0000)]
MFV: r341039, MFC: r341041

Import CK as of 21d3e319407d19dece16ee317c757ffc54a452bc, which makes its
sparcv9 atomics compatible with the FreeBSD kernel by using instructions
which access the appropriate address space.
Atomic operations within the kernel must access the nucleus address space
instead of the default primary one. Without this change but the increased
use of CK in the kernel, machines started to panic after some minutes of
uptime due to an unresolvable fault in ck_pr_cas_64_value().

5 years agoMFC: r341016
Marius Strobl [Thu, 29 Nov 2018 20:48:38 +0000 (20:48 +0000)]
MFC: r341016

- Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338.
- Likewise, add ixlv.4.gz to OLD_FILES,
- and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition.

5 years agoMFC r340483 (by jtl):
Mark Johnston [Thu, 29 Nov 2018 20:25:47 +0000 (20:25 +0000)]
MFC r340483 (by jtl):
Add some additional length checks to the IPv4 fragmentation code.

5 years agoMFC r341248:
Mark Johnston [Thu, 29 Nov 2018 17:42:30 +0000 (17:42 +0000)]
MFC r341248:
Fix age_old_log() after r337468.

PR: 233633

5 years agoMFC r341247:
Mark Johnston [Thu, 29 Nov 2018 17:35:37 +0000 (17:35 +0000)]
MFC r341247:
Update the free page count when blacklisting pages.

PR: 231296
Approved by: re (gjb, insta-MFC)

5 years agoregen src.conf.5 after r341239
Ed Maste [Thu, 29 Nov 2018 15:53:10 +0000 (15:53 +0000)]
regen src.conf.5 after r341239

5 years agoMFC r340984: Do not install GNU ld if lld is /usr/bin/ld
Ed Maste [Thu, 29 Nov 2018 15:48:36 +0000 (15:48 +0000)]
MFC r340984: Do not install GNU ld if lld is /usr/bin/ld

GNU binutils ld.bfd 2.17.50 does not support ifuncs and produces broken
binaries when ifuncs are in use.  When LLD_IS_LD is default we have an
ifunc-capable system linker and can just avoid installing ld.bfd.

Merged to stable/12 as libc's ifunc use has been merged there; ifunc use
has not been merged to releng/12.0 so this change does not need to be
either.

5 years agoMFC r340968:
Mark Johnston [Thu, 29 Nov 2018 15:42:32 +0000 (15:42 +0000)]
MFC r340968:
Plug routing sysctl leaks.

5 years agoMFC r339900:
Mark Johnston [Thu, 29 Nov 2018 15:38:27 +0000 (15:38 +0000)]
MFC r339900:
Have gconcat advertise delete support if one of its disks does.

PR: 232676

5 years agoMFC r340976:
Yuri Pankov [Thu, 29 Nov 2018 15:05:47 +0000 (15:05 +0000)]
MFC r340976:
vi: fix UTF-8 detection.

PR: 202290
Submitted by: lampa@fit.vutbr.cz
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D17950

5 years agoMFC r340047:
Toomas Soome [Thu, 29 Nov 2018 13:58:41 +0000 (13:58 +0000)]
MFC r340047:
loader: do not probe floppy devices for zfs

Floppy devices do not have enough space for ZFS pool.

5 years agoMFC r340049:
Toomas Soome [Thu, 29 Nov 2018 13:55:57 +0000 (13:55 +0000)]
MFC r340049:
loader: biosdisk should check if the media is present

The bd_print/bd_open/bd_strategy need to make sure the device does have
media, before getting into performing IO operations. Some systems can
hung if the device without a media is accessed.

Reported by: yuripv

5 years agoMFC r339959:
Toomas Soome [Thu, 29 Nov 2018 13:54:07 +0000 (13:54 +0000)]
MFC r339959:
loader: issue edd probe before legacy ah=08 and detect no media

while probing for drives, use int13 extended info before standard one and
provide workaround for case we are not getting needed information in case
of floppy drive.

In case of INT13 errors, there are (at least) 3 error codes appearing in case
of missing media - 20h, 31h and 80h. Flag the no media and do not print an
error.

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

5 years agoMFC r339658:
Toomas Soome [Thu, 29 Nov 2018 13:44:37 +0000 (13:44 +0000)]
MFC r339658:
loader: biosdisk interface should be able to cope with 4k sectors

The 4kn support in current bios specific biosdisk.c is broken, as the code
is only implementing the support for the 512B sector size.

This work is building the support for custom size sectors, we still do assume
the requested data to be multiple of 512B blocks and we only do address the
biosdisk.c interface here.

For reference, see also:
https://www.illumos.org/issues/8303
https://www.illumos.org/rb/r/547

As the GELI is moved above biosdisk "layer", the GELI should just work

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D11174

5 years agoMFC r340215:
Toomas Soome [Thu, 29 Nov 2018 13:37:44 +0000 (13:37 +0000)]
MFC r340215:
oader: always set media size from partition.

The disk access is validated by using partition table definitions, therefore
we have no need for if statements, just set the disk size.

Of course the partition table itself may be incorrect/inconsistent, but if
so, we are in trouble anyhow.

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

5 years agoMFC: r340240:
Toomas Soome [Thu, 29 Nov 2018 13:01:21 +0000 (13:01 +0000)]
MFC: r340240:
loader: ptable_open() check for ptable_cd9660read result is wrong

The ptable_*read() functions return NULL on read errors (and partition table
closed as an side effect). The ptable_open must check the return value and
act properly.

PR: 232483
Reported by: lev
Reviewed by: lev,cem
Differential Revision: https://reviews.freebsd.org/D17890

5 years agoMFC r339651,339992-339993,340026
Toomas Soome [Thu, 29 Nov 2018 12:12:42 +0000 (12:12 +0000)]
MFC r339651,339992-339993,340026

libsa: re-send ACK for older data packets in tftp
libsa: tftp should not read past file end
libsa: tftp should use calloc
libsa: cstyle cleanup tftp.c

Make loader pxeboot more stable over tftp transport.

5 years agoMFC r340978-340979: ipfw.8: new section to EXAMPLES: SELECTIVE MIRRORING
Eugene Grosbein [Thu, 29 Nov 2018 01:24:20 +0000 (01:24 +0000)]
MFC r340978-340979: ipfw.8: new section to EXAMPLES: SELECTIVE MIRRORING

5 years agoMFC r340442
Sean Eric Fagan [Thu, 29 Nov 2018 01:04:24 +0000 (01:04 +0000)]
MFC r340442

mountd has no way to configure the listen queue depth; rather than add a new
option, we pass -1 down to listen, which causes it to use the
kern.ipc.soacceptqueue sysctl.

Approved by: mav
Sponsored by: iXsystems Inc

5 years agoMFC r340974:
Yuri Pankov [Thu, 29 Nov 2018 00:34:55 +0000 (00:34 +0000)]
MFC r340974:
bectl: sync usage with man page, removing stray multibyte characters
in the process.

PR:             233526
Submitted by:   tigersharke@gmail.com (original version)
Reviewed by:    kevans
Differential revision:  https://reviews.freebsd.org/D18335

5 years agoMFC r340983:
Glen Barber [Thu, 29 Nov 2018 00:28:08 +0000 (00:28 +0000)]
MFC r340983:
 Fix NTP query on GCE due to unresolved hostname.

PR: 232456
Submitted by: Lucas Kanashiro
Sponsored by: The FreeBSD Foundation

5 years agoMFC r339506, r339508, r340064 (by markj), r340546 (by alc):
Konstantin Belousov [Wed, 28 Nov 2018 18:42:42 +0000 (18:42 +0000)]
MFC r339506, r339508, r340064 (by markj), r340546 (by alc):
Tidy up code to merge vm_entry neighbors and simplify related checks.

r339506:
Reduce code duplication in merging vm_entry neighbors.
r339508:
Unindent.
r340064:
Initialize the eflags field of vm_map headers.
r340546:
Tidy up vm_map_simplify_entry() and its recently introduced helper functions.

Discussed with: markj

5 years agoMFC r339795:
Mark Johnston [Wed, 28 Nov 2018 18:02:59 +0000 (18:02 +0000)]
MFC r339795:
Add a very basic regression test for setfacl -R with NFSv4 ACLs.

5 years agoMFC r340730, r340731:
Mark Johnston [Wed, 28 Nov 2018 16:52:41 +0000 (16:52 +0000)]
MFC r340730, r340731:
Add taskqueue_quiesce(9) and use it to implement taskq_wait().

PR: 227784

5 years agoMFC r340733:
Mark Johnston [Wed, 28 Nov 2018 16:51:11 +0000 (16:51 +0000)]
MFC r340733:
Remove KN_HASKQLOCK.

5 years agoMFC r339497 (by cem):
Mark Johnston [Wed, 28 Nov 2018 16:48:40 +0000 (16:48 +0000)]
MFC r339497 (by cem):
ZSTDIO: Correctly initialize zstd context with provided 'level'

5 years agoMFC r340995
Eric van Gyzen [Wed, 28 Nov 2018 15:34:46 +0000 (15:34 +0000)]
MFC r340995

Prevent kernel stack disclosure in signal delivery

On arm64 and riscv platforms, sendsig() failed to zero the signal
frame before copying it out to userspace.  Zero it.

On arm, I believe all the contents of the frame were initialized,
so there was no disclosure.  However, explicitly zero the whole frame
because that fact could inadvertently change in the future,
it's more clear to the reader, and I could be wrong in the first place.

Security: similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
Sponsored by: Dell EMC Isilon

5 years agoMFC r340994
Eric van Gyzen [Wed, 28 Nov 2018 15:31:05 +0000 (15:31 +0000)]
MFC r340994

Prevent kernel stack disclosure in getcontext/swapcontext

Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.

Security: FreeBSD-EN-18:12.mem
Security: CVE-2018-17155
Sponsored by: Dell EMC Isilon

5 years agoMFC r340724:
Oleg Bulyzhin [Wed, 28 Nov 2018 11:58:40 +0000 (11:58 +0000)]
MFC r340724:

Unbreak kernel build with VLAN_ARRAY defined.

5 years agoMFC r340717:
Guangyuan Yang [Wed, 28 Nov 2018 09:10:28 +0000 (09:10 +0000)]
MFC r340717:

Fix incorrect DSCP value range from 0..64 to 0..63.

PR: 232786
Submitted by: Sergey Akhmatov <sergey@akhmatov.ru>
Reviewed by: AllanJude

5 years agoMFC r340409
Eric van Gyzen [Tue, 27 Nov 2018 22:32:34 +0000 (22:32 +0000)]
MFC r340409

Make no assertions about lock state when the scheduler is stopped.

Change the assert paths in rm, rw, and sx locks to match the lock
and unlock paths.  I did this for mutexes in r306346.

Reported by: Travis Lane <tlane@isilon.com>
Sponsored by: Dell EMC Isilon

5 years agoMFC r340345
Eric van Gyzen [Tue, 27 Nov 2018 19:45:24 +0000 (19:45 +0000)]
MFC r340345

Fix daily mailq script for Postfix and daily_show_success="NO"

Exit with a zero status when Postfix reports "Mail queue is empty" so this
section won't appear in the report at all when daily_show_success="NO".

Sponsored by: Dell EMC Isilon

5 years agoMFC r340328
Eric van Gyzen [Tue, 27 Nov 2018 19:44:04 +0000 (19:44 +0000)]
MFC r340328

Update comment about 'universe' disk usage

It's 167 GB now (or 81 GB with ZFS lz4).

Sponsored by: Dell EMC Isilon

5 years agoMFC r340257
Eric van Gyzen [Tue, 27 Nov 2018 19:40:07 +0000 (19:40 +0000)]
MFC r340257

in6_ifattach_linklocal: handle immediate removal of the new LLA

If another thread immediately removes the link-local address
added by in6_update_ifa(), in6ifa_ifpforlinklocal() can return NULL,
so the following assertion (or dereference) is wrong.
Remove the assertion, and handle NULL somewhat better than panicking.
This matches all of the other callers of in6_update_ifa().

PR: 219250
Reviewed by: bz, dab (both an earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D17898

5 years agoMFC r340898:
Mark Johnston [Tue, 27 Nov 2018 17:08:07 +0000 (17:08 +0000)]
MFC r340898:
Ensure that knotes do not get registered when KQ_CLOSING is set.

PR: 228858

5 years agoMFC r340400:
Mark Johnston [Tue, 27 Nov 2018 17:03:15 +0000 (17:03 +0000)]
MFC r340400:
RISC-V: Implement get_cyclecount(9).

5 years agoMFC r340399:
Mark Johnston [Tue, 27 Nov 2018 17:02:15 +0000 (17:02 +0000)]
MFC r340399:
RISC-V: Add macros for reading performance counter CSRs.

5 years agoMFC r340408:
Mark Johnston [Tue, 27 Nov 2018 17:00:47 +0000 (17:00 +0000)]
MFC r340408:
Ensure that libnv can be used when kern.trap_enotcap=1.

5 years agoMFC r340897:
Mark Johnston [Tue, 27 Nov 2018 16:57:59 +0000 (16:57 +0000)]
MFC r340897:
Lock the knlist before releasing the in-flux state in knote_fork().

PR: 228858

5 years agoMFC r340899:
Mark Johnston [Tue, 27 Nov 2018 16:54:23 +0000 (16:54 +0000)]
MFC r340899:
Plug some kernel memory disclosures via kevent(2).

5 years agoRevert r341069, I committed it to the wrong branch.
Ian Lepore [Tue, 27 Nov 2018 16:13:56 +0000 (16:13 +0000)]
Revert r341069, I committed it to the wrong branch.

5 years agoRestore the ability to override the disk unit/partition at the boot: prompt
Ian Lepore [Tue, 27 Nov 2018 16:09:16 +0000 (16:09 +0000)]
Restore the ability to override the disk unit/partition at the boot: prompt
in gptboot.

When arch-independent geli support was added, a new static 'gdsk' struct
was added, but there was still a static 'dsk' struct, and when you typed
in an alternate disk/partition, the string was parsed into that struct,
which was then never used for anything.  Now the string gets parsed into
gdsk.dsk, the struct that's actually used.

X-MFC after: 3 days

5 years agoMFC r340689:
Andrey V. Elsukov [Tue, 27 Nov 2018 14:01:59 +0000 (14:01 +0000)]
MFC r340689:
  Make multiline APPLY_MASK() macro to be function-like.

  Reported by: cem

5 years agoMFC r340675:
Konstantin Belousov [Tue, 27 Nov 2018 13:06:54 +0000 (13:06 +0000)]
MFC r340675:
rtld: when immediate bind mode is requested, process irelocs in PLT
immediately after other PLT relocs.

5 years agoMFC r339523:
Oleksandr Tymoshenko [Mon, 26 Nov 2018 22:00:29 +0000 (22:00 +0000)]
MFC r339523:

Add amdgpio, driver for GPIO controller on AMD-based x86_64 platforms

Submitted by: Rajesh Kumar <rajbsd@gmail.com>
Differential Revision: https://reviews.freebsd.org/D16865

5 years agoMFC r340787 (by rmacklem), r340856, r340859:
Mark Johnston [Mon, 26 Nov 2018 14:01:05 +0000 (14:01 +0000)]
MFC r340787 (by rmacklem), r340856, r340859:
Ensure that directory entry padding bytes are zeroed.

5 years agoMFC r339818: rcorder(8)
Eugene Grosbein [Mon, 26 Nov 2018 13:23:10 +0000 (13:23 +0000)]
MFC r339818: rcorder(8)

  Add support for /etc/rc.resume, so it calls
  "rcorder -k resume" and runs scripts containing "KEYWORD: resume"
  with single "resume" argument.

  Working example is the port sysutils/cpupdate that defines
  extra_commands="resume" to reload CPU microcode cleared
  by suspend/resume sequence.

  This change does nothing for a system having no scripts with
  KEYWORD: resume.

PR: 227866
Differential Revision: https://reviews.freebsd.org/D15247

5 years agoMFC r339817: makewhatis: do not try to operate on read-only mounted
Eugene Grosbein [Mon, 26 Nov 2018 13:01:51 +0000 (13:01 +0000)]
MFC r339817: makewhatis: do not try to operate on read-only mounted
directories just to fail later.

5 years agoMFC r339808: Prevent ip_input() from panicing due to unprotected access
Eugene Grosbein [Mon, 26 Nov 2018 12:39:57 +0000 (12:39 +0000)]
MFC r339808: Prevent ip_input() from panicing due to unprotected access
to INADDR_HASH.

PR: 220078
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agoMFC r339810: ipfw: implement ngtee/netgraph actions for layer-2 frames.
Eugene Grosbein [Mon, 26 Nov 2018 11:28:34 +0000 (11:28 +0000)]
MFC r339810: ipfw: implement ngtee/netgraph actions for layer-2 frames.

  Kernel part of ipfw does not support and ignores rules other than
  "pass", "deny" and dummynet-related for layer-2 (ethernet frames).
  Others are processed as "pass".

  Make it support ngtee/netgraph rules just like they are supported
  for IP packets. For example, this allows us to mirror some frames
  selectively to another interface for delivery to remote network analyzer
  over RSPAN vlan. Assuming ng_ipfw(4) netgraph node has a hook named "900"
  attached to "lower" hook of vlan900's ng_ether(4) node, that would be
  as simple as:

  ipfw add ngtee 900 ip from any to 8.8.8.8 layer2 out xmit igb0

PR: 213452
Tested-by: Fyodor Ustinov <ufm@ufm.su>

5 years agoMFC r339816: mount_msdosfs
Eugene Grosbein [Mon, 26 Nov 2018 11:20:25 +0000 (11:20 +0000)]
MFC r339816: mount_msdosfs

  mount_msdosfs: do not fail mounts requiring locale name conversion table
  that is already present in a kernel statically.

  For example, the command "mount_msdosfs -L ru_RU.KOI8-R" fails with error
  "mount_msdosfs: msdosfs_iconv: File exists" for a kernel having
  options LIBICONV and MSDOSFS_ICONV. After this change, it mounts
  successfully.

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

5 years agoMFC r339806: Prevent stf(4) from panicing due to unprotected access
Eugene Grosbein [Mon, 26 Nov 2018 11:15:59 +0000 (11:15 +0000)]
MFC r339806: Prevent stf(4) from panicing due to unprotected access
to INADDR_HASH.

PR: 220078
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agoMFC r340622:
Hans Petter Selasky [Mon, 26 Nov 2018 11:13:11 +0000 (11:13 +0000)]
MFC r340622:
Minor code factoring. No functional change.

Sponsored by: Mellanox Technologies

5 years agoMFC r340621:
Hans Petter Selasky [Mon, 26 Nov 2018 11:11:02 +0000 (11:11 +0000)]
MFC r340621:
Be more verbose when a sysctl fails to unregister.
Print name of sysctl in question.

Sponsored by: Mellanox Technologies

5 years agoMFC r340480:
Hans Petter Selasky [Mon, 26 Nov 2018 11:08:55 +0000 (11:08 +0000)]
MFC r340480:
Define asm macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFC r340479:
Hans Petter Selasky [Mon, 26 Nov 2018 11:06:39 +0000 (11:06 +0000)]
MFC r340479:
Implement ktime_get_ts64() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFC r339811: route(8): correctly return exit status when "-q" flag
Eugene Grosbein [Mon, 26 Nov 2018 11:05:26 +0000 (11:05 +0000)]
MFC r339811: route(8): correctly return exit status when "-q" flag
is used.

  Previously, route returned 1 in case of error  properly signalling
  failure but "route -q" it returned 0 for same case. Fix it.

PR: 186333

5 years agoMFC r340842:
Konstantin Belousov [Mon, 26 Nov 2018 10:51:39 +0000 (10:51 +0000)]
MFC r340842:
Silence gcc warnings.

5 years agoMFC r339807: Prevent multicast code from panicing due to unprotected access to INADDR...
Eugene Grosbein [Mon, 26 Nov 2018 10:47:00 +0000 (10:47 +0000)]
MFC r339807: Prevent multicast code from panicing due to unprotected access to INADDR_HASH.

PR: 220078
Differential Revision: https://reviews.freebsd.org/D12457
Tested-by: Cassiano Peixoto and others

5 years agoMFC r340783:
Mark Johnston [Sun, 25 Nov 2018 17:46:37 +0000 (17:46 +0000)]
MFC r340783:
Plug some networking sysctl leaks.

5 years agoMFC r340772:
Mark Johnston [Sun, 25 Nov 2018 17:39:41 +0000 (17:39 +0000)]
MFC r340772:
Clear unused bytes in ia32_osendsig().

5 years agoMFC r340771: proto: change device permissions to 0600
Ed Maste [Sun, 25 Nov 2018 00:32:23 +0000 (00:32 +0000)]
MFC r340771: proto: change device permissions to 0600

C Turt reports that the driver is not thread safe and may have
exploitable races.

Note that the proto device is intended for prototyping and development,
and is not for use on production systems.  From the man page:

SECURITY CONSIDERATIONS
    Because programs have direct access to the hardware, the proto
    driver is inherently insecure.  It is not advisable to use this
    driver on a production machine.

The proto device is not included in any of FreeBSD's kernel config files
(although the module is built).

The issues in the proto device still need to be fixed, and the device is
inherently (and intentionally) insecure, but it might as well be limited
to root only.

admbugs: 782
Reported by: C Turt <ecturt@gmail.com>
Sponsored by: The FreeBSD Foundation

5 years agoRevert r340161 in stable/12, setting the default pkg(8) repository back
Glen Barber [Sat, 24 Nov 2018 17:47:53 +0000 (17:47 +0000)]
Revert r340161 in stable/12, setting the default pkg(8) repository back
to 'latest' from 'quarterly' prior to branching releng/12.0.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r340734:
Mark Johnston [Sat, 24 Nov 2018 17:09:35 +0000 (17:09 +0000)]
MFC r340734:
Avoid unsynchronized updates to kn_status.

5 years agoMFC r340485:
Mark Johnston [Sat, 24 Nov 2018 17:08:49 +0000 (17:08 +0000)]
MFC r340485:
Add regression tests for r340313 and r340483.

5 years agoMFC r340484:
Mark Johnston [Sat, 24 Nov 2018 17:08:12 +0000 (17:08 +0000)]
MFC r340484:
Rename the SO_REUSEPORT_LB test file to be consistent with other tests.

5 years agoMFC r340649:
Benedict Reuschling [Sat, 24 Nov 2018 15:10:05 +0000 (15:10 +0000)]
MFC r340649:
Add a fortune describing how to upload a machine's dmesg information to the
NYCBUG database.

We want to encourage our users to upload their dmesgs so that the project can
get a better insight into what kind of hardware is run on. This helps in making
data-driven decisions about i.e., platform and driver support.

Note that dmesgs may contain sensitive information like hardware serial numbers,
hence uploading them without review is discouraged.

Reviewed by: brooks, imp, allanjude
Approved by: allanjude
Differential Revision:    https://reviews.freebsd.org/D17705

5 years agoMFC r340663 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:32:41 +0000 (20:32 +0000)]
MFC r340663 (rmacklem):

Improve sanity checking for the dircount hint argument to
NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
checked for a zero argument, but did not check for a very large value.
This patch clips dircount at the server's maximum data size.

5 years agoMFC r340662 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:31:27 +0000 (20:31 +0000)]
MFC r340662 (rmacklem):

nfsm_advance() would panic() when the offs argument was negative.
The code assumed that this would indicate a corrupted mbuf chain, but
it could simply be caused by bogus RPC message data.
This patch replaces the panic() with a printf() plus error return.

5 years agoMFC r340661 (rmacklem):
Ed Maste [Fri, 23 Nov 2018 20:29:47 +0000 (20:29 +0000)]
MFC r340661 (rmacklem):

r304026 added code that started statistics gathering for an operation
before the operation number (the variable called "op") was sanity checked.
This patch moves the code down to below the range sanity check for "op".

5 years agoMFC r340285: kldxref: use appropriate Elf_Off type for offsets
Ed Maste [Fri, 23 Nov 2018 01:05:42 +0000 (01:05 +0000)]
MFC r340285: kldxref: use appropriate Elf_Off type for offsets

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340699:
Mark Johnston [Fri, 23 Nov 2018 00:56:42 +0000 (00:56 +0000)]
MFC r340699:
Clear pad bytes in the struct exported by kern.ntp_pll.gettime.

5 years agoMFC r340266:
Kristof Provost [Thu, 22 Nov 2018 20:00:56 +0000 (20:00 +0000)]
MFC r340266:

pf tests: Test PR 183198

Create a table which is only used inside an anchor, ensure that the
table exists.

PR: 183198

5 years agoMFC r340264:
Kristof Provost [Thu, 22 Nov 2018 19:59:02 +0000 (19:59 +0000)]
MFC r340264:

pfctl: Populate ifname in ifa_lookup()

pfctl_adjust_skip_ifaces() relies on this name.

5 years agoMFC r340265:
Kristof Provost [Thu, 22 Nov 2018 19:56:50 +0000 (19:56 +0000)]
MFC r340265:

pf: Prevent tables referenced by rules in anchors from getting disabled.

PR: 183198
Obtained from: OpenBSD

5 years agoMFC r340639:
Mark Johnston [Thu, 22 Nov 2018 16:53:30 +0000 (16:53 +0000)]
MFC r340639:
Remove comments made obsolete by the ino64 work.

5 years agoMFC r339653:
Mark Johnston [Thu, 22 Nov 2018 16:52:30 +0000 (16:52 +0000)]
MFC r339653:
Add an IMPLEMENTATION NOTES section to ldd.1.

PR: 231926

5 years agoMFC: r340543, r340654
Marius Strobl [Thu, 22 Nov 2018 13:09:03 +0000 (13:09 +0000)]
MFC: r340543, r340654

Add a quirk handling for AMDI0040 controllers allowing them to do HS400.

Submitted by: Shreyank Amartya (original version)

5 years agoMFC: r340656
Marius Strobl [Thu, 22 Nov 2018 13:03:11 +0000 (13:03 +0000)]
MFC: r340656

Given that the idea of D15374 was to "make memmove a first class citizen",
provide a _MEMMOVE extension of _MEMCPY that deals with overlap based on
the previous bcopy(9) implementation and use the former for bcopy(9) and
memmove(9). This addresses my D15374 review comment, avoiding extra MOVs
in case of memmove(9) and trashing the stack pointer.

5 years agoMFC r340674:
Tijl Coosemans [Thu, 22 Nov 2018 09:47:42 +0000 (09:47 +0000)]
MFC r340674:

Fix another user address dereference in linux_sendmsg syscall.

This was hidden behind the LINUX_CMSG_NXTHDR macro which dereferences its
second argument.  Stop using the macro as well as LINUX_CMSG_FIRSTHDR.  Use
the size field of the kernel copy of the control message header to obtain
the next control message.

PR: 217901

5 years agoMFC r340631:
Tijl Coosemans [Thu, 22 Nov 2018 09:41:45 +0000 (09:41 +0000)]
MFC r340631:

Do proper copyin of control message data in the Linux sendmsg syscall.

Instead of calling m_append with a user address, allocate an mbuf cluster
and copy data into it using copyin.  For the SCM_CREDS case, instead of
zeroing a stack variable and appending that to the mbuf, zero part of the
mbuf cluster directly.  One mbuf cluster is also the size limit used by
the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()).

PR: 217901
Reviewed by: kib

5 years agoMFC r339701: Update lualoader test script a little bit
Kyle Evans [Thu, 22 Nov 2018 03:04:13 +0000 (03:04 +0000)]
MFC r339701: Update lualoader test script a little bit

Use userboot.so from the test directory if possible, fall back to .OBJDIR.
This avoids a problem that we've had since userboot coexistence was added,
where userboot.so alone no longer exists in the .OBJDIR but is instead just
a link installed later.
Update lualo

5 years agoMFC r340507-r340508, r340592-r340594, r340635-r340636: bectl(8) fixes
Kyle Evans [Thu, 22 Nov 2018 01:25:44 +0000 (01:25 +0000)]
MFC r340507-r340508, r340592-r340594, r340635-r340636: bectl(8) fixes

r340507:
libbe(3): rewrite init to support chroot usage

libbe(3) currently uses zfs_be_root and locates which of its children is
currently mounted at "/". This is reasonable, but not correct in the case of
a chroot, for two reasons:

- chroot root may be of a different zpool than zfs_be_root
- chroot root will not show up as mounted at "/"

Fix both of these by rewriting libbe_init to work from the rootfs down.
zfs_path_to_zhandle on / will resolve to the dataset mounted at the new
root, rather than the real root. From there, we can derive the BE root/pool
and grab the bootfs off of the new pool. This does no harm in the average
case, and opens up bectl to operating on different pools for scenarios where
one may be, for instance, updating a pool that generally gets re-rooted into
from a separate UFS root or zfs bootpool.

While here, I've also:
- Eliminated the check for /boot and / to be on the same partition. This
  leaves one open to a setup where /boot (and consequently, kernel/modules)
  are not included in the boot environment. This may very well be an
  intentional setup done by someone that knows what they're doing, we should
  not kill BE usage because of it.

- Eliminated the validation bits of BEs and snapshots that enforced
  'mountpoint' to be "/" -- this broke when trying to operate on an imported
  pool with an altroot, but we need not be this picky.

Reported by: philip
Reviewed by: philip, allanjude (previous version)
Tested by: philip
Differential Revision: https://reviews.freebsd.org/D18012

r340508:
libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)

Go through the ZFS layer instead; given a BE, we can derive the dataset,
zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and
likely gets it more correct than we did for more interesting setups.

r340592:
bectl(3)/libbe(3): Allow BE root to be specified

Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

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

r340593:
libbe(3): Properly account for altroot when creating new BEs

Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

r340594:
bectl(8): Add some regression tests

These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

r340635:
libbe(3): Handle non-ZFS rootfs better

If rootfs isn't ZFS, current version will emit an error claiming so and fail
to initialize libbe. As a consumer, bectl -r (undocumented) can be specified
to operate on a BE independently of whether on a UFS or ZFS root.

Unbreak this for the UFS case by only erroring out the init if we can't
determine a ZFS dataset for rootfs and no BE root was specified. Consumers
of libbe should take care to ensure that rootfs is non-empty if they're
trying to use it, because this could certainly be the case.

Some check is needed before zfs_path_to_zhandle because it will
unconditionally emit to stderr if the path isn't a ZFS filesystem, which is
unhelpful for our purposes.

This should also unbreak the bectl(8) tests on a UFS root, as is the case in
Jenkins' -test runs.

r340636:
bectl(8) tests: attempt to load the ZFS module

Observed in a CI test image, bectl_create test will run and be marked as
skipped because the module is not loaded. The first zpool invocation will
automagically load the module, but bectl_create is still skipped. Subsequent
tests all pass as expected because the module is now loaded and everything
is OK.

5 years agoMFC: r340495
Marius Strobl [Wed, 21 Nov 2018 18:53:13 +0000 (18:53 +0000)]
MFC: r340495

- Restore setting the clock for devices which support the default/legacy
  transfer mode only (lost with r321385). [1]
- Similarly, don't try to set the power class on MMC devices that comply
  to version 4.0 of the system specification but are operated in default/
  legacy transfer or 1-bit bus mode as no power class is specified for
  these cases. Trying to set a power class nevertheless resulted in an -
  albeit harmless - error message.

PR: 231713 [1]

5 years agoMFC r340435:
Stephen Hurd [Wed, 21 Nov 2018 17:14:57 +0000 (17:14 +0000)]
MFC r340435:

Prevent POLA violation with TSO/CSUM offload

Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding
CSUM_IP6?_TCP / CSUM_IP flags are also set.

Rather than requireing drivers to bake-in an understanding that TSO implies
checksum offloads, make it explicit.

This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to
ensure it's zeroed for TSO.

Reported by: Jacob Keller <jacob.e.keller@intel.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17801

5 years agoMFC r340547, r340686:
Mark Johnston [Wed, 21 Nov 2018 17:07:07 +0000 (17:07 +0000)]
MFC r340547, r340686:
Change dumpon(8)'s handling of -g.

5 years agoMFC r339785 (by cem):
Mark Johnston [Wed, 21 Nov 2018 17:04:42 +0000 (17:04 +0000)]
MFC r339785 (by cem):
dumpon.8: Significantly revamp page

5 years agoMFC r340431:
Konstantin Belousov [Wed, 21 Nov 2018 06:36:15 +0000 (06:36 +0000)]
MFC r340431:
Add d_off support for multiple filesystems.

5 years agohwpmc: new counters and bug fix MFCs
Matt Macy [Wed, 21 Nov 2018 01:24:27 +0000 (01:24 +0000)]
hwpmc: new counters and bug fix MFCs
MFC r340108 and r340149

5 years agoMFC: r340713.
Jung-uk Kim [Wed, 21 Nov 2018 00:04:38 +0000 (00:04 +0000)]
MFC: r340713.

Revert r340708.  Some files became symlinks and vice versa.

5 years agoMFC: r340706
Jung-uk Kim [Tue, 20 Nov 2018 22:24:18 +0000 (22:24 +0000)]
MFC: r340706

Remove stale manual pages after OpenSSL 1.1.1a merge.

5 years agoMFC: r340703
Jung-uk Kim [Tue, 20 Nov 2018 21:35:20 +0000 (21:35 +0000)]
MFC: r340703

Merge OpenSSL 1.1.1a.

5 years agosrc.conf.5: regen after r340697
Ed Maste [Tue, 20 Nov 2018 20:40:10 +0000 (20:40 +0000)]
src.conf.5: regen after r340697

5 years agoIntroduce src.conf knob to build userland with retpoline
Ed Maste [Tue, 20 Nov 2018 20:16:03 +0000 (20:16 +0000)]
Introduce src.conf knob to build userland with retpoline

MFC r339511: Introduce src.conf knob to build userland with retpoline

WITH_RETPOLINE enables -mretpoline vulnerability mitigation in userland
for CVE-2017-5715.

MFC r340099: libcompat: disable retpoline when building build tools

These are built with the host toolchain which may not support retpoline.
While here, move the MK_ overrides to a separate line and sort them
alphabetically to support future changes.

MFC r340650: Avoid retpolineplt with static linking

Statically linked binaries linked with -zretpolineplt crash at startup
as lld produces a broken PLT.

MFC r340652: rescue: set NO_SHARED in Makefile

The rescue binary is built statically via the Makefile generated by
crunchgen, but that does not trigger other shared/static logic in
bsd.prog.mk - in particular

PR: 233336
Reported by: Peter Malcom (r339511), Charlie Li (r340652)
Approved by: re (gjb, early MFC)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340439,r340440
Renato Botelho [Tue, 20 Nov 2018 20:08:51 +0000 (20:08 +0000)]
MFC r340439,r340440

Fix /etc/ntp permissions. According to mtree it must be 0700

Approved by: imp
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoMFC r340387: Add evdev support to amd64 and i386
Niclas Zeising [Tue, 20 Nov 2018 19:37:09 +0000 (19:37 +0000)]
MFC r340387: Add evdev support to amd64 and i386

This merge is done sans sys/i386/conf/MINIMAL, since that doesn't exist in
stable/12, only current.

Include evdev support and drivers in the amd64 GENERIC and MINIMAL, and i386
GENERIC kernels.  Evdev is used by X and wayland to handle input devices, and
this change, together with upcomming changes in ports will make us handle input
devices better in graphical UIs.

Reviewed by: wulf, bapt, imp
Approved by: imp

5 years agoMFC r339531,r339579,r340252,r340463,r340464,340472,r340587
Mateusz Guzik [Tue, 20 Nov 2018 17:10:44 +0000 (17:10 +0000)]
MFC r339531,r339579,r340252,r340463,r340464,340472,r340587

amd64: tidy up memset to have rax set earlier for small sizes
amd64: finish the tail in memset with an overlapping store
amd64: align memset buffers to 16 bytes before using rep stos
amd64: convert libc bzero to a C func to avoid future bloat
amd64: sync up libc memset with the kernel version
amd64: handle small memset buffers with overlapping stores
Fix -DNO_CLEAN amd64 build after r340463

5 years agoMFC r339449:
Mateusz Guzik [Tue, 20 Nov 2018 17:01:55 +0000 (17:01 +0000)]
MFC r339449:

    amd64: relax constraints in curthread and curpcb

    This makes the compiler less likely to reload the content from %gs.

    The 'P' modifier drops all synteax prefixes and 'n' constraint treats
    input as a known at compilation time immediate integer.

    Example reloading victim was spinlock_enter.

5 years agoMFC r340678:
Mark Johnston [Tue, 20 Nov 2018 16:35:53 +0000 (16:35 +0000)]
MFC r340678:
Handle kernel superpage mappings in pmap_remove_l2().