Commit Graph

268591 Commits

Author SHA1 Message Date
Konstantin Belousov
1349891a0e Style
Reviewed by:	brooks, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31779
2021-09-17 15:41:54 +03:00
Mike Karels
fd0765933c Change lowest address on subnet (host 0) not to broadcast by default.
The address with a host part of all zeros was used as a broadcast long
ago, but the default has been all ones since 4.3BSD and RFC1122.  Until
now, we would broadcast the host zero address as well as the configured
address.  Change to not broadcasting that address by default, but add a
sysctl (net.inet.ip.broadcast_lowest) to re-enable it.  Note that the
correct way to use the zero address for broadcast would be to configure
it as the broadcast address for the network.

See https:/datatracker.ietf.org/doc/draft-schoen-intarea-lowest-address/
and the discussion in https://reviews.freebsd.org/D19316.  Note, Linux
now implements this.

Reviewed by:	rgrimes, tuexen; melifaro (previous version)
MFC after:	1 month
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D31861
2021-09-16 19:42:20 -05:00
Colin Percival
b43d7aa09b EC2: Default to UEFI booting
This reduces the FreeBSD boot time by approximately 5 seconds,
roughly equally divided betwenn two factors:
* Disk I/O is faster in the EFI loader since it can perform larger
I/Os.  (The BIOS loader is limited due to the use of bounce buffers
in sub-1M memory.)
* The EFI console is much faster than the VGA console.

Note however that not all EC2 instance types support UEFI; as a
general rule the newer instances (based on Amazon's "Nitro" platform)
support UEFI but the older instances (based on Xen) do not.

X-MFC:	TBD based on tradeoff between performance and compatibility
Relnotes:	yes
Sponsored by:	https://www.patreon.com/cperciva
2021-09-16 12:23:19 -07:00
Colin Percival
0aa2a94ea6 EC2: Allow AMI boot mode to be specified
The default boot method for amd64 AMIs is BIOS, but at AMI creation
time a flag can be set to specify that UEFI should be used instead.
This commit adds a variable AMIBOOTMETHOD which, if set to "UEFI",
causes the appropriate flag to be set during AMI creation.

The only boot method supported by EC2 for arm64 is UEFI.

The names of AMIs are also amended to include the boot method; they
now look like "FreeBSD 14.0-CURRENT-amd64-20210915 UEFI".

MFC after:	1 week
Sponsored by:	https://www.patreon.com/cperciva
2021-09-16 12:23:19 -07:00
Ed Maste
adb56e58e8 openssh: use global state for blacklist in grace_alarm_handler
Obtained from:	security/openssh-portable
Fixes:		19261079b7 ("openssh: update to OpenSSH v8.7p1")
Sponsored by:	The FreeBSD Foundation
2021-09-16 14:10:11 -04:00
Warner Losh
7cf62c68c0 nanobsd: Provide empty routines for new embedded scheme
calculate_partitioning and create_code_slice are now required in
nanobsd.sh. While things work with the ones provided by legacy.sh, it's
fighting embedded/common's other actions. Instead, replace them with
stubs.

Sponsored by:		Netflix
2021-09-16 11:54:18 -06:00
Konstantin Belousov
9a8eb5db55 test/ptrace/scescx.c: fix printing of braces for syscalls without args
Also do not print stray closing brace for error condition.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-09-16 20:26:18 +03:00
Konstantin Belousov
f575573ca5 Remove PT_GET_SC_ARGS_ALL
Reimplement bdf0f24bb1 by checking for the caller' ABI in
the implementation of PT_GET_SC_ARGS, and copying out everything if
it is Linuxolator.

Also fix a minor information leak: if PT_GET_SC_ARGS_ALL is done on the
thread reused after other process, it allows to read some number of that
thread last syscall arguments. Clear td_sa.args in thread_alloc().

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31968
2021-09-16 20:11:27 +03:00
Konstantin Belousov
181bfb42fd vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments
If phys_avail[] segment only intersect with some vm_phys segment, add
pages from it to the free list that belong to the given vm_phys_seg,
instead of dropping them.

The vm_phys segments are generally result of subdivision of phys_avail
segments, for instance DMA32 or LOWMEM boundaries split them. On
amd64, after UEFI in-place kernel activation (copy_staging disable)
was enabled, we typically have a large phys_avail[] segment below 4G
which crosses LOWMEM (1M) boundary. With the current way of requiring
phys_avail[] fully fit into vm_phys_seg, this memory was ignored.

Reported by:	madpilot
Reviewed by:	markj
Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31958
2021-09-16 20:01:19 +03:00
Marcin Wojtas
e8a8725360 pci_host_generic: update Synopsys device description for ACPI
The recent addition of Synopsys ECAM quirk set the
device description only for the DT variant.
Do the same in ACPI case.

Reported by: jrtc27
2021-09-16 16:53:11 +02:00
Artur Rojek
a3f0d18237 ena: fix building in-kernel driver
When building ENA as compiled into the kernel, the driver would fail to
build. Resolve the problem by introducing the following changes:
1. Add missing `ena_rss.c` entry in `sys/conf/files`.
2. Prevent SYSCTL_ADD_INT from throwing an assert due to an extra
CTLTYPE_INT flag.

Fixes: 986e7b9227 ("ena: Move RSS logic into its own source files")
Fixes: 6d1ef2abd3 ("ena: Implement full RSS reconfiguration")

Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week
2021-09-16 16:47:45 +02:00
Marko Zec
eb3148cc4d [fib algo][dxr] Fix division by zero.
A division by zero would occur if DXR would be activated on a vnet
with no IP addresses configured on any interfaces.

PR:		257965
MFC after:	3 days
Reported by:	Raul Munoz
2021-09-16 16:34:05 +02:00
Piotr Pawel Stefaniak
12061d2626 diff: link with libm for sqrt()
Reported by:	Jenkins
Fixes:		bcf2e78dc4
2021-09-16 09:31:44 +02:00
Peter Holm
bab406830a stress2: Added more unionfs tests 2021-09-16 06:29:07 +00:00
Rick Macklem
9ebe4b8c67 nfscl: Add vfs.nfs.maxalloclen to limit Allocate/Deallocate RPC RTT
Unlike Copy, the NFSv4.2 Allocate and Deallocate operations do not
allow a reply with partial completion.  As such, the only way to
limit the time the operation takes to provide a reasonable RPC RTT
is to limit the size of the allocation/deallocation in the NFSv4.2
client.

This patch adds a sysctl called vfs.nfs.maxalloclen to set
the limit on the size of the Allocate operation.
There is no way to know how long a server will take to do an
allocate operation, but 64Mbytes results in a reasonable
RPC RTT for the slow hardware I test on, so that is what
the default value for vfs.nfs.maxalloclen is set to.

For an 8Gbyte allocation, the elapsed time for doing it in 64Mbyte
chunks was the same as the elapsed time taken for a single large
allocation operation for a FreeBSD server with a UFS file system.

MFC after:	2 weeks
2021-09-15 17:29:45 -07:00
Piotr Pawel Stefaniak
e51aabf8cb diff: implement option -F (--show-function-line)
With unified and context diffs, show the last line that matches the
provided pattern before the context.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31714
2021-09-16 01:46:44 +02:00
Cameron Katri
f38702e5a5 diff(1): Add --color support
Adds a --color flag to diff(1) that supports the same options as GNU's
diff(1). The colors are customizable with the env var DIFFCOLORS in
a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41
for additions to be underlined light blue, and deletions have a red
background.

Differential Revision:	https://reviews.freebsd.org/D30545
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
7760b85414 diff: decrease indent level
An upcoming change will add more code in the loop.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
2171b2cbe0 diff: avoid applying offsets to null pointer
This was the only instance of undefined behavior I could find so far.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
bcf2e78dc4 diff: replace isqrt() with sqrt()
Remove cruft and use a system-provided and maintained function instead.
2021-09-16 01:46:43 +02:00
Piotr Pawel Stefaniak
e43df07e37 diff: move functions around and reduce their visibility
Most of them become static. There will be more such functions added in
upcoming commits, so they would be inconsistent with existing code.
Improve the existing code instead of reinforcing the unwanted pattern.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
b5541f456d diff: convert boolean flag variables to bool
There will be more boolean flags added in upcoming commits and they
would have to be stored in ints in order to be consistent with existing
code. Change the existing code to use the bool type.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
0358202111 diff: improve code style
Reflow comments, strip trailing space, improve wrapping of lines.
2021-09-16 01:36:41 +02:00
Kevin Bowling
22b20b45c9 e1000: Fix variable typo
Forgot to git add this in last commit

Reported by:	jenkins
Fixes:		2796f7cab1
MFC after:	2 week
2021-09-15 09:18:59 -07:00
Kevin Bowling
2796f7cab1 e1000: Fix up HW vlan ops
* Don't reset the entire adapter for vlan changes, fix up the problems
* Add some functions for vlan filter (vfta) manipulation
* Don't muck with the vfta if we aren't doing HW vlan filtering
* Disable interrupts when manipulating vfta on lem(4)-class NICs
* On the I350 there is a specification update (2.4.20) in which the
suggested workaround is to write to the vfta 10 times (if at first you
don't succeed, try, try again). Our shared code has the goods, use it
* Increase a VF's frame receive size in the case of vlans

From the referenced PR, this reduced vlan configuration from minutes
to seconds with hundreds or thousands of vlans and prevents wedging the
adapter with needless adapter reinitialization for each vlan ID.

PR:		230996
Reviewed by:	markj
Tested by:	Ozkan KIRIK <ozkan.kirik@gmail.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30002
2021-09-15 08:03:01 -07:00
Marko Zec
b51f8bae57 [fib algo][dxr] Optimize trie updating.
Don't rebuild in vain trie parts unaffected by accumulated incremental
RIB updates.

PR:		257965
Tested by:	Konrad Kreciwilk
MFC after:	3 days
2021-09-15 22:42:49 +02:00
Marko Zec
442c8a245e [fib algo][dxr] Fix undefined behavior.
The result of shifting uint32_t by 32 (or more) is undefined: fix it.
2021-09-15 22:42:48 +02:00
John Baldwin
0cd6e85e24 iscsi: Abort data-out tasks queued on a terminating session.
cfiscsi_datamove_out() can race with cfiscsi_session_terminate_tasks()
and enqueue a new task after the latter function has aborted existing
tasks.  This could result in a deadlock as
cfiscsi_session_terminate_tasks() waited forever for this task to
complete.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31892
2021-09-15 13:25:30 -07:00
John Baldwin
529364b032 iscsi: Add a helper routine to abort a data-out task.
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31891
2021-09-15 13:25:04 -07:00
Alan Somers
ff33e5c83f stress2: replace fuse.ko with fusefs.ko
It got renamed in FreeBSD 13

Reviewed by:	pho
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D31963
2021-09-15 12:59:21 -06:00
Leandro Lupori
a58abcde2c powerpc64: change CAS to support Radix MMU
Use radix_mmu environment variable to select between Hash or Radix
MMU, when performing the CAS method call. This matches kernel's
behavior, by selecting Hash MMU by default and Radix if radix_mmu
is not zero, to make sure that both loader and kernel always select
the same MMU.

The device tree is queried to detect Radix/GTSE support and to
find out if CAS is supported, making the old CPU version and HV
bit checks unnecessary now.

Reviewed by:		jhibbits
MFC after:		2 weeks
Sponsored by:		Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D31951
2021-09-15 15:24:40 -03:00
Emmanuel Vadot
78bf40e10c arm: rockchip: rk3288: Use the macros that already exists in rk_cru.h 2021-09-15 20:10:42 +02:00
Emmanuel Vadot
548a706608 arm64: rockchip: rk3328: Add watchdog clock
The watchdog clock is controlled by the secure world but we need a clock
to sastify the driver so add a fixed clock for it.

Reported by:   avg
2021-09-15 19:09:56 +02:00
Emmanuel Vadot
cc2f9bbbad arm64: rockchip: rk3328: Finish implementing clocks
This finish (almost) the clocks implementations for the RK3328 SoC.
The clocks are now correctly implemented respecting the clock hiearchy.
The missing clocks are mostly the DDR clocks, implementing those is only
useful for debugging as we will never set them in the kernel.
The ARMCLK still needs to be rewritten so it looks closer to how the
hardware is done.

Tested-on: Rock64
2021-09-15 18:43:10 +02:00
Emmanuel Vadot
deff1fb3dc arm64: rockchip: clk: Add MUXRAW macros
Some clocks in the RK3328 SoC (and possibly others) have registers not in
the CLKSEL_CON range. Add a macros for muxes which lives not in the range
of CLKSEL_CON which just takes a raw offset.
2021-09-15 18:43:07 +02:00
Emmanuel Vadot
731e418bd7 arm64: rockchip: clk_mux: Add support for mux in GRF type clock
Some clocks have their mux register in the GRF and not in the CRU.
Add support for that in the rk_clk_mux clock type.
2021-09-15 18:43:04 +02:00
Hans Petter Selasky
e3e7d95332 tcp: Avoid division by zero when KERN_TLS is enabled in tcp_account_for_send().
If the "len" variable is non-zero, we can assume that the sum of
"tp->t_snd_rxt_bytes + tp->t_sndbytes" is also non-zero.

It is also assumed that the 64-bit byte counters will never wrap around.

Differential Revision:	https://reviews.freebsd.org/D31959
Reviewed by:	gallatin, rrs and tuexen
Found by:	"I told you so", also called hselasky
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-09-15 18:05:31 +02:00
John Baldwin
857dc1c0ec arm64: Pass the right label to END() for handle_empty_exception.
GNU as reported an error for the argument to .size not being a constant.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31950
2021-09-15 09:03:18 -07:00
John Baldwin
8753039a8f arm64: Fix a logic bug in is_load_instr().
Logical and ('&&') was used to join two conditions instead of logical
or ('||') causing some store instructions to not be recognized.

Reported by:	GCC 9 -Wparentheses

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D31949
2021-09-15 09:03:18 -07:00
John Baldwin
d99c87c8d5 evdev: Add parentheses around '-' expression in operand of '&'.
This fixes a -Wparentheses error with GCC 9.

Reviewed by:	wulf
Differential Revision:	https://reviews.freebsd.org/D31947
2021-09-15 09:03:18 -07:00
John Baldwin
cd16a848d1 posixshmtest: Fix various warnings raised by GCC.
- Remove unused format string arguments.

- Remove a set but unused variable.

Reviewed by:	khng, kib
Differential Revision:	https://reviews.freebsd.org/D31946
2021-09-15 09:03:18 -07:00
John Baldwin
df005aa9b3 pf: Remove duplicate declaration of pf_ioctl_maxcount.
Fixes a -Wredundant-decls warning with GCC 9.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D31944
2021-09-15 09:03:18 -07:00
John Baldwin
44126818d2 infiniband: Disable -Wredundant-decl warnings.
ib_uverbs_flow_resources_free() is declard in two header files in
upstream OFED.  Disable the warning to avoid introducing diffs to fix
the build on GCC 9.

While here, fix the ibcore module to disable the same warnings
disabled in OFED_CFLAGS.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D31943
2021-09-15 09:03:18 -07:00
John Baldwin
9553c6af88 <linux/overflow.h>: Don't use __has_builtin().
GCC only added support for __has_builtin in GCC 10.  However, all
supported versions of GCC and clang include these builtins so just use
them unconditionally.

This fixes the build with GCC 9.

Reviewed by:	manu, hselasky, imp
Differential Revision:	https://reviews.freebsd.org/D31942
2021-09-15 09:03:17 -07:00
John Baldwin
b14cd3a833 efitable: Don't pass NULL as a format string to xo_err().
This fixes a -Wformat error reported by GCC 9.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31939
2021-09-15 09:03:17 -07:00
John Baldwin
4c9cb057bd top: Remove a duplicate extern declaration for show_args.
This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31937
2021-09-15 09:03:17 -07:00
John Baldwin
5ac4ac85ca Remove an always-true check.
This fixes a -Wtype-limits error from GCC 9.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31936
2021-09-15 09:03:17 -07:00
John Baldwin
11647befcb Only define sanitizer wrappers for unsized bus space operations once.
Previously, this was defining duplicate definitions for each size.

This fixes a redundant definition warning from GCC.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31966
2021-09-15 09:03:17 -07:00
John Baldwin
45cb767113 Only define sanitizer wrappers for atomic fences once.
Previously, this was defining duplicate definitions for each type.

This fixes a redundat definition warning from GCC.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31965
2021-09-15 09:03:17 -07:00
John Baldwin
d2bc7754a2 Assert that invalid bus widths can't be passed to bus_width_str().
This appeases a -Wreturn-type warning from GCC.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31935
2021-09-15 09:03:17 -07:00