Commit Graph

251593 Commits

Author SHA1 Message Date
Mitchell Horne
bd8f09eb49 Make efirt module dependent on MK_EFI
MK_EFI was added to kern.opts.mk in r331099, but is currently unused.
Take advantage of that fact and gate the build of efirt behind it.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D24673
2020-07-19 23:19:09 +00:00
Ian Lepore
d4fb0c0a56 The ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
flip them so that times in the 20:00:00 to 23:59:59 range read correctly.

Reported by:	Dr. Rolf Jansen <freebsd-rj@obsigna.com>
Pointy hat:	ian@
2020-07-19 18:53:19 +00:00
Konstantin Belousov
0675f4e1ca Simplify non-pti syscall entry on amd64.
Limit manipulations to use %rax as scratch to the pti portion of the
syscall entry code.

Submitted by:	alc
Reviewed by:	markj
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25722
2020-07-19 17:47:55 +00:00
Adrian Chadd
208b9eabb4 [if_an] unbreak!
.. I missed this when checking drivers.

Differential Revision:	https://reviews.freebsd.org/D25723
2020-07-19 17:27:48 +00:00
Adrian Chadd
78957abd9e [net80211] missing from last commit, le whoops
Differential Revision:https://reviews.freebsd.org/D25630
2020-07-19 16:07:51 +00:00
Adrian Chadd
f7d38a13a8 [net80211] Add new privileges; restrict what can be done in a jail.
Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.

+ VAP_MANAGE is everything but setting the MAC and creating a VAP.
+ VAP_SETMAC is setting the MAC address of the VAP.
  Typically you wouldn't want the jail to be able to modify this.
+ CREATE_VAP is to create a new VAP. Again, you don't want to be doing
  this in a jail, but this DOES stop being able to run some corner
  cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
  bit out later.

This allows me to run wpa_supplicant in a jail after transferring
a STA VAP into it. I unfortunately can't currently set the wlan
debugging inside the jail; that would be super useful!

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D25630
2020-07-19 15:16:27 +00:00
Allan Jude
4c0fab716a at(1): Markup environment variables with proper macros
Submitted by:	debdrup
Reported by:	0mp
Reviewed by:	imp
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25721
2020-07-19 14:42:13 +00:00
Michael Tuexen
8745f898c4 Add reference counts for inp/stcb/net when timers are running.
This avoids a use-after-free reported for the userland stack.
Thanks to Taylor Brandstetter for suggesting a patch for
the userland stack.

MFC after:		1 week
2020-07-19 12:34:19 +00:00
Edward Tomasz Napierala
aa75412146 Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25694
2020-07-19 12:25:03 +00:00
Edward Tomasz Napierala
55ec696d42 Add missing bitset(9) MLINKS.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25713
2020-07-19 12:22:32 +00:00
Alexander V. Chernikov
725871230d Temporarly revert r363319 to unbreak the build.
Reported by:	CI
Pointy hat to: melifaro
2020-07-19 10:53:15 +00:00
Alexander V. Chernikov
8cee15d9e4 Transition from rtrequest1_fib() to rib_action().
Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
to rib_action(). This is part of the new routing KPI.

Submitted by:	Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D25546
2020-07-19 09:29:27 +00:00
Toomas Soome
97dd57e66c loader: cstyle cleanup
No functional changes intended.

Sponsored by:	Netflix, Klara Inc.
2020-07-19 06:59:09 +00:00
Konstantin Belousov
3ec7e1695c amd64 pmap: microoptimize local shootdowns for PCID PTI configurations
When pmap operates in PTI mode, we must reload %cr3 on return to
userspace.  In non-PCID mode the reload always flushes all non-global
TLB entries and we take advantage of it by only invalidating the KPT
TLB entries (there is no cached UPT entries at all).

In PCID mode, we flush both KPT and UPT TLB explicitly, but we can
take advantage of the fact that PCID mode command to reload %cr3
includes a flag to flush/not flush target TLB.  In particular, we can
avoid the flush for UPT, instead record that load of pc_ucr3 into %cr3
on return to usermode should be flushing.  This is done by providing
either all-1s or ~CR3_PCID_MASK in pc_ucr3_load_mask.  The mask is
automatically reset to all-1s on return to usermode.

Similarly, we can avoid flushing UPT TLB on context switch, replacing
it by setting pc_ucr3_load_mask.  This unifies INVPCID and non-INVPCID
PTI ifunc, leaving only 4 cases instead of 6.  This trick is also
applicable both to the TLB shootdown IPI handlers, since handlers
interrupt the target thread.

But then we need to check pc_curpmap in handlers, and this would
reopen the same race for INVPCID machines as was fixed in r306350 for
non-INVPCID.  To not introduce the same bug, unconditionally do
spinlock_enter() in pmap_activate().

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D25483
2020-07-18 18:19:57 +00:00
Ruslan Bukin
08e99af305 o Move iommu_test_boundary() to sys/iommu.h
o Rename DMAR -> IOMMU in comments
o Add IOMMU_PAGE_SIZE / IOMMU_PAGE_MASK macroses
o x86 only: dmar_quirks_pre_use() / dmar_instantiate_rmrr_ctxs()

Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25665
2020-07-18 13:10:31 +00:00
Michael Tuexen
05bceec68e Remove code which is not needed.
MFC after:		1 week
2020-07-18 13:10:02 +00:00
Kristof Provost
93ed6ade6e bridge: Don't sleep during epoch
While it doesn't trigger INVARIANTS or WITNESS on head it does in stable/12.
There's also no reason for it, as we can easily report the out of memory error
to the caller (i.e. userspace). All of these can already fail.

PR:		248046
MFC after:	3 days
2020-07-18 12:43:11 +00:00
Edward Tomasz Napierala
d5c5b4b382 Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
as documented in the man page.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-07-18 12:21:08 +00:00
Edward Tomasz Napierala
eb6ae7576d Bump the default linux version from 3.2.0 to 3.10.0, which corresponds
to RHEL 7.  Required for DB2.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25656
2020-07-18 11:37:30 +00:00
Edward Tomasz Napierala
3e9a214260 Regen after r363304.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2020-07-18 11:31:31 +00:00
Edward Tomasz Napierala
8d1d017175 Add a trivial linux(4) splice(2) implementation, which simply
returns EINVAL.  Fixes grep (grep-3.1-2build1).

PR:		kern/218699
Reported by:	avos
Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25636
2020-07-18 11:28:40 +00:00
Edward Tomasz Napierala
978ffef22f Add missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l',
and also helps Oracle.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25669
2020-07-18 10:56:04 +00:00
Edward Tomasz Napierala
7ce051e799 Fix bogomips calculation. Previously it was off by half. This was
verified under VMWare Fusion, comparing to what's reported under CentOS,
and by comparing numbers reported by linuxulator on T420 with a googled
up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116).

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20693
2020-07-18 10:53:56 +00:00
Edward Tomasz Napierala
8ba7dddd6f Fix two typos in flag names in /proc/cpuinfo.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25695
2020-07-18 10:49:17 +00:00
Jung-uk Kim
61b180362a MFV: r363292
Merge ACPICA 20200717.
2020-07-18 07:35:34 +00:00
Mateusz Guzik
7cd4443fb1 Short-circuit tdfind when looking for the calling thread.
Common occurence with cpuset and other places.
2020-07-18 00:14:43 +00:00
Chuck Silvers
1bd12a3bb2 Fix vnode_pager handling of read ahead/behind pages when a disk read fails.
Rather than marking the read ahead/behind pages valid even though they were
not initialized, free them using the new function vm_page_free_invalid().

Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:10:35 +00:00
Chuck Silvers
4dfa06e114 Add a new function vm_page_free_invalid() for freeing invalid pages
that might be wired.  If the page is wired then it cannot be freed now,
but the thread that eventually unwires it will free it at that point.

Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:09:36 +00:00
Chuck Silvers
c3dbadc1fd Revert my change from r361855 in favor of a better fix.
Reviewed by:	markj, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D25430
2020-07-17 23:08:01 +00:00
Jung-uk Kim
b1dc29fa09 Import ACPICA 20200717. 2020-07-17 22:53:36 +00:00
Gordon Bergling
d8fd37e1e1 devstat(9): Update the man page to reflect the current implementation
- Rename devstat_add_entry to devstat_new_entry
- Update the description of devstat_trans_flags
- Add manpage aliases for devstat_start_transaction_bio and devstat_end_transaction_bio

PR:		157316
Submitted by:	novel
Reviewed by:	cem, bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25677
2020-07-17 22:15:02 +00:00
Gordon Bergling
d511702b8d mount_nfs(8): document alternate form of the gssname option
PR:		238506
Submitted by:	Greg Veldman <freebsd at gregv dot net>
Reviewed by:	0mp, bcr (mentor)
Approved by:	bcr (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25667
2020-07-17 21:55:24 +00:00
Gordon Bergling
0550be0273 iwm(4): Document limitations of the driver
Document that iwm(4) currently doesn't support 802.11n and 802.11ac.

PR:		247874
Submitted by:	Charles Ross <cwr at sdf dot org>
Reviewed by:	brueffer, markj
Approved by:	brueffer
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25666
2020-07-17 21:47:06 +00:00
Allan Jude
f4cf731d1a at(1): Fix location of at(1) crontab
With r318443, atrun was moved from /etc/crontab to /etc/cron.d/at,
but the man-page was unfortunately not updated to reflect this.

PR:		248048
Submitted by:	debdrup
Reported by:	yoitsmeremember+fbsd at gmail.com
Reviewed by:	Pau Amma <pauamma at gundo.com>
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25709
2020-07-17 20:43:00 +00:00
Cy Schubert
4fbd491ee3 Fix incorrect byte order in ipfstat -f output.
- make sure frag is initialized to 0
- initialize ipfr_p field

NetBSD PR:	55137
Submitted by:	christos@NetBSD.org
Reported by:	christos@NetBSD.org
Obtained from:	NetBSD fil.c r1.32, ip_frag.c r1.8
MFC after:	2 weeks
2020-07-17 19:07:59 +00:00
Cy Schubert
1b5e9f7d1e pfil_run_hooks() can be called recursively, so we have to
define FASTROUTE_RECURSION in fil.c

Submitted by:	christos@NetBSD.org
Reported by:	christos@NetBSD.org
Obtained from:	NetBSD r1.31
MFC after:	2 weeks
2020-07-17 19:07:56 +00:00
Cy Schubert
64a1886d5c -4 and -6 only make sense with -i, -o, and -t.
PR:		247952
MFC after:	1 week
2020-07-17 19:07:53 +00:00
Cy Schubert
ebdefe6cb4 The output from usage() need not contain usage for -t when STATETOP
is not compiled in.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:50 +00:00
Cy Schubert
e082c89385 Make ipfstat -t header generic when IPv4 and IPv6 output are
displayed in the same display.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:47 +00:00
Cy Schubert
08c24e2f88 ipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i
and ipfstat -o where without an argument IPv4 and IPv6 states are
shown. Use -4 and -6 to limit the display to IPv4 or IPv6 respectively.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:44 +00:00
Cy Schubert
88b86bb0f3 Historically ipfstat listings and stats only listed IPv4 or IPv6 output.
ipfstat would list IPv4 outputs by default while -6 would produce IPv6
outputs. This commit combines the ipfstat -i and -o outputs into one
listing of IPv4 and IPv6 rules. The -4 option lists only IPv4 rules
(as the default before) while -6 continues to list only rules that affect
IPv6.

PR:		247952
Reported by:	joeb1@a1poweruser.com
MFC after:	1 week
2020-07-17 19:07:40 +00:00
Cy Schubert
5317660176 fr_family (the protocol family) must be AF_INET or AF_INET6, as in
the kernel, not an arbitrary 4 or 6.

This only affected printing ipfilter stats and rules from a kernel
dump. (This is currently undocumented.)

PR:		247952
MFC after:	1 week
2020-07-17 19:07:37 +00:00
Cy Schubert
ce1c2aafce Only use the use_inet6 variable when INET6 is a build option.
This is a prerequisite to upcoming argument processing cleanups which
will resolve consistency as was done with ippool previously.

PR:		247952
MFC after:	1 week
2020-07-17 19:07:34 +00:00
Takanori Watanabe
b8c46d561e Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU.
ACL packet boundary flag should be 0 instead of 2 for LE PDU.
Some HCI will drop LE packet with PB flag is 2, and if sent,
some target may reject the packet.

PR:	248024
Reported by:	Greg V
Reviewed by:	Greg V, emax
Differential Revision:	https://reviews.freebsd.org/D25704
2020-07-17 15:50:03 +00:00
Michael Tuexen
7f0ad2274b Improve the locking of address lists by adding some asserts and
rearranging the addition of address such that the lock is not
given up during checking and adding.

MFC after:		1 week
2020-07-17 15:09:49 +00:00
Ruslan Bukin
f3856e6881 Add acpi_iort_map_pci_smmuv3().
This new function allows us to find the SMMU instance assigned
for a particular PCI RID.

Reviewed by:	andrew
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D25687
2020-07-17 14:51:51 +00:00
Mark Johnston
e5587cbbc2 Clean up crypto_init().
The function is called from a KLD load handler, so it may sleep.

- Stop checking for errors from uma_zcreate(), they don't happen.
- Convert M_NOWAIT allocations to M_WAITOK.
- Remove error handling for existing M_WAITOK allocations.
- Fix style.

Reviewed by:	cem, delphij, jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25696
2020-07-17 14:45:16 +00:00
Andrew Turner
256c5d705a Don't overflow the trap frame when accessing lr or xzr.
When emulating a load pair or store pair in dtrace on arm64 we need to
copy the data between the stack and trap frame. When the registers are
either the link register or the zero register we will access memory
past the end of the trap frame as these are encoded as registers 30 and
31 respectively while the array they access only has 30 entries.

Fix this by creating 2 helper functions to perform the operation with
special cases for these registers.

Sponsored by:	Innovate UK
2020-07-17 14:39:07 +00:00
Piotr Pawel Stefaniak
c6a2e9a7ae Promote use of unprivileged users for building ports by documenting SU_CMD.
Phrasing by Daniel O'Connor.

Reviewed by:	0mp
MFC after:	14 days
Differential Revision:	https://reviews.freebsd.org/D25433
2020-07-17 06:33:20 +00:00
Conrad Meyer
4ae224c663 Revert r240317 to prevent leaking pmap entries
Subsequent to r240317, kmem_free() was replaced with kva_free() (r254025).
kva_free() releases the KVA allocation for the mapped region, but no longer
clears the pmap (pagetable) entries.

An affected pmap_unmapdev operation would leave the still-pmap'd VA space
free for allocation by other KVA consumers.  However, this bug easily
avoided notice for ~7 years because most devices (1) never call
pmap_unmapdev and (2) on amd64, mostly fit within the DMAP and do not need
KVA allocations.  Other affected arch are less popular: i386, MIPS, and
PowerPC.  Arm64, arm32, and riscv are not affected.

Reported by:	Don Morris <dgmorris AT earthlink.net>
Submitted by:	Don Morris (amd64 part)
Reviewed by:	kib, markj, Don (!amd64 parts)
MFC after:	I don't intend to, but you might want to
Sponsored by:	Dell Isilon
Differential Revision:	https://reviews.freebsd.org/D25689
2020-07-16 23:29:26 +00:00