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

5 years agoMFC r339558: New sysctl: net.inet.icmp.error_keeptags
Eugene Grosbein [Tue, 20 Nov 2018 10:43:18 +0000 (10:43 +0000)]
MFC r339558: New sysctl: net.inet.icmp.error_keeptags

  Currently, icmp_error() function copies FIB number from original packet
  into generated ICMP response but not mbuf_tags(9) chain.
  This prevents us from easily matching ICMP responses corresponding
  to tagged original packets by means of packet filter such as ipfw(8).
  For example, ICMP "time-exceeded in-transit" packets usually generated
  in response to traceroute probes lose tags attached to original packets.

  This change adds new sysctl net.inet.icmp.error_keeptags
  that defaults to 0 to avoid extra overhead when this feature not needed.

  Set net.inet.icmp.error_keeptags=1 to make icmp_error() copy mbuf_tags
  from original packet to generated ICMP response.

PR: 215874

5 years agoMFC r340205:
Mark Johnston [Tue, 20 Nov 2018 00:56:54 +0000 (00:56 +0000)]
MFC r340205:
Avoid specifying VM_PROT_EXECUTE in mappings from pipe_map and exec_map.

5 years agoMFC r340192:
Mark Johnston [Tue, 20 Nov 2018 00:55:51 +0000 (00:55 +0000)]
MFC r340192:
Use plain atomic_{add,subtract} when that's sufficient.

5 years agoMFC r340392: Add dynamic_kenv assertion to init_static_kenv
Kyle Evans [Mon, 19 Nov 2018 19:04:50 +0000 (19:04 +0000)]
MFC r340392: Add dynamic_kenv assertion to init_static_kenv

Both to formally document the requirement that this not be called after the
dynamic kenv is setup, and to perhaps help static analyzers figure out
what's going on. While calling init_static_kenv this late isn't fatal, there
are some caveats that the caller should be aware of:

- Late calls are effectively a no-op, as far as default FreeBSD is
concerned, as everything will switch to searching the dynamic kenv once it's
available.

- Each of the kern_getenv calls will leak memory, as it's assumed that
these are searching static environment and allocations will not be made.

As such, this usage is not sensible and should be detected.

5 years agoMFC r340390: Fix test-dts{,o} targets
Kyle Evans [Mon, 19 Nov 2018 18:59:06 +0000 (18:59 +0000)]
MFC r340390: Fix test-dts{,o} targets

There were two main problems here:

1.) sys/dts/Makefile.inc is not included from various */overlays directories
    by default, only ../Makefile.inc
2.) When shelling out for DTS/DTSO, cwd != .CURDIR, so enumeration always
    failed

These changes allow make test-dts and make test-dtso to function in their
respective directories.

5 years agoMFC r340489-r340490
Brooks Davis [Mon, 19 Nov 2018 18:26:11 +0000 (18:26 +0000)]
MFC r340489-r340490

r340489:
Fix freebsd32 support for PCIOCGETCONF.

This fixes regresssions in pciconf -l and some ports as reported on
freebsd-current:

https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072144.html

Reported by: jbeich
Reviewed by: kib (also proposed an idential patch)
Tested by: jbeich
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

r340490:
Fix stray tab.

Reported by: jbeich
MFC with: r340489
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18011

5 years agoRemove debugging options from amd64 MINIMAL [1] and riscv GENERIC
Glen Barber [Mon, 19 Nov 2018 15:29:40 +0000 (15:29 +0000)]
Remove debugging options from amd64 MINIMAL [1] and riscv GENERIC
kernel configuration files.  This should have been turned off when
stable/12 branched.

This is a direct commit to stable/12.

Submitted by:   Harry Schmalzbauer [1]
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340434, r340445
Stephen Hurd [Mon, 19 Nov 2018 15:18:30 +0000 (15:18 +0000)]
MFC r340434, r340445

r340434:
Fix leaks caused by ifc_nhwtxqs never being initialized

r333502 removed initialization of ifc_nhwtxqs, and it's not clear
there's a need to copy it into the struct iflib_ctx at all. Use
ctx->ifc_sctx->isc_ntxqs instead.

Further, iflib_stop() did not clear the last ring in the case where
isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use
ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl.

Reported by: pkelsey
Reviewed by: pkelsey
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17979

r340445:
Clear RX completion queue state veriables in iflib_stop()

iflib_stop() was not resetting the rxq completion queue state variables.
This meant that for any driver that has receive completion queues, after a
reinit, iflib would start asking what's available on the rx side starting at
whatever the completion queue index was prior to the stop, instead of at 0.

Submitted by: pkelsey
Reported by: pkelsey
Sponsored by: Limelight Networks

5 years agoMFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request
Andriy Gapon [Mon, 19 Nov 2018 10:01:03 +0000 (10:01 +0000)]
MFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request

Sponsored by: Panzura

5 years agoMFC r340254:
Hans Petter Selasky [Mon, 19 Nov 2018 09:40:02 +0000 (09:40 +0000)]
MFC r340254:
Put a size limit on the opensm.log and use bzip2(1).

Discussed with: markj@
Sponsored by: Mellanox Technologies

5 years agoMFC r340475
Vincenzo Maffione [Mon, 19 Nov 2018 08:56:34 +0000 (08:56 +0000)]
MFC r340475

ifnet(9): Add description of IFCAP_NETMAP

Describe IFCAP_NETMAP adding a cross reference to netmap(4).

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

5 years agoMFC r340325
Vincenzo Maffione [Mon, 19 Nov 2018 08:55:26 +0000 (08:55 +0000)]
MFC r340325

netmap: pkt-gen: several updates from upstream

Various improvements to the netmap pkt-gen program:

 - indentation fixes
 - support for IPV6
 - fixes to checksum computation
 - support for NS_MOREFRAG
 - rate limiting in ping mode

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

5 years agoMFC r340279
Vincenzo Maffione [Mon, 19 Nov 2018 08:53:52 +0000 (08:53 +0000)]
MFC r340279

netmap: add load balancer program

Add the lb program, which is able to load-balance input traffic
received from a netmap port over M groups, with N netmap pipes in
each group. Each received packet is forwarded to one of the pipes
chosen from each group (using an L3/L4 connection-consistent hash function).
This also adds a man page for lb and some cross-references in related
man pages.

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

5 years agoMFC r339472: rc.initdiskless: fix commentary grammar after r339465
Eugene Grosbein [Mon, 19 Nov 2018 06:49:30 +0000 (06:49 +0000)]
MFC r339472: rc.initdiskless: fix commentary grammar after r339465

5 years agoMFC r339465: rc.initdiskless: add support for auxiliary NVRAM.
Eugene Grosbein [Mon, 19 Nov 2018 06:33:38 +0000 (06:33 +0000)]
MFC r339465: rc.initdiskless: add support for auxiliary NVRAM.

  Currently, rc.inidiskless assumes that local system configuration
  changes are kept in some mountable file system. For example,
  nanobsd uses dedicated partition mounted as /cfg for this.

  However, small embedded devices like MIPS routers may have no enough flash
  space to keep full-blown file system but have only one or couple
  small flash blocks to keep persistent local configuration overrides.

  This change extends rc.initdiskless and introduces ability to run auxiliary
  command /conf/T/M/extract that is supposed to extract configuration overrides
  from such local storage.

  For example, the command /conf/default/etc/extract may contain something like:

  cd "$1" && bsdcpio --quiet -idu < /dev/map/cfg

  bsdcpio command extracts compressed archive from the storage to /etc
  assuming the storage is exposed by the kernel as /dev/map/cfg to userland.

PR: 204215

5 years agoMFC r339898:
Konstantin Belousov [Mon, 19 Nov 2018 05:56:46 +0000 (05:56 +0000)]
MFC r339898:
Convert amd64_get/set_fs/gsbase to ifunc.

5 years agoMFC r340383:
Konstantin Belousov [Mon, 19 Nov 2018 05:47:31 +0000 (05:47 +0000)]
MFC r340383:
Create namespace for the symbols added during 13-CURRENT cycle.

5 years agoMFC r339895:
Konstantin Belousov [Mon, 19 Nov 2018 05:45:47 +0000 (05:45 +0000)]
MFC r339895:
amd64: Use ifuncs to select suitable implementation of set_pcb_flags().

5 years agoMFC r340487:
Konstantin Belousov [Mon, 19 Nov 2018 05:43:41 +0000 (05:43 +0000)]
MFC r340487:
Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.

5 years agoMFC r340384:
Konstantin Belousov [Mon, 19 Nov 2018 05:42:00 +0000 (05:42 +0000)]
MFC r340384:
Apply fix to un-cripple max cpu id on BSP earlier.

5 years agoMFC r340364:
Konstantin Belousov [Mon, 19 Nov 2018 05:40:37 +0000 (05:40 +0000)]
MFC r340364:
Allow set ether/vlan PCP operation from the VNET jails.

5 years agoMFC: r339999
Rick Macklem [Mon, 19 Nov 2018 00:49:08 +0000 (00:49 +0000)]
MFC: r339999
Fix NFS client vnode locking to avoid a crash during forced dismount.

A crash was reported where the crash occurred in nfs_advlock() when the
NFS_ISV4(vp) macro was being executed. This was caused by the vnode
being VI_DOOMED due to a forced dismount in progress.
This patch fixes the problem by locking the vnode before executing the
NFS_ISV4() macro.

PR: 232673

5 years agoMFC r340171: capability.h: add comment about planned removal timeline
Ed Maste [Sun, 18 Nov 2018 14:58:01 +0000 (14:58 +0000)]
MFC r340171: capability.h: add comment about planned removal timeline

PR: 228878

5 years agoMFC r340299: Octeon SDK: avoid use of uninitialized variable
Ed Maste [Sun, 18 Nov 2018 14:56:08 +0000 (14:56 +0000)]
MFC r340299: Octeon SDK: avoid use of uninitialized variable

Reported by: Clang

5 years agoMFC r340288: nvi: remove superfluous space before ^\
Ed Maste [Sun, 18 Nov 2018 14:54:45 +0000 (14:54 +0000)]
MFC r340288: nvi: remove superfluous space before ^\

This fixes alignment in vi's 'viusage' command and has been fixed
upstream and in OpenBSD.

Submitted by: Raf Czlonka (github:rjc)

5 years agoMFC r340329: build(7): clarify buildenv target can be used for non-cross builds
Ed Maste [Sun, 18 Nov 2018 14:52:16 +0000 (14:52 +0000)]
MFC r340329: build(7): clarify buildenv target can be used for non-cross builds

make buildenv can be used for building for the same architecture as
the host (perhaps this is a degenerate case of cross-building).
TARGET and TARGET_ARCH do not need to be set in this case.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r340072:
Kristof Provost [Sun, 18 Nov 2018 13:03:49 +0000 (13:03 +0000)]
MFC r340072:

pfsync: Add missing unlock

If we fail to set up the multicast entry for pfsync and return an error
we must release the pfsync lock first.

Sponsored by: Orange Business Services

5 years agoMFC r340070:
Kristof Provost [Sun, 18 Nov 2018 12:59:09 +0000 (12:59 +0000)]
MFC r340070:

pfsync: Allow module to be unloaded

Sponsored by: Orange Business Services

5 years agoMFC r340069:
Kristof Provost [Sun, 18 Nov 2018 12:31:40 +0000 (12:31 +0000)]
MFC r340069:

pf tests: Basic pfsync test

Set up two jails, configure pfsync between them and create state in one
of them, verify that this state is copied to the other jail.

Sponsored by: Orange Business Services

5 years agoMFC r340068:
Kristof Provost [Sun, 18 Nov 2018 12:30:16 +0000 (12:30 +0000)]
MFC r340068:

pfsync: Handle syncdev going away

If the syncdev is removed we no longer need to clean up the multicast
entry we've got set up for that device.

Pass the ifnet detach event through pf to pfsync, and remove our
multicast handle, and mark us as no longer having a syncdev.

Note that this callback is always installed, even if the pfsync
interface is disabled (and thus it's not a per-vnet callback pointer).

Sponsored by: Orange Business Services

5 years agoMFC r340067:
Kristof Provost [Sun, 18 Nov 2018 12:09:26 +0000 (12:09 +0000)]
MFC r340067:

pfsync: Ensure uninit is done before pf

pfsync touches pf memory (for pf_state and the pfsync callback
pointers), not the other way around. We need to ensure that pfsync is
torn down before pf.

Sponsored by: Orange Business Services

5 years agoMFC r340066:
Kristof Provost [Sun, 18 Nov 2018 12:04:24 +0000 (12:04 +0000)]
MFC r340066:

Notify that the ifnet will go away, even on vnet shutdown

pf subscribes to ifnet_departure_event events, so it can clean up the
ifg_pf_kif and if_pf_kif pointers in the ifnet.
During vnet shutdown interfaces could go away without sending the event,
so pf ends up cleaning these up as part of its shutdown sequence, which
happens after the ifnet has already been freed.

Send the ifnet_departure_event during vnet shutdown, allowing pf to
clean up correctly.

Sponsored by: Orange Business Services

5 years agoMFC r340065:
Kristof Provost [Sun, 18 Nov 2018 11:55:56 +0000 (11:55 +0000)]
MFC r340065:

pfsync: Make pfsync callbacks per-vnet

The callbacks are installed and removed depending on the state of the
pfsync device, which is per-vnet. The callbacks must also be per-vnet.

Sponsored by: Orange Business Services

5 years agoMFC r339676:
Kristof Provost [Sun, 18 Nov 2018 10:57:31 +0000 (10:57 +0000)]
MFC r339676:

pf: Fix copy/paste error in IPv6 address rewriting

We checked the destination address, but replaced the source address. This was
fixed in OpenBSD as part of their NAT rework, which we don't want to import
right now.

CID: 1009561

5 years agoMFC r339578:
Kristof Provost [Sun, 18 Nov 2018 10:54:47 +0000 (10:54 +0000)]
MFC r339578:

pfctl: Fix line numbers when \ is used inside ""

PR: 201520
Obtained from: OpenBSD

5 years agoMFC r339470:
Kristof Provost [Sun, 18 Nov 2018 10:47:36 +0000 (10:47 +0000)]
MFC r339470:

pf synproxy will do the 3WHS on behalf of the target machine, and once
the 3WHS is completed, establish the backend connection. The trigger
for "3WHS completed" is the reception of the first ACK. However, we
should not proceed if that ACK also has RST or FIN set.

PR: 197484
Obtained from: OpenBSD

5 years agoMFC r340136:
Konstantin Belousov [Sun, 18 Nov 2018 09:57:12 +0000 (09:57 +0000)]
MFC r340136:
Move the fixed base for PIE loading on arm.

5 years agoMFC r339893:
Konstantin Belousov [Sun, 18 Nov 2018 09:55:57 +0000 (09:55 +0000)]
MFC r339893:
Style.

5 years agoMFC r339897:
Konstantin Belousov [Sun, 18 Nov 2018 09:54:03 +0000 (09:54 +0000)]
MFC r339897:
Remove rtld use of libc amd64_set_fsbase().

5 years agoMFC r339507:
Konstantin Belousov [Sun, 18 Nov 2018 09:49:24 +0000 (09:49 +0000)]
MFC r339507:
amd64: flush L1 data cache on syscall return with an error.

5 years agoMFC r339466:
Kristof Provost [Sun, 18 Nov 2018 09:48:51 +0000 (09:48 +0000)]
MFC r339466:

pfctl tests: Basic test case for PR 231323

PR: 231323

5 years agoMFC r339464:
Kristof Provost [Sun, 18 Nov 2018 09:47:30 +0000 (09:47 +0000)]
MFC r339464:

pfctl: Dup strings

When we set the ifname we have to copy the string, rather than just keep
the pointer.

PR: 231323