]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoDo not allow to load ET_DYN object with DF_1_PIE flag set.
Konstantin Belousov [Tue, 2 Jun 2020 16:20:58 +0000 (16:20 +0000)]
Do not allow to load ET_DYN object with DF_1_PIE flag set.

Linkers are supposed to mark PIE binaries with DF_1_PIE, such binary
cannot be correctly and usefully loaded neither by dlopen(3) nor as a
dependency of other object.  For instance, we cannot do anything
useful with COPY relocations, among other things.

Glibc already added similar restriction.

Requested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25086

4 years agoImplement __is_constexpr() function macro in the LinuxKPI.
Hans Petter Selasky [Tue, 2 Jun 2020 12:23:04 +0000 (12:23 +0000)]
Implement __is_constexpr() function macro in the LinuxKPI.
Bump the FreeBSD version.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement struct_size() function macro in the LinuxKPI.
Hans Petter Selasky [Tue, 2 Jun 2020 10:19:45 +0000 (10:19 +0000)]
Implement struct_size() function macro in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement BUILD_BUG_ON_ZERO() in the LinuxKPI.
Hans Petter Selasky [Tue, 2 Jun 2020 09:45:43 +0000 (09:45 +0000)]
Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
Tested using gcc and clang.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoPer-rule hit counts (-h) can be used with either -i (input) or -o (output)
Cy Schubert [Tue, 2 Jun 2020 03:44:22 +0000 (03:44 +0000)]
Per-rule hit counts (-h) can be used with either -i (input) or -o (output)
filter rule lists.

MFC after: 3 days

4 years agopkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL
Kyle Evans [Tue, 2 Jun 2020 02:38:54 +0000 (02:38 +0000)]
pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL

When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that
conflict, and hilarity ensues. There's currently three different places that
we might install mailer.conf:

- ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no)
- ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL !=
no)
- ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on
not-installed)

The mailwrapper installation will effectively never happen because the ^/etc
one will first.

This patch simplifies the whole situation; remove the ^/etc/Makefile version
and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The
scenarios covered in mailwrapper are:

- sendmail(8) is installed, dma(8) may or may not be installed
- neither sendmail(8) nor dma(8) is installed

In the first scenario, sendmail(8) is dominant so we can go ahead and
install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is
not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the
installation. In the second listed scenario, we still want to install an
example mailer.conf so just install the base sendmail(8) version.

Reviewed by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24924

4 years agovt(4): reset scrollback and cursor position after clearing history buffer
Jason A. Harmening [Tue, 2 Jun 2020 01:21:48 +0000 (01:21 +0000)]
vt(4): reset scrollback and cursor position after clearing history buffer

r361601 implemented basic support for cleaing the console history buffer.
But after clearing the history buffer, it's not especially useful to be
able to scroll back through that buffer, or for the cursor position to
remain at (very likely) the bottom of the screen.

PR: 224436
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D25079

4 years ago[psm] Workaround active PS/2 multiplexor hang
Vladimir Kondratyev [Tue, 2 Jun 2020 01:04:49 +0000 (01:04 +0000)]
[psm] Workaround active PS/2 multiplexor hang

which happens on some laptops after returning to legacy multiplexing mode
at initialization stage.

PR: 242542
Reported by: Felix Palmen <felix@palmen-it.de>
MFC after: 1 week

4 years ago[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled
Vladimir Kondratyev [Tue, 2 Jun 2020 00:53:39 +0000 (00:53 +0000)]
[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled

PR: 246117
Reported by: Alexander Sieg <ports@xanderio.de>
MFC after: 1 week

4 years agobsd.prog.mk: split MK_PIE test for clarity
Ed Maste [Tue, 2 Jun 2020 00:46:15 +0000 (00:46 +0000)]
bsd.prog.mk: split MK_PIE test for clarity

And a comment explaining why PIE flags are disabled for static binaries.

4 years agomodules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC
Kyle Evans [Tue, 2 Jun 2020 00:32:36 +0000 (00:32 +0000)]
modules: don't build ipsec/tcpmd5 if the kernel is configured for IPSEC

IPSEC_SUPPORT can currently only cope with either IPSEC || IPSEC_SUPPORT,
not both. Refrain from building if IPSEC is set, as the resulting module
won't be able to load anyways if it's built into the kernel.

KERN_OPTS is safe here; for tied modules, it will reflect the kernel
configuration. For untied modules, it will defer to whatever is set in
^/sys/conf/config.mk, which doesn't set IPSEC for modules. The latter
situation has some risk to it for uncommon scenarios, but such is the life
of untied kernel modules.

Reported by: jenkins (a lot), O. Hartmann (once)
Generally discussed with: imp, jhb

4 years agoFix build issue introduced by r361699.
Rick Macklem [Tue, 2 Jun 2020 00:03:26 +0000 (00:03 +0000)]
Fix build issue introduced by r361699.

Reported by: cy (and others)

4 years agostand/uboot: fix setting of gateip.s_addr
Simon J. Gerraty [Mon, 1 Jun 2020 23:44:03 +0000 (23:44 +0000)]
stand/uboot: fix setting of gateip.s_addr

Missplaced paren.

Reviewed by: imp
MFC after: 1 week

4 years agolualoader: improve drawer error handling
Kyle Evans [Mon, 1 Jun 2020 23:26:37 +0000 (23:26 +0000)]
lualoader: improve drawer error handling

At least one user has landed in a scenario where logo files appear to be
misnamed, and we failed to find them. Our fallback for missing logodefs is
orb/orbbw, based on the color status. In a scenario where we can't locate
the logos, though, this is not ideal. Add in one more layer of fallback
to properly just don't draw any logo if the fan has been jam packed with
foreign material.

PR: 246046
MFC after: 3 days

4 years agoAdd rib subscription API.
Alexander V. Chernikov [Mon, 1 Jun 2020 21:52:24 +0000 (21:52 +0000)]
Add rib subscription API.

Currently there is no easy way of subscribing for the routing table changes.
The only existing way is to set ifa_rtrequest callback in the each protocol
 ifaddr, which is not convenient or extandable.

This change provides generic notification subscription mechanism, that will
 replace current ifa_rtrequest one and allow other applications such as
 accelerated routing lookup modules subscribe for the changes.

In particular, this change provides 2 hooks: 1) synchronous one
 (RIB_NOTIFY_IMMEDIATE), called under RIB_WLOCK, which ensures exact
 ordering of the changes and 2) async one, (RIB_NOTIFY_DELAYED)
 that is called after the change w/o holding locks. The latter one does not
 provide any notification ordering guarantee.

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

4 years agoFinish r361706: add sys/net/route/route_ctl.h, missed in previous commit.
Alexander V. Chernikov [Mon, 1 Jun 2020 21:51:20 +0000 (21:51 +0000)]
Finish r361706: add sys/net/route/route_ctl.h, missed in previous commit.

4 years ago* Add rib_<add|del|change>_route() functions to manipulate the routing table.
Alexander V. Chernikov [Mon, 1 Jun 2020 20:49:42 +0000 (20:49 +0000)]
* Add rib_<add|del|change>_route() functions to manipulate the routing table.

The main driver for the change is the need to improve notification mechanism.
Currently callers guess the operation data based on the rtentry structure
 returned in case of successful operation result. There are two problems with
 this appoach. First is that it doesn't provide enough information for the
 upcoming multipath changes, where rtentry refers to a new nexthop group,
 and there is no way of guessing which paths were added during the change.
 Second is that some rtentry fields can change during notification and
 protecting from it by requiring customers to unlock rtentry is not desired.

Additionally, as the consumers such as rtsock do know which operation they
 request in advance, making explicit add/change/del versions of the functions
 makes sense, especially given the functions don't share a lot of code.

With that in mind, introduce rib_cmd_info notification structure and
 rib_<add|del|change>_route() functions, with mandatory rib_cmd_info pointer.
 It will be used in upcoming generalized notifications.

* Move definitions of the new functions and some other functions/structures
 used for the routing table manipulation to a separate header file,
 net/route/route_ctl.h. net/route.h is a frequently used file included in
 ~140 places in kernel, and 90% of the users don't need these definitions.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D25067

4 years agoRevert r361704, it accidentally committed merged D25067 and D25070.
Alexander V. Chernikov [Mon, 1 Jun 2020 20:40:40 +0000 (20:40 +0000)]
Revert r361704, it accidentally committed merged D25067 and D25070.

4 years ago* Add rib_<add|del|change>_route() functions to manipulate the routing table.
Alexander V. Chernikov [Mon, 1 Jun 2020 20:32:02 +0000 (20:32 +0000)]
* Add rib_<add|del|change>_route() functions to manipulate the routing table.

The main driver for the change is the need to improve notification mechanism.
Currently callers guess the operation data based on the rtentry structure
 returned in case of successful operation result. There are two problems with
 this appoach. First is that it doesn't provide enough information for the
 upcoming multipath changes, where rtentry refers to a new nexthop group,
 and there is no way of guessing which paths were added during the change.
 Second is that some rtentry fields can change during notification and
 protecting from it by requiring customers to unlock rtentry is not desired.

Additionally, as the consumers such as rtsock do know which operation they
 request in advance, making explicit add/change/del versions of the functions
 makes sense, especially given the functions don't share a lot of code.

With that in mind, introduce rib_cmd_info notification structure and
 rib_<add|del|change>_route() functions, with mandatory rib_cmd_info pointer.
 It will be used in upcoming generalized notifications.

* Move definitions of the new functions and some other functions/structures
 used for the routing table manipulation to a separate header file,
 net/route/route_ctl.h. net/route.h is a frequently used file included in
 ~140 places in kernel, and 90% of the users don't need these definitions.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D25067

4 years ago[PowerPC] Fix build-id note on powerpc64 kernel
Brandon Bergren [Mon, 1 Jun 2020 19:40:59 +0000 (19:40 +0000)]
[PowerPC] Fix build-id note on powerpc64 kernel

Due to the ordering of the powerpc64 linker script, we were discarding
all notes before emitting .note.gnu.build-id. This had the effect of
generating an empty build id section and breaking the kern.build_id
sysctl added in r348611.

powerpc and powerpcspe are uneffected.

PR: 246430
MFC after: 3 days
Sponsored by: Tag1 Consulting, Inc.

4 years agoCatch up with r361700.
Jung-uk Kim [Mon, 1 Jun 2020 19:34:21 +0000 (19:34 +0000)]
Catch up with r361700.

OpenSSL 32-bit compat engines are moved to /usr/lib32/engines.

4 years agobridge tests: Avoid building a switching loop
Kristof Provost [Mon, 1 Jun 2020 19:26:16 +0000 (19:26 +0000)]
bridge tests: Avoid building a switching loop

Enable STP before bringing the bridges up. This avoids a switching loop,
which has a tendency to drown out progress in userspace processes,
especially on single-core systems.

Only check that we have indeed shut down one of the looped interfaces

PR: 246448
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D25084

4 years agoInstall 32-bit libcrypto engines in /usr/lib32/engines instead of
Tijl Coosemans [Mon, 1 Jun 2020 18:58:09 +0000 (18:58 +0000)]
Install 32-bit libcrypto engines in /usr/lib32/engines instead of
/usr/lib32 and let 32-bit libcrypto search that location instead of
/usr/lib/engines.

Reviewed by: jkim

4 years agoAssign default security flavor when converting old export args
Ryan Moeller [Mon, 1 Jun 2020 18:43:51 +0000 (18:43 +0000)]
Assign default security flavor when converting old export args

vfs_export requires security flavors be explicitly listed when
exporting as of r360900.

Use the default AUTH_SYS flavor when converting old export args to
ensure compatibility with the legacy mount syscall.

Reported by: rmacklem
Reviewed by: rmacklem
Approved by: mav (mentor)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25045

4 years agonetmap: if_vtnet: avoid netmap ring wraparound
Vincenzo Maffione [Mon, 1 Jun 2020 16:14:29 +0000 (16:14 +0000)]
netmap: if_vtnet: avoid netmap ring wraparound

netmap assumes the one "slot" is left unused to distinguish
the empty ring and full ring conditions. This assumption was
violated by vtnet_netmap_rxq_populate().

MFC after: 1 week

4 years agonetmap: if_vtnet: replace vtnet_free_used()
Vincenzo Maffione [Mon, 1 Jun 2020 16:12:09 +0000 (16:12 +0000)]
netmap: if_vtnet: replace vtnet_free_used()

The functionality contained in this function is duplicated,
as it is already available in vtnet_txq_free_mbufs()
and vtnet_rxq_free_mbufs().

MFC after: 1 week

4 years agonetmap: vtnet: fix RX virtqueue initialization bug
Vincenzo Maffione [Mon, 1 Jun 2020 16:10:44 +0000 (16:10 +0000)]
netmap: vtnet: fix RX virtqueue initialization bug

The vtnet_netmap_rxq_populate() function erroneously assumed
that kring->nr_hwcur = 0, i.e. the kring was in the initial
state. However, this is not always the case: for example,
when a vtnet reinit is triggered by some changes in the
interface flags or capenable.
This patch changes the behaviour of vtnet_netmap_kring_refill()
so that it always starts publishing the netmap buffers starting
from the current value of kring->nr_hwcur.

MFC after: 1 week

4 years agoRemove ->f_label from struct file
Mateusz Guzik [Mon, 1 Jun 2020 15:58:22 +0000 (15:58 +0000)]
Remove ->f_label from struct file

The field was added in r141137 in 2005 and is unused.

It avoidably grows a struct which is NOFREE and easily gets hundreds of
thousands of instances.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25036

4 years agocap_fileargs: Fix a descriptor leak in the service process.
Mark Johnston [Mon, 1 Jun 2020 15:32:13 +0000 (15:32 +0000)]
cap_fileargs: Fix a descriptor leak in the service process.

The service handler for fileargs_open() tries to pre-open multiple files
and pass descriptors for each back to the sandboxed process in a single
message.  This is to amortize the cost of round-trips between the two
processes.

The service process adds a "cache" nvlist to the reply to "open",
containing file descriptors for pre-opened files.  However, when adding
that nvlist to the reply, it was making a copy, effectively leaking the
cached descriptors.

While here, fix spelling in a local variable name.

PR: 241226
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25095

4 years agoUpdate Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
Dimitry Andric [Mon, 1 Jun 2020 10:27:05 +0000 (10:27 +0000)]
Update Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE: there is no need to dump and reload repositories, and the working
copy format is still the same as Subversion 1.8 through 1.13.

Relnotes: yes
MFC after: 2 weeks
X-MFC-With: r361677

4 years agoUpdate apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
Dimitry Andric [Mon, 1 Jun 2020 10:14:45 +0000 (10:14 +0000)]
Update apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
changes.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoFollow-up r361678 (update apr to 1.7.0) by also regenerating the apr
Dimitry Andric [Mon, 1 Jun 2020 10:08:18 +0000 (10:08 +0000)]
Follow-up r361678 (update apr to 1.7.0) by also regenerating the apr
internal headers through the upstream configure script, with some minor
custom tweaks.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoDocument long version of -b option
Baptiste Daroussin [Mon, 1 Jun 2020 09:15:15 +0000 (09:15 +0000)]
Document long version of -b option

PR: 234195
Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
Reported by: Andras Farkas <deepbluemistake@gmail.com>
MFC after: 3 days

4 years agodiff: restore compatibility with GNU diff regarding -N option
Baptiste Daroussin [Mon, 1 Jun 2020 09:09:36 +0000 (09:09 +0000)]
diff: restore compatibility with GNU diff regarding -N option

When -N is used the missing files are treated as empty.

PR: 233402
Submitted by: Fehmi Noyan Isi <fnoyanisi@yahoo.com>
Reported by: Roman Neuhauser <roman@sigpipe.cz>
MFC after: 3 days
Differential Revision: D25081

4 years agoRestore compatibility with GNU diff regarding --label
Baptiste Daroussin [Mon, 1 Jun 2020 09:01:13 +0000 (09:01 +0000)]
Restore compatibility with GNU diff regarding --label

Various options to "diff(1)" show filenames, and traditionally make use of the
"--label" parameter, if set.

Restore this behaviour in BSD diff.

While here add a regression test

PR: 244533
Submitted by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 3 days

4 years ago[ath] Don't re-program the beacon timers if we miss a beacon in software-beacon STA...
Adrian Chadd [Mon, 1 Jun 2020 06:10:25 +0000 (06:10 +0000)]
[ath] Don't re-program the beacon timers if we miss a beacon in software-beacon STA mode.

This is something I added a few years ago to handle resyncing the beacon if
we miss a beacon or need to sync after association/reassociation/powersave.

However, if we're doing STA+AP mode (eg DWDS) then we don't want
to reprogram the beacons here; this may upset normal AP operation.
I missed checking for the sc->sc_swbmiss flag so I was reinitialising
the beacon timers after every beacon miss / TSFOOR option, and
that isn't likely good.

This plus ensuring that STA's are created with "-beacon" to disable
BMISS/TSFOOR processing will hopefully quieten some of the issues
I've seen with missed beacons / TSFOOR (out of range) interrupts
coming in when operating in STA mode.

Tested:

* AR9380/AR9580, STA+AP modes

4 years agoClarify which hints file is the source of an error message.
Peter Wemm [Mon, 1 Jun 2020 03:37:58 +0000 (03:37 +0000)]
Clarify which hints file is the source of an error message.

PR: 246688
Submitted by: Ashish Gupta <lrx337@gmail.com>
MFC after: 1 week

4 years agoapr: build some needed emulated 64-bit atomic bits after r361678
Kyle Evans [Mon, 1 Jun 2020 02:54:10 +0000 (02:54 +0000)]
apr: build some needed emulated 64-bit atomic bits after r361678

This should fix the build on armv{6,7}, mips, and mips64, which all need
emulated 64-bit atomics for apr.

X-MFC-With: r361678

4 years agocertctl: fix test syntax
Kyle Evans [Mon, 1 Jun 2020 01:25:19 +0000 (01:25 +0000)]
certctl: fix test syntax

test doesn't understand &&, but it does understand -a.

MFC after: 1 week

4 years agoOops, I didn't notice the "cd" is needed for each install line.
Rick Macklem [Sun, 31 May 2020 22:46:32 +0000 (22:46 +0000)]
Oops, I didn't notice the "cd" is needed for each install line.

4 years agoChange more Makefiles under usr.bin/svn to make them easier to
Dimitry Andric [Sun, 31 May 2020 22:40:39 +0000 (22:40 +0000)]
Change more Makefiles under usr.bin/svn to make them easier to
incrementally update. No functional change intended.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agortld: Add -b option to allow to specify image name different from arg0.
Konstantin Belousov [Sun, 31 May 2020 22:37:33 +0000 (22:37 +0000)]
rtld: Add -b option to allow to specify image name different from arg0.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoUpdate the Makefile to copy rpcsec_tls.h to /usr/include/rpc.
Rick Macklem [Sun, 31 May 2020 22:15:34 +0000 (22:15 +0000)]
Update the Makefile to copy rpcsec_tls.h to /usr/include/rpc.

4 years agoUpdate apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.
Dimitry Andric [Sun, 31 May 2020 22:12:56 +0000 (22:12 +0000)]
Update apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.

MFC after: 2 weeks
X-MFC-With: r361677

4 years agoChange Makefiles under usr.bin/svn to make them easier to incrementally
Dimitry Andric [Sun, 31 May 2020 22:04:51 +0000 (22:04 +0000)]
Change Makefiles under usr.bin/svn to make them easier to incrementally
update. No functional change intended.

MFC after: 2 weeks

4 years agortld: Fix indent in print_usage().
Konstantin Belousov [Sun, 31 May 2020 21:56:07 +0000 (21:56 +0000)]
rtld: Fix indent in print_usage().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agortld: Add -v switch to print some useful information about the rtld binary.
Konstantin Belousov [Sun, 31 May 2020 21:53:15 +0000 (21:53 +0000)]
rtld: Add -v switch to print some useful information about the rtld binary.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoCorrect the release date for 2.11BSD
Warner Losh [Sun, 31 May 2020 21:38:33 +0000 (21:38 +0000)]
Correct the release date for 2.11BSD

2.11BSD was announced on March 14, 1991 in comp.bugs.2bsd by
Steven M. Schultz. The document has a 'revised January 1991'
date at the top.

Patch/1 in the official repo is dated March 31, 1991, and an identical copy of
it was posted to comp.bugs.2bsd on May 5, 1991. Patch 2 in 22 parts was likewise
posted May 18, 1991. This makes the Feb 1992 date too late. It's possible it's a
typo for Feb 1991 since that lines up with the announcement being 2 weeks
later. Without an extant copy of the 2.11 tape, however, it's hard to say for
sure. Go with the date we have the most independent, direct evidence for, which
is the announcement date.

4 years agortld: Add -p switch to direct exec mode summary line.
Konstantin Belousov [Sun, 31 May 2020 21:34:21 +0000 (21:34 +0000)]
rtld: Add -p switch to direct exec mode summary line.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoVendor import svn-1.14.0.
Dimitry Andric [Sun, 31 May 2020 20:58:28 +0000 (20:58 +0000)]
Vendor import svn-1.14.0.

4 years agoVendor import apr-1.7.0
Dimitry Andric [Sun, 31 May 2020 20:56:05 +0000 (20:56 +0000)]
Vendor import apr-1.7.0

4 years agoFix panics when using iflib pseudo device support
Matt Macy [Sun, 31 May 2020 18:42:00 +0000 (18:42 +0000)]
Fix panics when using iflib pseudo device support

Reviewed by: gallatin@, hselasky@
MFC after: 1 week
Sponsored by: Netgate, Inc.
Differential Revision: https://reviews.freebsd.org/D23710

4 years agoHandle getcpu() calls in vsyscall emulation on amd64.
Mark Johnston [Sun, 31 May 2020 18:20:20 +0000 (18:20 +0000)]
Handle getcpu() calls in vsyscall emulation on amd64.

linux_getcpu() has been implemented since r356241.

PR: 246339
Submitted by: John Hay <john@sanren.ac.za>
MFC after: 1 week

4 years agoFix installation of libxo encoder modules.
Tijl Coosemans [Sun, 31 May 2020 17:20:17 +0000 (17:20 +0000)]
Fix installation of libxo encoder modules.

Because the install location was hardcoded in the Makefile as
/usr/lib/libxo/encoder, the lib32 version was installed over the native
version.  Replace /usr/lib with ${LIBDIR}.

Also define SHLIB_NAME instead of LIB + FILES.  This prevents building a
static library.

MFC after: 2 weeks

4 years agoreadelf: add more DT_FLAGS_1 flags
Ed Maste [Sun, 31 May 2020 15:31:47 +0000 (15:31 +0000)]
readelf: add more DT_FLAGS_1 flags

Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

> DF_1_SINGLETON  Singleton symbols exist.
> DF_1_STUB       Object is a stub.
> DF_1_PIE        Object is a position-independent executable.

Sponsored by: The FreeBSD Foundation

4 years agoRemove remnant of arm's ELF trampoline
Mitchell Horne [Sun, 31 May 2020 14:43:04 +0000 (14:43 +0000)]
Remove remnant of arm's ELF trampoline

The trampoline code used for loading gzipped a.out kernels on arm was
removed in r350436. A portion of this code allowed for DDB to find the
symbol tables when booting without loader(8), and some of this was
untouched in the removal. Remove it now.

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

4 years agoFix directly building in sys/modules
Li-Wen Hsu [Sun, 31 May 2020 05:02:15 +0000 (05:02 +0000)]
Fix directly building in sys/modules

Sponsored by: The FreeBSD Foundation

4 years agoAdd the .h file that describes the operations for the rpctls_syscall.
Rick Macklem [Sun, 31 May 2020 01:12:52 +0000 (01:12 +0000)]
Add the .h file that describes the operations for the rpctls_syscall.

This .h file will be used by the nfs-over-tls daemons to do the system
call that was added by r361599.

4 years agoelf_common.h: define DF_1_PIE
Ed Maste [Sat, 30 May 2020 19:57:26 +0000 (19:57 +0000)]
elf_common.h: define DF_1_PIE

DF_1_PIE indicates that the object is a position-independent executable.

Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agobinutils: build as with BINUTILS || BINUTILS_BOOTSTRAP
Ed Maste [Sat, 30 May 2020 19:16:33 +0000 (19:16 +0000)]
binutils: build as with BINUTILS || BINUTILS_BOOTSTRAP

Previously we descended into as only if MK_BINUTILS was true, including
during the bootstrap tool phase.  BINUTILS is now disabled by default on
all archs, and we failed to build it during amd64 bootstrap.

Descend into as if either BINUTILS or BINUTILS_BOOTSTRAP is enabled.

This is not quite correct: we should either have the test also depend on
BOOTSTRAPPING, or set BINUTILS to the value of BINUTILS_BOOTSTRAP during
the bootstrap phase.  However, this simple change fixes the build and
has been tested, and binutils will be removed completely in the near
future.

4 years agocertctl.8: Correct the HISTORY section.
Mark Johnston [Sat, 30 May 2020 19:15:29 +0000 (19:15 +0000)]
certctl.8: Correct the HISTORY section.

certctl was merged to stable/12 after 12.1 was branched.

PR: 246190
Reported by: Michael Osipov <michael.osipov@siemens.com>
MFC after: 3 days

4 years agoctld: Fix a memory leak in uclparse_conf().
Mark Johnston [Sat, 30 May 2020 19:11:41 +0000 (19:11 +0000)]
ctld: Fix a memory leak in uclparse_conf().

PR: 246596
Submitted by: Patryk <patrykkotlowski@gmail.com>
MFC after: 1 week

4 years agoMakefile.inc1: remove BINUTILS_BOOTSTRAP linker support
Ed Maste [Sat, 30 May 2020 16:20:18 +0000 (16:20 +0000)]
Makefile.inc1: remove BINUTILS_BOOTSTRAP linker support

As of r359347 BINUTILS_BOOTSTRAP does not include the bfd linker.

4 years agoAdd deprecation notice to WITH_BINUTILS option description
Ed Maste [Sat, 30 May 2020 16:13:21 +0000 (16:13 +0000)]
Add deprecation notice to WITH_BINUTILS option description

4 years agoAdd deprecation notice to WITH_BINUTILS option description
Ed Maste [Sat, 30 May 2020 16:12:50 +0000 (16:12 +0000)]
Add deprecation notice to WITH_BINUTILS option description

4 years agoDisable BINUTILS by default on amd64
Ed Maste [Sat, 30 May 2020 16:12:00 +0000 (16:12 +0000)]
Disable BINUTILS by default on amd64

The retirement of obsolete binutils 2.17.50 has been in progress for
quite some time.  All tools other than GNU as were removed prior to this
commit, and it was built only on amd64 - installed as /usr/bin/as, and
used as a bootstrap tool.

The amd64 exp-run has completed and failures have now been addressed in
the individual ports, so disable it by default.

PR: 233611, 205250 [exp-run]
Sponsored by: The FreeBSD Foundation

4 years agosh: Allow more scripts without #!
Jilles Tjoelker [Sat, 30 May 2020 16:00:49 +0000 (16:00 +0000)]
sh: Allow more scripts without #!

Austin Group bugs #1226 and #1250 changed the requirements for shell scripts
without #! (POSIX does not specify #!; this is about the shell execution
when execve(2) returns an [ENOEXEC] error).

POSIX says we shall allow execution if the initial part intended to be
parsed by the shell consists of characters and does not contain the NUL
character.  This allows concatenating a shell script (ending with exec or
exit) and a binary payload.

In order to reject common binary files such as PNG images, check that there
is a lowercase letter or expansion before the last newline before the NUL
character, in addition to the check for the newline character suggested by
POSIX.

4 years agogenet: workaround for problem with ICMPv6 echo replies
Mike Karels [Sat, 30 May 2020 02:09:36 +0000 (02:09 +0000)]
genet: workaround for problem with ICMPv6 echo replies

The ICMPv6 echo reply is constructed with the IPv6 header too close to
the beginning of a packet for an Ethernet header to be prepended, so we
end up with an mbuf containing just the Ethernet header.  The GENET
controller doesn't seem to handle this, with or without transmit checksum
offload.  At least until we have chip documentation, do a pullup to
satisfy the chip.  Hopefully this can be fixed properly in the future.

4 years agogenet: fix issues with transmit checksum offload
Mike Karels [Sat, 30 May 2020 02:02:34 +0000 (02:02 +0000)]
genet: fix issues with transmit checksum offload

Fix problem with ICMP echo replies: check only deferred data checksum
flags, and not the received checksum status bits, when checking whether
a packet has a deferred checksum; otherwise echo replies are corrupted
because the received checksum status bits are still present.

Fix some unhandled cases in packet shuffling for checksum offload.

4 years agoRB_REMOVE invokes RB_REMOVE_COLOR either when child is red or child is
Doug Moore [Sat, 30 May 2020 01:48:12 +0000 (01:48 +0000)]
RB_REMOVE invokes RB_REMOVE_COLOR either when child is red or child is
null. In the first case, RB_REMOVE_COLOR just changes the child to
black and returns. With this change, RB_REMOVE handles that case, and
drops the child argument to RB_REMOVE_COLOR, since that value is
always null.

RB_REMOVE_COLOR is changed to remove a couple of unneeded tests, and
to eliminate some deep indentation.

RB_ISRED is defined to combine a null check with a test for redness,
to replace that combination in several places.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25032

4 years agoOnly build ipsec modules if the kernel includes IPSEC_SUPPORT.
John Baldwin [Sat, 30 May 2020 00:47:03 +0000 (00:47 +0000)]
Only build ipsec modules if the kernel includes IPSEC_SUPPORT.

Honoring the kernel-supplied opt_ipsec.h in r361632 causes builds of
ipsec modules to fail if the kernel doesn't include IPSEC_SUPPORT.
However, the module can never be loaded into such a kernel, so only
build the modules if the kernel includes IPSEC_SUPPORT.

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

4 years ago[run] Don't add 11ng channels (2GHz) for RF2020
Adrian Chadd [Sat, 30 May 2020 00:07:42 +0000 (00:07 +0000)]
[run] Don't add 11ng channels (2GHz) for RF2020

Don't also add the 11ng channels if we're not in 11n mode or net80211 will
get super weird.

4 years ago[run] Set ampdu rxmax same as linux; RF2020 isn't an 11n NIC
Adrian Chadd [Sat, 30 May 2020 00:06:26 +0000 (00:06 +0000)]
[run] Set ampdu rxmax same as linux; RF2020 isn't an 11n NIC

This is from the linux driver:

* set the ampdu rx max to 32k for 1 stream devics like mine, and
  64k for larger ones
* Don't enable 11n bits for RF2020

4 years agogeom_part: Dispatch to partitions to create providers and aliases
Conrad Meyer [Fri, 29 May 2020 19:44:18 +0000 (19:44 +0000)]
geom_part: Dispatch to partitions to create providers and aliases

This allows partitions to create additional aliases of their own.  The
default method implementations preserve the existing behavior.

No functional change.

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

4 years agoAdd opt_ipsec.h to fix standalone builds after r361633.
John Baldwin [Fri, 29 May 2020 19:29:10 +0000 (19:29 +0000)]
Add opt_ipsec.h to fix standalone builds after r361633.

4 years agoConsistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>.
John Baldwin [Fri, 29 May 2020 19:22:40 +0000 (19:22 +0000)]
Consistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>.

This fixes ipsec.ko to include all of IPSEC_DEBUG.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25046

4 years agoHonor opt_ipsec.h from kernel builds.
John Baldwin [Fri, 29 May 2020 19:21:35 +0000 (19:21 +0000)]
Honor opt_ipsec.h from kernel builds.

To make this simpler, set the default contents of opt_ipsec.h
for standalone modules in sys/conf/config.mk.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25046

4 years agoRemove session locking from cfiscsi_pdu_update_cmdsn().
Alexander Motin [Fri, 29 May 2020 17:52:20 +0000 (17:52 +0000)]
Remove session locking from cfiscsi_pdu_update_cmdsn().

cs_cmdsn can be incremented with single atomic.  expcmdsn/maxcmdsn set in
cfiscsi_pdu_prepare() based on cs_cmdsn are not required to be updated
synchronously, only monotonically, that is achieved with lock there.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoregen src.conf.5 after BINUTILS changes
Ed Maste [Fri, 29 May 2020 17:39:25 +0000 (17:39 +0000)]
regen src.conf.5 after BINUTILS changes

4 years agoDisable BINUTILS by default on i386
Ed Maste [Fri, 29 May 2020 17:36:54 +0000 (17:36 +0000)]
Disable BINUTILS by default on i386

The retirement of obsolete binutils 2.17.50 has been in progress for
quite some time.  All tools other than GNU as were removed prior to this
commit, and it was built only on two archs:

i386, installed as /usr/bin/as
amd64, installed as /usr/bin/as and as a bootstrap tool

The i386 exp-run has completed and failures have been addressed in the
individual ports, so disable it there.

PR: 233611, 205250 [exp-run]
Sponsored by: The FreeBSD Foundation

4 years ago[run] Add initial 802.11n support.
Adrian Chadd [Fri, 29 May 2020 15:56:44 +0000 (15:56 +0000)]
[run] Add initial 802.11n support.

* Enable self-generated 11n frames
* add MCS rates for 1-stream and 2-stream rates; will do 3-stream
  once the rest of this tests out OK with other people.
* Hard-code 1 stream for now
* Add A-MPDU RX mbuf tagging
* RTS/CTS if doing RTSCTS in HT protmode as well as legacy; they're
  separate configuration flags
* Update the amrr rate index stuff - walk the rates array like others
  to find the right one - this now works for MCS and CCK/OFDM rates
* Add support for atheros fast frames/AMSDU support as we can generate
  those in net80211.

TODO:

* HT40 isn't enabled yet
* No A-MPDU support just yet; that requires some more firmware research
  and maybe porting some ath(4) A-MPDU support/tracking into net80211
* Short preamble flags aren't set yet for MCS; need to check the linux
  driver and see what's going on there
* Add 3x3 rates and set tx/rx stream configuration appropriately
* More 5GHz testing; I have a 3x3 dual band USB NIC coming soon that'll
  let me test this.
* Figure out why the RX path isn't performing as fast as it could -
  there's only a single buffer loaded at a time for the receive path
  in the USB bulk handler and this may not be super useful.

Tested:

* RT5390 usb, 1x1, RF5370 (2GHz radio), STA mode - A-MSDU TX, A-MPDU RX

Submitted by: Ashish Gupta <ashishgu@andrew.cmu.edu>
Differential Revision: https://reviews.freebsd.org/D22840

4 years agoReport STATUS_QUEUED/SENT in `ctladm dumpooa` output.
Alexander Motin [Fri, 29 May 2020 13:07:52 +0000 (13:07 +0000)]
Report STATUS_QUEUED/SENT in `ctladm dumpooa` output.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoFix O_IP_FLOW_LOOKUP opcode handling.
Andrey V. Elsukov [Fri, 29 May 2020 10:37:42 +0000 (10:37 +0000)]
Fix O_IP_FLOW_LOOKUP opcode handling.

Do not check table value matching when table lookup has failed.

Reported by: Sergey Lobanov
MFC after: 1 week

4 years agoRevert r361497, these cases are fixed by r361617.
Li-Wen Hsu [Fri, 29 May 2020 10:09:47 +0000 (10:09 +0000)]
Revert r361497, these cases are fixed by r361617.

PR: 246737
Sponsored by: The FreeBSD Foundation

4 years agouma: hide item_domain under ifdef NUMA
Mateusz Guzik [Fri, 29 May 2020 08:30:35 +0000 (08:30 +0000)]
uma: hide item_domain under ifdef NUMA

Fixes build warnings on mips.

4 years agodo not enable pci bridge decoding on resume until I/O windows are restored
Andriy Gapon [Fri, 29 May 2020 07:50:55 +0000 (07:50 +0000)]
do not enable pci bridge decoding on resume until I/O windows are restored

PCI bus driver restores most but not all of a child PCI-PCI bridge
configuration.  The bridge's I/O windows are restored by pcib driver and
that happens later in time.  This can be problematic because the Command
register is restored before the windows are restored.  If the firmware
programs the windows incorrectly or even does not program them at all,
then the bridge can start claiming I/O cycles that are not intended for
it.  This will continue until the correct windows are restored.

I have observed this problem with a buggy BIOS where after resuming from
S3 an I/O port window of a PCI-PCI bridge was configured with zero base
and limit causing the bridge to claim 0x0 - 0xFFF port range.  That
interfered with ACPI port access including ACPI PM Timer at port 0x808,
thus wreaking havoc in the time keeping.

The solution is to restore the Command register of PCI-PCI bridges after
the windows are restored in pcib driver.  While here, I decided that for
other PCI device types (normal and cardbus) it's better to restore the
Command register after their BARs are restored.

To do: per jhb's suggestion, move the window handling to pci driver.

Reviewed by: imp, jhb, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25028

4 years agocorefile_open_last: don't keep a locked vnode while locking other ones
Andriy Gapon [Fri, 29 May 2020 07:44:02 +0000 (07:44 +0000)]
corefile_open_last: don't keep a locked vnode while locking other ones

Consider this scenario:
- kern.corefile=/var/coredumps/%N.%U.%I.core
- multiple processes with the same name crash at the same time

It's possible that one process selects existing file N as oldvp while it
keeps looking for an unused file number.  Another process scans through
files and stumbles upon N.  That process would be blocked on the vnode
lock while holding the directory vnode exclusively locked.  The first
process would, thus, get blocked on the directory's vnode lock.

More generally, holding a file's vnode lock (oldvp) while trying to lock
its directory (for the next lookup) is a violation of the vnode locking
order.

I have observed this deadlock in the wild.

So, the change to keep oldvp "opened" but unlocked and to lock it again
only if it's to be returned as the result.
As kib noted, an alternative would be to keep the directory locked and
to use VOP_LOOKUP directly for scanning through existing core files.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25027

4 years agoIncrement the correct pointer when a crypto buffer spans an mbuf or iovec.
John Baldwin [Fri, 29 May 2020 05:41:21 +0000 (05:41 +0000)]
Increment the correct pointer when a crypto buffer spans an mbuf or iovec.

When a crypto_cursor_copyback() request spanned multiple mbufs or
iovecs, the pointer into the mbuf/iovec was incremented instead of the
pointer into the source buffer being copied from.

PR: 246737
Reported by: Jenkins, ZFS test suite
Sponsored by: Netflix

4 years agoMove EXPDATASN/R2TSN from PDU to CTL_PRIV_FRONTEND.
Alexander Motin [Fri, 29 May 2020 02:32:48 +0000 (02:32 +0000)]
Move EXPDATASN/R2TSN from PDU to CTL_PRIV_FRONTEND.

We any way have per-I/O space in CTL_PRIV_FRONTEND, while for PDU private
fields I have better use ideas.  Plus to me such use of PDU fields looked
a layering violation.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agopowerpc: Stop advertising that POWER8 and POWER9 support HTM
Justin Hibbits [Fri, 29 May 2020 00:46:31 +0000 (00:46 +0000)]
powerpc: Stop advertising that POWER8 and POWER9 support HTM

HTM is on the chopping block, doesn't work on FreeBSD, and has only token
support in PowerISA 3.1 and POWER10.  Don't advertise something we'll never
support.

4 years agoOops two, missed syscall.mk as well.
Rick Macklem [Fri, 29 May 2020 00:10:19 +0000 (00:10 +0000)]
Oops two, missed syscall.mk as well.

4 years agoPermit SO_NO_DDP and SO_NO_OFFLOAD to be read via getsockopt(2).
John Baldwin [Fri, 29 May 2020 00:09:12 +0000 (00:09 +0000)]
Permit SO_NO_DDP and SO_NO_OFFLOAD to be read via getsockopt(2).

MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24627

4 years ago[mips] fix up the assembly generation of unaligned exception loads
Adrian Chadd [Fri, 29 May 2020 00:05:43 +0000 (00:05 +0000)]
[mips] fix up the assembly generation of unaligned exception loads

I noticed that unaligned accesses were returning garbage values.

Give test data like this:

char testdata[] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf1, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x5a };

Iterating through uint32_t space 1 byte at a time should
look like this:

freebsd-carambola2:/mnt# ./test
Hello, world!
offset 0 pointer 0x410b00 value 0x12345678 0x12345678
offset 1 pointer 0x410b01 value 0x3456789a 0x3456789a
offset 2 pointer 0x410b02 value 0x56789abc 0x56789abc
offset 3 pointer 0x410b03 value 0x789abcde 0x789abcde
offset 4 pointer 0x410b04 value 0x9abcdef1 0x9abcdef1
offset 5 pointer 0x410b05 value 0xbcdef123 0xbcdef123
offset 6 pointer 0x410b06 value 0xdef12345 0xdef12345
offset 7 pointer 0x410b07 value 0xf1234567 0xf1234567

.. but to begin with it looked like this:

offset 0 value 0x12345678
offset 1 value 0x00410a9a
offset 2 value 0x00419abc
offset 3 value 0x009abcde
offset 4 value 0x9abcdef1
offset 5 value 0x00410a23
offset 6 value 0x00412345
offset 7 value 0x00234567

The amusing reason? The compiler is generating the lwr/lwl incorrectly.
Here's an example after I tried to replace the two macros with a single
invocation and offset, rather than having the compiler compile in addiu
to s3 - but the bug is the same:

1044: 8a620003 lwl v0,0(s3)
1048: 9a730000 lwr s3,3(s3)

.. which is just totally trashy and wrong.

This explicitly tells the compiler to treat the output as being read
and written to, which is what lwl/lwr does with the destination
register.

I think a subsequent commit should unify these macros to skip an addiu,
but that can be a later commit.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D25040

4 years agoOops, missed syscall.h and sysproto.h for r361602.
Rick Macklem [Thu, 28 May 2020 23:57:50 +0000 (23:57 +0000)]
Oops, missed syscall.h and sysproto.h for r361602.

Pointy hat goes on me.

4 years agoRemove PDU_TOTAL_TRANSFER_LEN() macro.
Alexander Motin [Thu, 28 May 2020 23:55:46 +0000 (23:55 +0000)]
Remove PDU_TOTAL_TRANSFER_LEN() macro.

I don't see a point to copy io->scsiio.kern_total_len into the request
PDU private field.  The io is going to stay with us till the end, and
kern_total_len field is not changed after being first initialized.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agorename in-tree libevent v1 to libevent1
Ed Maste [Thu, 28 May 2020 22:05:50 +0000 (22:05 +0000)]
rename in-tree libevent v1 to libevent1

r316063 installed pf's embedded libevent as a private lib, with headers
in /usr/include/private/event.  Unfortunately we also have a copy of
libevent v2 included in ntp, which needed to be updated for compatibility
with OpenSSL 1.1.

As unadorned 'libevent' generally refers to libevent v2, be explicit that
this one is libevent v1.

Reviewed by: vangyzen (earlier)
Differential Revision: https://reviews.freebsd.org/D17275

4 years agoAdd an UPDATING entry for r360964
Eric van Gyzen [Thu, 28 May 2020 22:05:33 +0000 (22:05 +0000)]
Add an UPDATING entry for r360964

Reported by: rpokala
Sponsored by: Dell EMC Isilon

4 years agoRevert part of r360964
Eric van Gyzen [Thu, 28 May 2020 21:56:31 +0000 (21:56 +0000)]
Revert part of r360964

ports/devel/linux_libusb builds FreeBSD libusb with GCC 4.8.5
from devel/linux-c7-devtools.  Restore the tests for older GCC
in bsd.sys.mk to accomodate such ports.

Reported by: tijl
Sponsored by: Dell EMC Isilon

4 years agoMake struct ctl_be_lun first element of struct ctl_be_*_lun.
Alexander Motin [Thu, 28 May 2020 21:30:29 +0000 (21:30 +0000)]
Make struct ctl_be_lun first element of struct ctl_be_*_lun.

It allows to remove some extra pointer dereferences and slightly tightens
up the code by unification.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoAdd an entry to Symbol.map for the rpctls_syscall added by r361599.
Rick Macklem [Thu, 28 May 2020 21:26:26 +0000 (21:26 +0000)]
Add an entry to Symbol.map for the rpctls_syscall added by r361599.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D24949