Commit Graph

253309 Commits

Author SHA1 Message Date
Brandon Bergren
b75abea4d0 [PowerPC64LE] Set up powerpc.powerpc64le architecture
This is the initial set up for PowerPC64LE.

The current plan is for this arch to remain experimental for FreeBSD 13.

This started as a weekend learning project for me and kinda snowballed from
there.

(More to follow momentarily.)

Reviewed by:	imp (earlier version), emaste
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D26399
2020-09-22 23:49:30 +00:00
Konstantin Belousov
2be2e7e549 Remove stray line 2020-09-22 23:39:14 +00:00
Konstantin Belousov
b82149116a amd64 pmap: More unification for psind = 1 vs 2 in pmap_enter_largepage().
Move
  pkru check
  wait for page alloc
  wire accounting update
  asserting allowed updates for valid mappings
out of psind conditions.

Also add assert that psind references supported page size.
Remove not true comment.
Avoid uneccessary page table walks from top level.

Reviewed by:	alc, markj (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26513
2020-09-22 23:28:06 +00:00
Brandon Bergren
0ebbda9718 Tweak ficl definition from r365724
I had overthought how to do the FICL_TRUE change. We do not need to
explicitly specify how big the 0 is before the cast to the correct size.

The same change was suggested by both imp@ and Gunther Nikl independently.

Tested on powerpc.

Reported by:	imp, Gunther Nikl
2020-09-22 23:27:09 +00:00
Warner Losh
6b1d211602 Add devctl_notify(9) man page
Document the calls to send messages to userland via devctl.
devctl_notify will create a message for the specified system,
subsystem and type, optionally adding additional information.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D26520
2020-09-22 23:02:01 +00:00
Warner Losh
a5dca7c7e4 Document quoting requirements for the devctl protocol
Belatedly document the quoting requirements for the devctl protocol. I
thought they'd been previously documented.

Also, while I'm here, make igor happy.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D26520
2020-09-22 23:01:57 +00:00
Warner Losh
c6d67028c7 Document devctl_safe_quote_sb
This routine centralizes the knowledge needed for properly quoting
'value' in all key="value" items that appear in devctl messages.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D26520
2020-09-22 23:01:53 +00:00
Warner Losh
a329c23eb7 Add a devctl_process_running man page.
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D26520
2020-09-22 23:01:44 +00:00
Konstantin Belousov
1f305be431 Document {O,AT}_RESOLVE_BENEATH and new O_BENEATH behavior for relative paths.
PR:	248335
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:54:54 +00:00
Konstantin Belousov
1317da4349 Add O_RESOLVE_BENEATH and AT_RESOLVE_BENEATH to mimic Linux' RESOLVE_BENEATH.
It is like O_BENEATH, but disables to walk out of the subtree rooted
in the starting directory. O_BENEATH does not care if path walks out
if it returned.

Requested by:	Dan Gohman <dev@sunfishcode.online>
PR:	248335
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:48:12 +00:00
Konstantin Belousov
6a9c72d901 Change O_BENEATH to handle relative paths same as absolute.
Do not care if path walks out of the topping directory if it returns back.

Requested and reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:43:32 +00:00
Konstantin Belousov
07e7ad2b98 Only clear latch for BENEATH when we walk out of the startdir,
not unconditionally on any dotdot component.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:36:02 +00:00
Konstantin Belousov
4a0b316d2a Add open2nameif()
the helper to calculate namei flags both for open(2) and creat(2).

Suggested and reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:23:58 +00:00
Konstantin Belousov
861f039df1 Add at2cnpflags()
the helper to convert AT_ flags for *at() syscalls to namei flags.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:22:29 +00:00
Konstantin Belousov
c7de3d6f0b Add NIRES_STRICTREL.
Stop abusing internal namei flag NI_LCF_STRICTRELATIVE as indicator of
cap-restricted lookup.  Add designated returned flag NIRES_STRICTREL
to inform kern_openat() that lookup was restricted.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 22:06:20 +00:00
Konstantin Belousov
f9e46c9bf1 lookup: Track last lookup component if it is directory.
This makes open("/a/../a", O_BENEATH) with cwd == "/a" work.

Reviewed by:	markj
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 21:59:18 +00:00
Konstantin Belousov
44619a5e86 Improve comment above nameicap_check_dotdot().
Explain why tracker is needed at all.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D25886
2020-09-22 21:54:30 +00:00
Christian Brueffer
d458747eb2 Fix a bunch of mdoc issues found by mandoc -Tlint. 2020-09-22 21:13:26 +00:00
Vincenzo Maffione
92c5d82c86 libnetmap: fix cast from uint64_t to void*
We use uintptr_t as an intermediate cast to avoid compiler
warnings on 32 bit architectures.

Reported by:	adrian
MFC after:	3 days
2020-09-22 20:20:43 +00:00
Mark Johnston
8e13d6dfb6 udf: Validate the full file entry length
Otherwise a corrupted file entry containing invalid extended attribute
lengths or allocation descriptor lengths can trigger an overflow when
the file entry is loaded.

admbug:		965
PR:		248613
Reported by:	C Turt <ecturt@gmail.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-09-22 17:05:01 +00:00
Jung-uk Kim
58f351825a Merge OpenSSL 1.1.1h. 2020-09-22 16:18:31 +00:00
Mark Johnston
3c0c1e01c9 ftpd: Add missing braces around a statfd check
This was harmless but looked incorrect.  No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-09-22 15:54:18 +00:00
Mark Johnston
0aabff2880 tftpd: Check for errors from chdir()
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-09-22 15:54:05 +00:00
Jung-uk Kim
92f02b3b0f Import OpenSSL 1.1.1h. 2020-09-22 14:27:08 +00:00
Mitchell Horne
3994f5bc18 RISC-V: build SiFive drivers and DTB in GENERIC
In the spirit of the GENERIC config, we should include the drivers required to
run on most supported platforms.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D26501
2020-09-22 13:00:02 +00:00
Navdeep Parhar
30e3f2b4ea cxgbe(4): let the PF driver use VM work requests for transmit.
This allows the PF interfaces to communicate with the VF interfaces over
the internal switch in the ASIC.  Fix the GL limits for VM work requests
while here.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-09-22 04:16:40 +00:00
Kirk McKusick
54fab0fbc4 Add missing cylinder group check-hash updates when doing large expansions
of filesystems.

Reported by:  Colin Percival (cperciva@)
Tested by:    Colin Percival (cperciva@)
MFC after:    3 days
Sponsored by: Netflix
2020-09-22 03:57:48 +00:00
Navdeep Parhar
7054f6ec97 cxgbe(4): add counters for mbuf pullups and defrags.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-09-22 03:06:36 +00:00
Greg Lehey
02d18aea06 Remove claim that Allied Forces created "West Germany" in 1953. I can
find no historic substantiation for such a claim.  The Federal
Republic of Germany was created by Germans on 23 May 1949, as also
noted in this file.
2020-09-21 22:55:51 +00:00
D Scott Phillips
987eabdc2a stand/reloc_elf: Handle relative relocations for arm{,64} and riscv
Extend the powerpc relative relocation handling from r240782 to a
handful of other architectures.  This is needed to properly read
dependency information from kernel modules.

Reviewed by:	jhb
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26365
2020-09-21 22:24:46 +00:00
D Scott Phillips
de03184698 arm64/pmap: Sparsify pv_table
Reviewed by:	markj, kib
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26132
2020-09-21 22:23:57 +00:00
D Scott Phillips
7988971a99 vm_reserv: Sparsify the vm_reserv_array when VM_PHYSSEG_SPARSE
On an Ampere Altra system, the physical memory is populated
sparsely within the physical address space, with only about 0.4%
of physical addresses backed by RAM in the range [0, last_pa].

This is causing the vm_reserv_array to be over-sized by a few
orders of magnitude, wasting roughly 5 GiB on a system with
256 GiB of RAM.

The sparse allocation of vm_reserv_array is controlled by defining
VM_PHYSSEG_SPARSE, with the dense allocation still remaining for
platforms with VM_PHYSSEG_DENSE.

Reviewed by:	markj, alc, kib
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26130
2020-09-21 22:22:53 +00:00
D Scott Phillips
00e6614750 Sparsify the vm_page_dump bitmap
On Ampere Altra systems, the sparse population of RAM within the
physical address space causes the vm_page_dump bitmap to be much
larger than necessary, increasing the size from ~8 Mib to > 2 Gib
(and overflowing `int` for the size).

Changing the page dump bitmap also changes the minidump file
format, so changes are also necessary in libkvm.

Reviewed by:	jhb
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26131
2020-09-21 22:21:59 +00:00
D Scott Phillips
ab041f713a Move vm_page_dump bitset array definition to MI code
These definitions were repeated by all architectures, with small
variations. Consolidate the common definitons in machine
independent code and use bitset(9) macros for manipulation. Many
opportunities for deduplication remain in the machine dependent
minidump logic. The only intended functional change is increasing
the bit index type to vm_pindex_t, allowing the indexing of pages
with address of 8 TiB and greater.

Reviewed by:	kib, markj
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26129
2020-09-21 22:20:37 +00:00
Mark Johnston
a9cf0eebb3 Weaken assertions in pmap_l1_to_l2() and pmap_l2_to_l3().
pmap_update_entry() will temporarily clear the valid bit of page table
entries in order to satisfy the arm64 pmap's break-before-make
constraint.  pmap_kextract() may operate concurrently on kernel page
table pages, introducing windows where the assertions added in r365879
may fail incorrectly since they implicitly assert that the valid bit is
set.  Modify the assertions to handle this.

Reviewed by:	andrew, mmel (previous version)
Reviewed by:	alc, kib
Reported by:	mmel, scottph
MFC with:	r365879
2020-09-21 22:19:21 +00:00
D Scott Phillips
26a3bf76c9 bitset: expand bit index type to long
An upcoming patch to use the bitset macros for tracking vm page
dump information could conceivably need more than INT_MAX bits.
Expand the bit type to long so that the extra range is available
on 64-bit platforms where it would most likely be needed.

CPUSET_COUNT and DOMAINSET_COUNT are also modified to remain of
type `int`.

Reviewed by:	kib, markj
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26190
2020-09-21 22:19:12 +00:00
D Scott Phillips
191dad8b0a vchi: rename bitset macros to avoid collision with bitset(9)
An upcoming change to include bitset(9) macros from vm_page.h
causes a macro name collision with vchi's custom bitset macros.

This change was performed mechanically by:

  sed -i .orig s/BITSET/VCHI_BITSET/g $(grep -rl BITSET sys/contrib/vchiq)

Reviewed by:	andrew
Approved by:	scottl (implicit)
MFC after:	1 week
Sponsored by:	Ampere Computing, Inc.
Differential Revision:	https://reviews.freebsd.org/D26177
2020-09-21 22:18:09 +00:00
Alexander V. Chernikov
2259a03020 Rework part of routing code to reduce difference to D26449.
* Split rt_setmetrics into get_info_weight() and rt_set_expire_info(),
 as these two can be applied at different entities and at different times.
* Start filling route weight in route change notifications
* Pass flowid to UDP/raw IP route lookups
* Rework nd6_subscription_cb() and sysctl_dumpentry() to prepare for the fact
 that rtentry can contain multiple nexthops.

Differential Revision:	https://reviews.freebsd.org/D26497
2020-09-21 20:02:26 +00:00
Kyle Evans
7b3286c189 bsdbox: fix build after recent libifconfig changes
libifconfig now generates file(s) into its .OBJDIR that are essential to the
build. Make sure we -I that in, like we already do in the ^/rescue build.
2020-09-21 19:50:39 +00:00
Alex Richardson
335770ac08 mkcsmapper: Fix UBSan signed shift error
usr.bin/mkcsmapper/yacc.y:466:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
2020-09-21 19:03:17 +00:00
Alex Richardson
1116946093 Fix another UBSan error in awk
This applies my upstreamed fix: ad9bd2f40a
Found By:	UBSan
2020-09-21 19:03:12 +00:00
Alex Richardson
ae692c42cb awk: Fix subobject out-of-bounds access
When matching a regex with ^, it would attempt to access
gototab[NSTATES][NCHARS+2], and therefore access the state for the \002
character instead. This change is required to run awk under CHERI (with
sub-object bounds) and when running with UBSan instrumentation.

This was committed upstream as cbf924342b

Found by:	CHERI (with subobject bounds enabled)
Obtained from:	CheriBSD
Reviewed By:	imp
Differential Revision: https://reviews.freebsd.org/D26509
2020-09-21 19:03:07 +00:00
David Bright
52664466c7 Whitespace fix after r365948
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2020-09-21 18:34:13 +00:00
Hans Petter Selasky
8463bd8a77 Add support for Winbond USB CDC modem device found in Tenma power supply.
PR:		249384
MFC after:	1 week
Submitted by:	darius@dons.net.au
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-09-21 18:32:57 +00:00
Hans Petter Selasky
81a9354828 Add example to ng_bpf(4) showing how ng_bpf(4) can be used to prevent spoofing.
Differential Revision:	https://reviews.freebsd.org/D26488
MFC after:	1 week
Reviewed by:	pi, bcr (manpages)
Submitted by:	lutz_donnerhacke.de (Lutz Donnerhacke)
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-09-21 18:17:01 +00:00
Adrian Chadd
0dcdda0984 [rcorder] [crunch] Fix C function declarations to include void
This fixes a compile issue under gcc6 which complains about
legacy style C function declarations.

Differential Revision:	https://reviews.freebsd.org/D26504
2020-09-21 17:59:45 +00:00
Alan Somers
34e0b83ccb fsx: fix build with WARNS=6
* signed/unsigned comparisons
* use standard warn(3)
* Suppress warnings about local vars and funcs not declared static
* const-correctness
* declaration shadows a variable in the global scope

Reviewed by:	kevans
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26516
2020-09-21 17:48:28 +00:00
Mitchell Horne
45f6508149 Hide tunable definitions behind _KERNEL
Some userspace code include sys/kernel.h. Namely, some OpenZFS tests do
this, and it was causing breakage after r365945 due to a lack of bool
typedef. Userspace should not need the TUNABLE_** stuff, so hide it
behind an #ifdef _KERNEL.

Sorry for the breakage.

Reported by:	andrew, Michael Butler, Jenkins
Discussed with: kevans, allanjude
2020-09-21 17:28:41 +00:00
Kyle Evans
dc94083273 xargs: add some long options for GNU compatibility
These are low-effort to add, so let's just do it.

Reported by:	"LukeShu" on Hacker News (-r / --no-run-if-empty)
MFC after:	1 week
2020-09-21 17:06:36 +00:00
Poul-Henning Kamp
895a7e604d Pull in fix from upstream NetBSD rev. 1.5:
If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
    return that which poor behavior for the user, so return 0 instead.
    We could document ~0 to be an error, but that would deviate from the
    Linux behavior which is not desirable. Noted by Poul-Henning Kamp

PR:		209842
2020-09-21 16:43:38 +00:00