]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMerge commit 47b0262d3 from llvm git (by me):
dim [Mon, 7 Sep 2020 20:10:03 +0000 (20:10 +0000)]
Merge commit 47b0262d3 from llvm git (by me):

  Add <stdarg.h> include to kmp_os.h, to get the va_list type, required
  after cde8f4c164a2. Sort system includes, while here.

The original merged commit works fine by itself on head, but fails to
compile on stable branches because stdarg.h is not implicitly pulled in.

MFC after: immediately, to fix failing builds on stable/{11,12}

3 years agoFix vdso compat32 timekeeping on !=x86.
bdragon [Mon, 7 Sep 2020 20:05:18 +0000 (20:05 +0000)]
Fix vdso compat32 timekeeping on !=x86.

Since x86 is the only 32-bit arch that has a 32-bit time_t, adjust the
private bintime32 struct in vdso to only use a 32 bit sec on amd64.

This matches the existing behavior in the compat code.

Noticed while implementing vdso timekeeping on powerpc.

This should also theoretically fix vdso timekeeping for arm binaries on
aarch64.

See tools attached to https://reviews.freebsd.org/D26347 for testing.

Reviewed by: kib (in irc)
Sponsored by: Tag1 Consulting, Inc.

3 years agoCall atf_skip function in cleanup procedure as it also triggers zfs.ko loading
lwhsu [Mon, 7 Sep 2020 18:15:58 +0000 (18:15 +0000)]
Call atf_skip function in cleanup procedure as it also triggers zfs.ko loading

PR: 249055
Sponsored by: The FreeBSD Foundation

3 years agontp: whitespace and typo fix in conf file
emaste [Mon, 7 Sep 2020 17:19:31 +0000 (17:19 +0000)]
ntp: whitespace and typo fix in conf file

PR: 248942
Submitted by: Jose Luis Duran (whitespace), igor (typo)
MFC after: 1 week

3 years agoWiFi: fix ieee80211_media_change() callers
bz [Mon, 7 Sep 2020 15:35:40 +0000 (15:35 +0000)]
WiFi: fix ieee80211_media_change() callers

In r178354 with the introduction of multi-bss ("vap") support factoring
out started and with r193340 ieee80211_media_change() no longer returned
ENETRESET but only 0 or error.
As ieee80211(9) tells the ieee80211_media_change() function should not
be called directly but is registered with ieee80211_vap_attach() instead.

Some drivers have not been fully converted.  After fixing the return
checking some of these functions were simply wrappers between
ieee80211_vap_attach() and ieee80211_media_change(), so remove the extra
function, where possible as well.

PR: 248955
Submitted by: Tong Zhang (ztong0001 gmail.com) (original)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agonsswitch.conf.5: style fixes
asomers [Mon, 7 Sep 2020 13:44:54 +0000 (13:44 +0000)]
nsswitch.conf.5: style fixes

Fix some whitespace, and remove the .Tn macro

Reported by: mandoc, igor
Reviewed by: bcr (manpages)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26345

3 years agoConsistently use the same gateway when adding/deleting interface routes.
melifaro [Mon, 7 Sep 2020 10:13:54 +0000 (10:13 +0000)]
Consistently use the same gateway when adding/deleting interface routes.

Use the same link-level gateway when adding or deleting interface routes.
This helps nexthop checking in the upcoming multipath changes.

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

3 years agoSlightly improve usb(4)
lwhsu [Mon, 7 Sep 2020 07:44:14 +0000 (07:44 +0000)]
Slightly improve usb(4)

- Mention USB 3.0
- Update links
- Fix `mandoc -T lint` warnings

Reviewed by: bcr, hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26349

3 years agomusb/allwinner: add support for configuring phy as well as device mode
avg [Mon, 7 Sep 2020 06:53:29 +0000 (06:53 +0000)]
musb/allwinner: add support for configuring phy as well as device mode

At least on Orange Pi PC Plus even the host mode does not work without
enabling the phy and setting it to the host mode.

The driver will now parse dr_mode property and will try to configure
itself and the phy accordingly.
OTG mode is not supported yet, so it is treated as the device / peripheral
mode.

The phy is enabled -- powered on -- only for the host mode.

The device mode requires support from a phy driver, e.g., aw_usbphy on
Allwinner platform.
aw_usbphy does not support the device mode, so it cannnot work yet.

MFC after: 6 weeks

3 years agomusb/allwinner: add H3 support
avg [Mon, 7 Sep 2020 06:49:07 +0000 (06:49 +0000)]
musb/allwinner: add H3 support

MFC after: 6 weeks

3 years agomusb/allwinner: apply register filter in awusbdrd_bs_r_2() as well
avg [Mon, 7 Sep 2020 06:48:08 +0000 (06:48 +0000)]
musb/allwinner: apply register filter in awusbdrd_bs_r_2() as well

Otherwise, I get this panic:
panic: awusbdrd_reg: Invalid register 0x342

It looks that musb code both writes and reads at least MUSB2_REG_TXDBDIS.

MFC after: 5 weeks
X-MFC after: r365399

3 years agofixup r365398: add a missed file with all the new Allwinner musb_otg code
avg [Mon, 7 Sep 2020 06:44:24 +0000 (06:44 +0000)]
fixup r365398: add a missed file with all the new Allwinner musb_otg code

Obtained from: andrew
MFC after: 5 weeks
X-MFC with: r365398

3 years agoAllwinner USB DRD support (musb_otg)
avg [Mon, 7 Sep 2020 06:39:00 +0000 (06:39 +0000)]
Allwinner USB DRD support (musb_otg)

Allwinner USB DRD is based on the Mentor USB OTG controller, with a
different register layout and a few missing registers.

The code is by Andrew Turner (andrew).

Reviewed by: hselasky, manu
Obtained from: andrew
MFC after: 5 weeks
Differential Revision: https://reviews.freebsd.org/D5881

3 years agotwsi: some variants clear interrupt flag by writing 0, others by writing 1
avg [Mon, 7 Sep 2020 06:32:03 +0000 (06:32 +0000)]
twsi: some variants clear interrupt flag by writing 0, others by writing 1

Make that distinction more explicit and regular in the code.
The difference in behavior is documented in the respective datasheets.

Previously, the code handled the distinction by writing the control
register multiple times where at least one write was zero and another
was one.

This can be considered a follow-up to r363021.

Reviewed by: manu
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D26308

3 years agotwsi: use tsleep instead of pause for better responsiveness
avg [Mon, 7 Sep 2020 06:29:41 +0000 (06:29 +0000)]
twsi: use tsleep instead of pause for better responsiveness

wakeup() does not have any effect on pause(), so if a transfer was
not finished by the time of the first check, then the thread
would sleep full 30 ms.

To do: protect the transfer and interrupt code with the mutex,
switch from tsleep from msleep

Reviewed by: manu
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D26309

3 years agoaw_clk_nm: fix incorrect use of abs()
avg [Mon, 7 Sep 2020 06:27:18 +0000 (06:27 +0000)]
aw_clk_nm: fix incorrect use of abs()

abs() takes a (signed) int as input.
Instead, it was used with unsigned 64-bit integers.

So, add and use a new helper function to calculate a difference between
two uint64_t-s.

Reviewed by: manu
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26307

3 years agonsswitch.conf(5): recommend placing cache after files
asomers [Sun, 6 Sep 2020 20:32:13 +0000 (20:32 +0000)]
nsswitch.conf(5): recommend placing cache after files

When cache precedes files, and nscd is configured to allow negative caching,
commands like "pw groupadd" can fail. The sequence of events looks like:

1. A command like pkg(8) looks up the group, and finds it absent.
2. pkg invokes pw(8) to add the group
3. pkg queries the group, but nscd says it doesn't exist, since it has a
   negative cache entry for that group.

See also: https://lists.freebsd.org/pipermail/freebsd-current/2012-January/031595.html

Reviewed by: bcr (manpages)
MFC after: 1 week
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26184

3 years agopadlock(4): fix instapanics with geli authentication
asomers [Sun, 6 Sep 2020 19:25:31 +0000 (19:25 +0000)]
padlock(4): fix instapanics with geli authentication

cryptodev_process implementations are supposed to return 0

PR: 247986
Submitted by: jhb
MFC after: 1 week

3 years agoRemove duplicated line.
oshogbo [Sun, 6 Sep 2020 15:44:09 +0000 (15:44 +0000)]
Remove duplicated line.

Reported by: lwhsu

3 years agotraceroute6: capsicumize it
oshogbo [Sun, 6 Sep 2020 14:04:02 +0000 (14:04 +0000)]
traceroute6: capsicumize it

Submitted by: Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
Differential Revision: https://reviews.freebsd.org/D25604

3 years agoFollow-up r365371 by removing sentences which indicate the state of the
dim [Sun, 6 Sep 2020 09:08:06 +0000 (09:08 +0000)]
Follow-up r365371 by removing sentences which indicate the state of the
MK_MALLOC_PRODUCTION option on -CURRENT.

Also, for the sake of backwards compatibility, support the old way of
enabling 'production malloc', e.g. by adding a define in make.conf(5).

MFC after: 1 week
X-MFC-With: r365371

3 years agoTurn MALLOC_PRODUCTION into a regular src.conf(5) option
dim [Sat, 5 Sep 2020 23:30:17 +0000 (23:30 +0000)]
Turn MALLOC_PRODUCTION into a regular src.conf(5) option

For historical reasons, defining MALLOC_PRODUCTION in /etc/make.conf has
been used to turn off potentially expensive debug checks and statistics
gathering in the implementation of malloc(3).

It seems more consistent to turn this into a regular src.conf(5) option,
e.g. WITH_MALLOC_PRODUCTION / WITHOUT_MALLOC_PRODUCTION. This can then
be toggled similar to any other source build option, and turned on or
off by default for e.g. stable branches.

Reviewed by: imp, #manpages
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26337

3 years agoUndo 'fix off by one' part of r365360.
kib [Sat, 5 Sep 2020 22:48:27 +0000 (22:48 +0000)]
Undo 'fix off by one' part of r365360.

Noted by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 6 days

3 years agortld: do not refuse to relocate objects without dynamic symtabs.
kib [Sat, 5 Sep 2020 22:44:38 +0000 (22:44 +0000)]
rtld: do not refuse to relocate objects without dynamic symtabs.

Such objects can still have valid relocations not requiring symbolic
references.

PR: 249121
Reported by: wsh@riski.sh
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agortld: do not process absent dynamic.
kib [Sat, 5 Sep 2020 22:41:31 +0000 (22:41 +0000)]
rtld: do not process absent dynamic.

If object has no dynamic phdr, do not try to dereference NULL.  This
means that we cannot process any relocation, and that there cannot be
symbols defined, but it is up to static linker to produce meaningful
objects.

PR: 249121
Reported by: wsh@riski.sh
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agosx: fix up manpage after r363113
mjg [Sat, 5 Sep 2020 20:22:02 +0000 (20:22 +0000)]
sx: fix up manpage after r363113

No date change as there is no new information.

Submitted by: sigsys@gmail.com
Differential Revision: https://reviews.freebsd.org/D26341

3 years agoUpdate to bmake-20200902
sjg [Sat, 5 Sep 2020 19:29:42 +0000 (19:29 +0000)]
Update to bmake-20200902

Lots of code refactoring, simplification and cleanup.
Lots of new unit-tests providing much higher code coverage.
All courtesy of rillig at netbsd.

Other significant changes:

o new read-only variable .SHELL which provides the path of the shell
  used to run scripts (as defined by  the .SHELL target).

o variable parsing detects more errors.

o new debug option -dl: LINT mode, does the equivalent of := for all
  variable assignments so that file and line number are reported for
  variable parse errors.

3 years agoci-qemu-test.sh: use pkgbase
emaste [Sat, 5 Sep 2020 19:03:34 +0000 (19:03 +0000)]
ci-qemu-test.sh: use pkgbase

Reviewed by: bcran (earlier), manu (earlier), imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24276

3 years agotag bmake-20200902
sjg [Sat, 5 Sep 2020 16:44:37 +0000 (16:44 +0000)]
tag bmake-20200902

3 years agortsock.c: remove extraneous space
emaste [Sat, 5 Sep 2020 16:13:36 +0000 (16:13 +0000)]
rtsock.c: remove extraneous space

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D26249

3 years agoImport bmake-20200902
sjg [Sat, 5 Sep 2020 16:11:04 +0000 (16:11 +0000)]
Import bmake-20200902

Lots of code refactoring, simplification and cleanup.
Lots of new unit-tests providing much higher code coverage.
All courtesy of rillig at netbsd.

Other significant changes:

o new read-only variable .SHELL which provides the path of the shell
  used to run scripts (as defined by  the .SHELL target).

o new debug option -dl: LINT mode, does the equivalent of := for all
  variable assignments so that file and line number are reported for
  variable parse errors.

3 years agortld: Handle ELF dso with program headers outside the first page.
kib [Sat, 5 Sep 2020 10:16:24 +0000 (10:16 +0000)]
rtld: Handle ELF dso with program headers outside the first page.

Reported by: Alex Arslan <alex.arslan@julialang.org>
PR: 229708
Reviewed by: dim (previous version), emaste
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26323

3 years agoFix typo in comment.
imp [Sat, 5 Sep 2020 04:20:29 +0000 (04:20 +0000)]
Fix typo in comment.

Noticed by: bapt@

3 years agoFix a potential memory leak in the NFS over TLS handling code.
rmacklem [Sat, 5 Sep 2020 00:50:52 +0000 (00:50 +0000)]
Fix a potential memory leak in the NFS over TLS handling code.

For the TLS case where there is a "user@domain" name specified in the
X.509 v3 certificate presented by the client in the otherName component
of subjectAltName, a gid list is allocated via mem_alloc().
This needs to be free'd. Otherwise xp_gidp == NULL and free() handles that.
(The size argument to mem_free() is not used by FreeBSD, so it can be 0.)

This leak would not have occurred for any other case than NFS over TLS
with the "user@domain" in the client's certificate.

3 years agoDeclare dependency relationship once instead of twice for zpool
delphij [Sat, 5 Sep 2020 00:45:46 +0000 (00:45 +0000)]
Declare dependency relationship once instead of twice for zpool
and zvol.

3 years agovfs: avoid exposing partially constructed vnodes
chs [Sat, 5 Sep 2020 00:26:03 +0000 (00:26 +0000)]
vfs: avoid exposing partially constructed vnodes

If multiple threads race calling vfs_hash_insert() while creating vnodes
with the same identity, all of the vnodes which lose the race must be
destroyed before any other thread can see them. Previously this was
accomplished by the vput() in vfs_hash_insert() resulting in the vnode's
VOP_INACTIVE() method calling vgone() before the vnode lock was unlocked,
but at some point changes to the the vnode refcount/inactive logic have caused
that to no longer work, leading to crashes, so instead vfs_hash_insert()
must call vgone() itself before calling vput() on vnodes which lose the race.

Reviewed by: mjg, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26291

3 years agobbr: remove unused static function
bz [Sat, 5 Sep 2020 00:20:32 +0000 (00:20 +0000)]
bbr: remove unused static function

bbr_log_type_hrdwtso() is a file local static unused function.
Remove it to avoid warnings on kernel compiles.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D26331

3 years agouipc_ktls: remove unused static function
bz [Sat, 5 Sep 2020 00:19:40 +0000 (00:19 +0000)]
uipc_ktls: remove unused static function

m_segments() was added with r363464 but never used. Remove it to
avoid warnings when compiling kernels.

Reported by: rmacklem (also says jhb)
Reviewed by: gallatin, jhb
Differential Revision: https://reviews.freebsd.org/D26330

3 years agoMake zpool on GELI work again.
delphij [Fri, 4 Sep 2020 23:36:43 +0000 (23:36 +0000)]
Make zpool on GELI work again.

After OpenZFS import, zpool auto import behavior was moved to an
explicit "zpool import -a", and the zpool rc.d script was added
as a prerequisite of zvol.

However, in r299839, zvol was added as a prerequisite of dumpon,
making it to start very early and before all 'disks' providers.
At this time, dumping on a zvol is not supported, so remove this
requirement and make zpool depend on disks to allow zpool on
full disk encryption work.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D26333

3 years agoZFS: MFV 2.0-rc1-gfd20a8
mmacy [Fri, 4 Sep 2020 22:25:14 +0000 (22:25 +0000)]
ZFS: MFV 2.0-rc1-gfd20a8

- fixes jail delegation
- fixes raw kstat unsupported complaints
- exposes dbgmsg, dbuf, and checksum benchmark stats
- restore rename -u support

3 years agomake spa_stats.c common
mmacy [Fri, 4 Sep 2020 22:11:58 +0000 (22:11 +0000)]
make spa_stats.c common

3 years agoAnother missed move
mmacy [Fri, 4 Sep 2020 21:55:35 +0000 (21:55 +0000)]
Another missed move

3 years agoRound TF_SIZE up to the stack alignment (16-bytes).
brooks [Fri, 4 Sep 2020 21:55:22 +0000 (21:55 +0000)]
Round TF_SIZE up to the stack alignment (16-bytes).

The kernel adjusts the stack by TF_SIZE and the RISC-V ABI requires
that it remain 16-byte aligned.

Reported by: CHERI, jrtc27
Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26328

3 years agoAdd missed move
mmacy [Fri, 4 Sep 2020 21:48:36 +0000 (21:48 +0000)]
Add missed move

3 years agoMaintain a stack alignment of 16-bytes.
brooks [Fri, 4 Sep 2020 21:46:10 +0000 (21:46 +0000)]
Maintain a stack alignment of 16-bytes.

This violated the RISC-V 64-bit ABI.  On CheriBSD this manifested as
a trap when attempting to store 16-byte aligned types while zeroing
the stack.

Reported by: CHERI, jrtc27
Reviewed by: mhorne, br
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26327

3 years agoUpdate vendor openzfs to fd20a8
mmacy [Fri, 4 Sep 2020 21:31:58 +0000 (21:31 +0000)]
Update vendor openzfs to fd20a8

3 years agotmpfs: drop spurious cache_purge in tmpfs_reclaim
mjg [Fri, 4 Sep 2020 19:30:15 +0000 (19:30 +0000)]
tmpfs: drop spurious cache_purge in tmpfs_reclaim

vgone already performs it.

3 years agoInitialize len to avoid ENOMEM from sysctl(3).
lwhsu [Fri, 4 Sep 2020 19:24:27 +0000 (19:24 +0000)]
Initialize len to avoid ENOMEM from sysctl(3).

PR: 248933
Sponsored by: The FreeBSD Foundation

3 years agoStop setting DEBUG_FLAGS in the zfs.ko Makefile.
markj [Fri, 4 Sep 2020 18:55:03 +0000 (18:55 +0000)]
Stop setting DEBUG_FLAGS in the zfs.ko Makefile.

Rely on system settings to decide whether or not to build with debug
symbols and extract them to a separate file.

Reported and tested by: rm

3 years agoumass: enhance debugging
bz [Fri, 4 Sep 2020 18:29:59 +0000 (18:29 +0000)]
umass: enhance debugging

Investigating a hang I found having some more error information
available would be helpful, so be more verbose and also tell cam/xpt
status in case of error/panic.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26287

3 years agoumass: fix a cam_sim leak in error case
bz [Fri, 4 Sep 2020 18:26:35 +0000 (18:26 +0000)]
umass: fix a cam_sim leak in error case

While debugging a hang I noticed that in case of error in
umass_cam_attach_sim() we miss a cam_sim_free() call.
Added that to not leak resources.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: D26287

3 years agocam_sim: harmonize code related to acquiring a mtx
bz [Fri, 4 Sep 2020 18:18:05 +0000 (18:18 +0000)]
cam_sim: harmonize code related to acquiring a mtx

cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
a mtx variable during declaration and then if NULL or the mtx is
held may re-asign the variable and/or acquire/release a lock.

Harmonize the code, avoiding double assignments and make it look
the same for all three function (with cam_sim_free() not needing
an extra case).

No functional changes intended.

Reviewed by: imp; no-objections by: mav
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26286

3 years agoice_ddp: Update package file to 1.3.16.0
erj [Fri, 4 Sep 2020 17:37:58 +0000 (17:37 +0000)]
ice_ddp: Update package file to 1.3.16.0

This package is intended to be used with ice(4) version 0.26.16. That
update will happen in a forthcoming commit.

MFC after: 3 days
Sponsored by: Intel Corporation

3 years agoktls: Check for a NULL send tag in ktls_cleanup()
gallatin [Fri, 4 Sep 2020 17:36:15 +0000 (17:36 +0000)]
ktls: Check for a NULL send tag in ktls_cleanup()

When using ifnet ktls, and when ktls_reset_send_tag()
fails to allocate a replacement tag, it leaves
the tls session's snd_tag pointer NULL. ktls_cleanup()
tries to release the send tag, and will trip over
this NULL pointer and panic unless NULL is checked for.

Reviewed by: jhb
Sponsored by: Netflix

3 years agofortune(6): Grammar fix for a hint on searching ports
gbe [Fri, 4 Sep 2020 13:05:00 +0000 (13:05 +0000)]
fortune(6): Grammar fix for a hint on searching ports

PR: 249078
Submitted by: PauAmma <pauamma at gundo dot com>
Reported by: PauAmma <pauamma at gundo dot com>
MFC after: 3 days

3 years agoFix kern_copyin test.
kib [Fri, 4 Sep 2020 12:52:16 +0000 (12:52 +0000)]
Fix kern_copyin test.

Main part is that kern_copyin on amd64 after LA57 should query the top
of UVA for correct operations. In fact it should started doing that
after the workaround for AMD bug with IRET in the last user page was
fixed by reducing UVA by a page.

Also since we started calculating top of UVA, fix MIPS according to
the comment.

Reported by: lwhsu
PR: 248933
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26312

3 years agoAvoid collisions with function names in openssl headers.
stevek [Fri, 4 Sep 2020 04:31:56 +0000 (04:31 +0000)]
Avoid collisions with function names in openssl headers.

Just using MD5, SHA1, RMD160 and SHA256 for defines collides with
functions of the same name in OpenSSL. This can cause compilation
issues in downstream consumers if they use OpenSSL for the hash
functions instead of libmd.

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D26321

3 years agoAdd emulation support for the Linux kcov(4) ioctl API.
markj [Fri, 4 Sep 2020 00:12:28 +0000 (00:12 +0000)]
Add emulation support for the Linux kcov(4) ioctl API.

This makes it possible to run an unmodified Linux syzkaller executor
against the Linuxulator, and have it gather code coverage information.

Sponsored by: The FreeBSD Foundation

3 years agoQuiet int-to-pointer-cast warnings on i386 with GCC 9.
jhb [Fri, 4 Sep 2020 00:11:01 +0000 (00:11 +0000)]
Quiet int-to-pointer-cast warnings on i386 with GCC 9.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26200

3 years agoRemove a duplicate declaration
mhorne [Thu, 3 Sep 2020 22:40:51 +0000 (22:40 +0000)]
Remove a duplicate declaration

This is already declared in sys/file.h, which is included directly.
Compiling with GCC9 emits an error.

Discussed with: rmacklem

3 years agoFix regression for IPv6 loopback routes.
melifaro [Thu, 3 Sep 2020 22:24:52 +0000 (22:24 +0000)]
Fix regression for IPv6 loopback routes.

After nexthop introduction, loopback routes for the interface addresses
 were created without embedding actual interface index in the gateway.
 The latter is needed to pass the IPv6 scope during transmission via loopback..

Fix the regression by actually using passed gateway data with interface index.

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

3 years agoAdd entries for the OID used for NFS-over-TLS "user@domain".
rmacklem [Thu, 3 Sep 2020 20:42:30 +0000 (20:42 +0000)]
Add entries for the OID used for NFS-over-TLS "user@domain".

The NFS-over-TLS server daemon (rpc.tlsservd) can optionally replace user
credentials in the RPC header with ones derived from a username specified
by the form "user@domain", if this exists in the client's X.509 v3 certificate.
Specifically, "user@domain" needs to be in the "otherName" component of
subjectjAltName, with a unique OID as assigned by this update.

This patch adds a subtree for the "otherName" component of subjectAltName in
X.509 v3 cerificates and a value for "user@domain" as used by NFS-over-TLS.

Reviewed by: phk, gordon
Differential Revision: https://reviews.freebsd.org/D26225

3 years agomac_framework.h: fix build with DEBUG_VFS_LOCKS and !MAC
avg [Thu, 3 Sep 2020 20:30:52 +0000 (20:30 +0000)]
mac_framework.h: fix build with DEBUG_VFS_LOCKS and !MAC

I have such a custom kernel configuration and its build failed with:
linking kernel.full
ld: error: undefined symbol: mac_vnode_assert_locked
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               tmpfs_vnops.o:(mac_vnode_check_stat)
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               vfs_default.o:(mac_vnode_check_stat)
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               ufs_vnops.o:(mac_vnode_check_stat)

3 years agoMerge commit f26fc568402f from llvm git (by me):
dim [Thu, 3 Sep 2020 18:34:01 +0000 (18:34 +0000)]
Merge commit f26fc568402f from llvm git (by me):

  Eliminate the sizing template parameter N from CoalescingBitVector

  Since the parameter is not used anywhere, and the default size of 16
  apparently causes PR47359, remove it. This ensures that IntervalMap
  will automatically determine the optimal size, using its NodeSizer
  struct.

  Reviewed By: dblaikie

  Differential Revision: https://reviews.llvm.org/D87044

This should fix 'Assertion failed: (Elements + Grow <= Nodes * Capacity
&& "Not enough room for elements"), function distribute, file
/usr/src/contrib/llvm-project/llvm/lib/Support/IntervalMap.cpp, line
123.' when building the x11-toolkits/py-wxPython40 port on a i386 host.

Reported by: zeising
MFC after: 6 weeks
X-MFC-With: r364284

3 years agoAdd a few more files to libllvm, which are required when doing sanitized
dim [Thu, 3 Sep 2020 18:27:13 +0000 (18:27 +0000)]
Add a few more files to libllvm, which are required when doing sanitized
builds, for example with -fsanitize=undefined.

MFC after: 6 weeks
X-MFC-With: r364284

3 years agoEnsure zpool-features(5) doesn't get removed by make delete-old.
dim [Thu, 3 Sep 2020 18:21:58 +0000 (18:21 +0000)]
Ensure zpool-features(5) doesn't get removed by make delete-old.

Apparently, somewhere in 2012 ZFS-on-FreeBSD moved it from section 5 to
7, but ZFS-on-Linux never did.

3 years agoarm64: update the set of HWCAP definitions
mhorne [Thu, 3 Sep 2020 17:07:58 +0000 (17:07 +0000)]
arm64: update the set of HWCAP definitions

This is in sync with what is defined for Linux 5.8. Note that all bits
in HWCAP are exhausted, and HWCAP2 has been added.

This also revealed an error in some of the existing definitions. We are
missing HWCAP_ASIMDHP, and as a result a portion of the HWCAP values are
shifted right by one bit. This will be fixed in an upcoming change, but
the values being added now are compatible with what Linux defines.

Reviewed by: emaste, markj, manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26030

3 years agoVarious fixes to the load() function.
jhb [Thu, 3 Sep 2020 14:50:15 +0000 (14:50 +0000)]
Various fixes to the load() function.

- Use getline() instead of fgetln().  This ensures the returned string
  is always null-terminated without losing the last character if the
  last line in a file doesn't have a newline.  Also, while fgetln says
  the returned buffer can be modified, that doesn't actually seem safe
  as the current implementation means you are modifying stdio's
  internal buffer.

- Remove a spurious if before an ATF_REQUIRE that was clearly supposed
  to be non-optional.

- Remove a pointless compare of 'ptr' against '\0' (really NULL) that
  duplicated the middle condition in the for().

- Once a comment is found, skip the rest of the line, not just the
  current word.

Reviewed by: kevans
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26278

3 years agoSwitch to an empty ttbr0 pagetable when the MMU is enabled
andrew [Thu, 3 Sep 2020 10:11:12 +0000 (10:11 +0000)]
Switch to an empty ttbr0 pagetable when the MMU is enabled

We don't need these pagetables after the early boot. Remove the chance we
write to memory we didn't expect to and remove architectural undefined
behaviour.

Reviewed by: alc (earlier version), mmel
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D22606

3 years agoTemporarily skip sbin.bectl.bectl_test.* i386 kernel in CI
lwhsu [Thu, 3 Sep 2020 08:16:57 +0000 (08:16 +0000)]
Temporarily skip sbin.bectl.bectl_test.* i386 kernel in CI

kldload zfs.ko on i386 hangs in CI

Sponsored by: The FreeBSD Foundation

3 years agomove defintion of hw.i2c sysctl node from iicbb to iicbus
avg [Thu, 3 Sep 2020 08:02:19 +0000 (08:02 +0000)]
move defintion of hw.i2c sysctl node from iicbb to iicbus

MFC after: 2 weeks

3 years agotwsi: no need to compare boolean with boolean constant
avg [Thu, 3 Sep 2020 08:01:21 +0000 (08:01 +0000)]
twsi: no need to compare boolean with boolean constant

Testing the boolean directly is shorter and more idiomatic.

MFC after: 1 week

3 years agotwsi: replace a couple of errno codes with i2c error codes
avg [Thu, 3 Sep 2020 07:42:53 +0000 (07:42 +0000)]
twsi: replace a couple of errno codes with i2c error codes

Reviewed by: manu
MFC after: 1 week

3 years agodrm2: Fix build after r365264
zeising [Thu, 3 Sep 2020 05:25:39 +0000 (05:25 +0000)]
drm2: Fix build after r365264

Fix the build after r365264, I forgot to exclude arm in one more place.

Reported by: rpokala
Approved by: manu (implicit, build fix)
MFC after: 3 days
X-MFC-With: 365264
Pointy-hat to: zeising

3 years agoAvoid issues with STAGING by using LIBUCL_DIR for the source directory
stevek [Thu, 3 Sep 2020 03:48:42 +0000 (03:48 +0000)]
Avoid issues with STAGING by using LIBUCL_DIR for the source directory
variable name instead of LIBUCL (which would otherwise end up with the
staging directory used instead of the wanted source directory.)

Reviewed by: sjg
Obtained from: Juniper Networks, Inc.

3 years agomgb: correct macro argument name
emaste [Thu, 3 Sep 2020 02:17:55 +0000 (02:17 +0000)]
mgb: correct macro argument name

mgb had a longstanding typo in function-like macro MGB_NEXT_RING_IDX's
argument, but the macro had no consumers.  r365061 introduced a use of
the macro, after which mgb failed to build.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoAlways report ENOSYS in init
brooks [Wed, 2 Sep 2020 23:17:33 +0000 (23:17 +0000)]
Always report ENOSYS in init

While rare, encountering an unimplemented system call early in init is
catastrophic and difficult to debug.  Even after a SIGSYS handler is
registered, such configurations are problematic.  As such, always report
such events for pid 1 (following kern.lognosys if non-zero).

Reviewed by: kevans, imp
Obtained from: CheriBSD (plus suggestions from kevans)
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26288

3 years agoFix the variable name passed to OF_getprop().
jhb [Wed, 2 Sep 2020 22:27:30 +0000 (22:27 +0000)]
Fix the variable name passed to OF_getprop().

Reported by: tinderbox

3 years agolibifconfig now depends on libm due to usage of log10().
jhb [Wed, 2 Sep 2020 22:10:08 +0000 (22:10 +0000)]
libifconfig now depends on libm due to usage of log10().

ld.bfd in particular requires -lm to come after libifconfig on the
command line when linking rescue.

Reviewed by: freqlabs, adrian
Differential Revision: https://reviews.freebsd.org/D26258

3 years agoPass a valid mode with O_CREATE to open(2).
jhb [Wed, 2 Sep 2020 21:17:54 +0000 (21:17 +0000)]
Pass a valid mode with O_CREATE to open(2).

CheriABI is pickier about the arguments to open(2) and crashes with a
fault if a mode isn't passed to an open() when O_CREATE is specified.

Reported by: CHERI
Reviewed by: brooks
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26281

3 years agoRemove risky compatability with old kernels
brooks [Wed, 2 Sep 2020 21:14:36 +0000 (21:14 +0000)]
Remove risky compatability with old kernels

The badsys() handler for SIGSYS was added as a transtion aid for kernels
lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
than running the risk of a privilege-dropping system call being silently
omitted.

This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
change the system security level".

Reviewed by: mckusick, imp, kevans
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26289

3 years agoDon't assume objects in program sections have a size of a pointer.
jhb [Wed, 2 Sep 2020 20:43:08 +0000 (20:43 +0000)]
Don't assume objects in program sections have a size of a pointer.

The size of the object at 'addr' is unknown and might be smaller than
the size of a pointer (e.g. some x86 instructions are smaller than a
pointer).  Instead, just check that the address is in the bounds of
the program header.

Reported by: CHERI (indirectly)
Reviewed by: kib, brooks
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26279

3 years agoCompute the correct size of the string to move forward.
jhb [Wed, 2 Sep 2020 20:04:26 +0000 (20:04 +0000)]
Compute the correct size of the string to move forward.

Previously this was counting the amount of spare room at the start of
the buffer that the string needed to move forward and passing that as
the number of bytes to copy to memmove rather than the length of the
string to be copied.

In the strfmon test in the test suite this caused the memmove to
overflow the allocated buffer by one byte which CHERI caught.

Reported by: CHERI
Reviewed by: kevans
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26280

3 years agoAvoid unnecessary object locking in vm_page_grab_pages_unlocked().
markj [Wed, 2 Sep 2020 19:59:25 +0000 (19:59 +0000)]
Avoid unnecessary object locking in vm_page_grab_pages_unlocked().

We were needlessly acquiring the object lock to call
vm_page_grab_pages() even when all of the requested pages were looked up
locklessly.  Fix that, stop testing for count == 0 in
vm_page_grab_pages(), and add assertions to help catch this kind of
mistake.

Reported by: cem
Reviewed by: alc, cem, dougm, jeff
Differential Revision: https://reviews.freebsd.org/D26304

3 years agoIn ltc430x(4), add the ability to configure control register 2 via FDT or
ian [Wed, 2 Sep 2020 19:37:47 +0000 (19:37 +0000)]
In ltc430x(4), add the ability to configure control register 2 via FDT or
hints data.  Control register 2 holds the settings a user might want to
configure, such as the timeout value for idle busses and whether to enable
the mass-writes feature.

Also add hint support for disconnecting idle busses (which was already
supported using FDT data).

Update the manpage with the new features, and also split the hints section
into separate lists of required and optional hints.

3 years agovfs: retire vholdl as a symbol
mjg [Wed, 2 Sep 2020 19:21:37 +0000 (19:21 +0000)]
vfs: retire vholdl as a symbol

Similarly to vrefl in r364283.

3 years agovfs: purge cache entries early on vgone
mjg [Wed, 2 Sep 2020 19:21:10 +0000 (19:21 +0000)]
vfs: purge cache entries early on vgone

There is no reason for them to linger across reclaim and it is an
invariant that doomed vnodes are not added to the namecache.

3 years agoTemporarily skip tests panic i386 kernel in CI
lwhsu [Wed, 2 Sep 2020 19:18:27 +0000 (19:18 +0000)]
Temporarily skip tests panic i386 kernel in CI

lib.libbe.be_create.libbe_create
sbin.bectl.bectl_test.bectl_create

PR: 249055
Sponsored by: The FreeBSD Foundation

3 years agoAdd sysctl(8) formatting for hw.pagesizes.
markj [Wed, 2 Sep 2020 18:17:08 +0000 (18:17 +0000)]
Add sysctl(8) formatting for hw.pagesizes.

- Change the type of hw.pagesizes to OPAQUE, since it returns an array.
- Modify the handler to only truncate the returned length if the caller
  supplied an output buffer.  This allows use of the trick of passing a
  NULL output buffer to fetch the output size, while preserving
  compatibility if MAXPAGESIZES is increased.
- Add a "S,pagesize" formatter to sysctl(8).

Reviewed by: alc, kib
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26239

3 years agoInclude the psind in data returned by mincore(2).
markj [Wed, 2 Sep 2020 18:16:43 +0000 (18:16 +0000)]
Include the psind in data returned by mincore(2).

Currently we use a single bit to indicate whether the virtual page is
part of a superpage.  To support a forthcoming implementation of
non-transparent 1GB superpages, it is useful to provide more detailed
information about large page sizes.

The change converts MINCORE_SUPER into a mask for MINCORE_PSIND(psind)
values, indicating a mapping of size psind, where psind is an index into
the pagesizes array returned by getpagesizes(3), which in turn comes
from the hw.pagesizes sysctl.  MINCORE_PSIND(1) is equal to the old
value of MINCORE_SUPER.

For now, two bits are used to record the page size, permitting values
of MAXPAGESIZES up to 4.

Reviewed by: alc, kib
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26238

3 years agokldstat(8): Add EXAMPLES to the man page
fernape [Wed, 2 Sep 2020 18:15:57 +0000 (18:15 +0000)]
kldstat(8): Add EXAMPLES to the man page

Add EXAMPLES for all the flags

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26283

3 years agoAdd the MEM_EXTRACT_PADDR ioctl to /dev/mem.
markj [Wed, 2 Sep 2020 18:12:47 +0000 (18:12 +0000)]
Add the MEM_EXTRACT_PADDR ioctl to /dev/mem.

This allows privileged userspace processes to find information about the
physical page backing a given mapping.  It is useful in applications
such as DPDK which perform some of their own memory management.

Reviewed by: kib, jhb (previous version)
MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D26237

3 years agodrm2: Further improve deprecation message
zeising [Wed, 2 Sep 2020 18:04:49 +0000 (18:04 +0000)]
drm2: Further improve deprecation message

Further improve the drm2 deprecation message, only displaying information
about the port for relevant architectures, and skipping the message
completely from arm, which uses some parts of drm2 still.

This is mostly intended to be merged to 12, since the base bits of drm2 on
FreeBSD 13 are only really used on arm.

Reviewed by: manu, mmel
Approved by: manu
MFC after: 3 days
X-MFC-with: r364737
Differential Revision: https://reviews.freebsd.org/D26275

3 years agoFix output of nfsstat -cE in json or xml mode
asomers [Wed, 2 Sep 2020 17:36:30 +0000 (17:36 +0000)]
Fix output of nfsstat -cE in json or xml mode

Due to a copy/paste error, the "getacl" field was duplicated, but only in
XML or JSON mode, not in txt mode.

Discussed with: rmacklem
MFC after: 1 week
Sponsored by: Axcient

3 years agoCorrect and expand on OpenZFS cache file and auto import
freqlabs [Wed, 2 Sep 2020 16:03:33 +0000 (16:03 +0000)]
Correct and expand on OpenZFS cache file and auto import

Reported by: avg
Sponsored by: iXsystems, Inc.

3 years agoFix a page table pages leak after LA57.
kib [Wed, 2 Sep 2020 15:55:16 +0000 (15:55 +0000)]
Fix a page table pages leak after LA57.

If the call to _pmap_allocpte() is not sleepable, it is possible that
allocation of PML4 or PDP page is successful but either PDP or PD page
is not.  Restructured code in _pmap_allocpte() leaves zero-referenced
page in the paging structure.

Handle it by checking refcount of the page one level above failed
alloc and free that page if its reference count is zero.

Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26293

3 years agoUse MLINKS where appropriate for zfs/zpool subcommand pages
freqlabs [Wed, 2 Sep 2020 15:20:10 +0000 (15:20 +0000)]
Use MLINKS where appropriate for zfs/zpool subcommand pages

Reported by: Julian H. Stacey
Sponsored by: iXsystems, Inc.

3 years agoAdd note about needing to manually import the zfs pools or update
imp [Wed, 2 Sep 2020 14:28:54 +0000 (14:28 +0000)]
Add note about needing to manually import the zfs pools or update
/etc/rc.d due to the cache file moving to /etc.

3 years agocaroot: properly remove old distrusted roots
kevans [Wed, 2 Sep 2020 12:57:34 +0000 (12:57 +0000)]
caroot: properly remove old distrusted roots

The proper procedure was not followed in r364943; all of these that were
deleted should have instead been moved over to the blacklist so that certctl
can DTRT.

Users must still `certctl rehash` after this, but this should generally be
done by one of mergemaster/etcupdate/freebsd-update/pkgbase already; note
that freebsd-update doesn't come into play for this particular update, as
these have not yet made it into a release.

Future work (after svn -> git) will likely change the script that updatecert
invokes to facilitate the process, rather than trusting that kevans or
whomever updates in the future will remember.

Reported by: Helge Oldach <freebsd oldach net>
MFC after: 3 days

3 years agoWhen CPUTYPE is an architecture name use -march
andrew [Wed, 2 Sep 2020 11:53:26 +0000 (11:53 +0000)]
When CPUTYPE is an architecture name use -march

Allow architecture names to be passed in to the build system via CPUTYPE.
This allows the user to use values such as armv8.1-a or armv8-a+crc as
the CPUTYPE.

Sponsored by: Innovate UK