]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agostand: Minor cleanup
Alfonso [Mon, 27 Feb 2023 23:19:54 +0000 (16:19 -0700)]
stand: Minor cleanup

Replace a cast '0' for a null pointers with NULL
Replace a 'goto loop' with a do-while loop in ufs and ext2fs.
Cast cp pointer to uintptr_t to test to see if it's aligned rather than long.

[ minor tweaks based on my & hps' review, reworded commit message ]
Reviewed by: imp, hps
Pull Request: https://github.com/freebsd/freebsd-src/pull/547

17 months agoreport full error string on SSL_connect() failure
Vladimir Kotal [Mon, 27 Feb 2023 23:07:27 +0000 (16:07 -0700)]
report full error string on SSL_connect() failure

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/575

17 months agoif_re: Generate an address if there is none in the EEPROM
Evgeni Golov [Mon, 27 Feb 2023 22:50:56 +0000 (15:50 -0700)]
if_re: Generate an address if there is none in the EEPROM

There exists hardware that has no ethernet address burned into
the EEPROM. Loading if_re on such a HW brings the device up
with '00:00:00:00:00:00' as the address, and that doesn't get
you too far in a real network.

PR: 262406
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/670
Signed-off-by: Evgeni Golov <evgeni@debian.org>
Differential Revision: https://reviews.freebsd.org/D34485

17 months agopps: Round to closest integer in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:10 +0000 (14:49 -0700)]
pps: Round to closest integer in pps_event()

The comment above bintime2timespec() says:

  When converting between timestamps on parallel timescales of differing
  resolutions it is historical and scientific practice to round down.

However, the delta_nsec value is a time difference and not a timestamp.  Also
the rounding errors accumulate in the frequency accumulator, see hardpps().
So, rounding to the closest integer is probably slightly better.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agopps: Simplify the nsec calculation in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Simplify the nsec calculation in pps_event()

Let A be the current calculation of the frequency accumulator (pps_fcount)
update in pps_event()

  scale = (uint64_t)1 << 63;
  scale /= captc->tc_frequency;
  scale *= 2;
  bt.sec = 0;
  bt.frac = 0;
  bintime_addx(&bt, scale * tcount);
  bintime2timespec(&bt, &ts);
  hardpps(tsp, ts.tv_nsec + 1000000000 * ts.tv_sec);

and hardpps(..., delta_nsec):

  u_nsec = delta_nsec;
  if (u_nsec > (NANOSECOND >> 1))
          u_nsec -= NANOSECOND;
  else if (u_nsec < -(NANOSECOND >> 1))
          u_nsec += NANOSECOND;
  pps_fcount += u_nsec;

This change introduces a new calculation which is slightly simpler and more
straight forward.  Name it B.

Consider the following sample values with a tcount of 2000000100 and a
tc_frequency of 2000000000 (2GHz).

For A, the scale is 9223372036.  Then scale * tcount is 18446744994337203600
which is larger than UINT64_MAX (= 18446744073709551615).  The result is
920627651984 == 18446744994337203600 % UINT64_MAX.  Since all operands are
unsigned the result is well defined through modulo arithmetic.  The result of
bintime2timespec(&bt, &ts) is 49.  This is equal to the correct result
1000000049 % NANOSECOND.

In hardpps(), both conditional statements are not executed and pps_fcount is
incremented by 49.

For the new calculation B, we have 1000000000 * tcount is 2000000100000000000
which is less than UINT64_MAX. This yields after the division with tc_frequency
the correct result of 1000000050 for delta_nsec.

In hardpps(), the first conditional statement is executed and pps_fcount is
incremented by 50.

This shows that both methods yield roughly the same results.  However, method B
is easier to understand and requires fewer conditional statements.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agopps: Directly assign the timestamps in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Directly assign the timestamps in pps_event()

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agopps: Move pcount assignment in pps_event()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Move pcount assignment in pps_event()

Move the pseq increment.  This makes it possible to reuse registers earlier.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agopps: Simplify capture and event processing
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Simplify capture and event processing

Use local variables for the captured timehand and timecounter in pps_event().
This fixes a potential issue in the nsec preparation for hardpps().  Here the
timecounter was accessed through the captured timehand after the generation was
checked.

Make a snapshot of the relevent timehand values early in pps_event().  Check
the timehand generation only once during the capture and event processing.  Use
atomic_thread_fence_acq() similar to the other readers.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agopps: Load timecounter once in pps_capture()
Sebastian Huber [Mon, 27 Feb 2023 21:49:09 +0000 (14:49 -0700)]
pps: Load timecounter once in pps_capture()

This ensures that the timecounter and the tc_get_timecount handler belong
together.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

17 months agonanobsd: fix typo
Gleb Smirnoff [Mon, 27 Feb 2023 19:26:18 +0000 (11:26 -0800)]
nanobsd: fix typo

Fixes: cbf64e2dd59c3579c49acbc52659eaa1ddceb557

17 months agonetmap: Fix compiler warnings in tools
Mark Johnston [Mon, 27 Feb 2023 18:41:58 +0000 (13:41 -0500)]
netmap: Fix compiler warnings in tools

- Remove write-only variables, or hide them in cases where their use is
  conditional or commented out.
- Check for errors from cmd_apply() in nmreplay.
- Use ANSI C definitions.

Reviewed by: vmaffione
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38752

17 months agoUse 'mixed' links for 'hard' links by default.
Warner Losh [Wed, 8 Feb 2023 21:20:46 +0000 (14:20 -0700)]
Use 'mixed' links for 'hard' links by default.

emaste suggested this in https://github.com/freebsd/freebsd-src/pull/133
and it works. It will do the right thing by default, and handle the weird
cases 133 was trying to fix.

17 months agonanobsd: Better NANO_OBJ if NANO_LAYOUT is set
Warner Losh [Wed, 8 Feb 2023 23:19:49 +0000 (16:19 -0700)]
nanobsd: Better NANO_OBJ if NANO_LAYOUT is set

If NANO_LAYOUT is set, then use /usr/obj/nanobsd.${NANO_NAME}.${NANO_LAYOUT}
instead of the current /usr/obj/nanobsd.${NANO_NAME} to allow multiple layouts
to be built w/o errors due to the time-skew that creates.

PR: 269366
Suggested by: Eugene Grosbein
Sponsored by: Netflix

17 months agodate.1: Examples: Use syntax that is also compatible with csh
Mateusz Piotrowski [Mon, 27 Feb 2023 16:34:00 +0000 (17:34 +0100)]
date.1: Examples: Use syntax that is also compatible with csh

MFC after: 1 month
Sponsored by: Klara Inc.

17 months agoman 3 daemon: remove double negation
Ihor Antonov [Mon, 27 Feb 2023 15:37:41 +0000 (08:37 -0700)]
man 3 daemon: remove double negation

Rephrase double negated sentences to improve readability
OpenBSD has done the same in the past to their man 3 daemon

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/671

17 months agonetinet: Remove IP(V6)_BINDMULTI
Mark Johnston [Mon, 27 Feb 2023 14:52:28 +0000 (09:52 -0500)]
netinet: Remove IP(V6)_BINDMULTI

This option was added in commit 0a100a6f1ee5 but was never completed.
In particular, there is no logic to map flowids to different listening
sockets, so it accomplishes basically the same thing as SO_REUSEPORT.
Meanwhile, we've since added SO_REUSEPORT_LB, which at least tries to
balance among listening sockets using a hash of the 4-tuple and some
optional NUMA policy.

The option was never documented or completed, and an exp-run revealed
nothing using it in the ports tree.  Moreover, it complicates the
already very complicated in_pcbbind_setup(), and the checking in
in_pcbbind_check_bindmulti() is insufficient.  So, let's remove it.

PR: 261398 (exp-run)
Reviewed by: glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38574

17 months agolibrss: Remove rss_sock_set_bindmulti()
Mark Johnston [Mon, 27 Feb 2023 14:50:25 +0000 (09:50 -0500)]
librss: Remove rss_sock_set_bindmulti()

In preparation for the removal of the IP(V6)_BINDMULTI option.

PR: 261398 (exp-run)
Reviewed by: glebius
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38574

17 months agodtrace_kinst.4: mention dtrace -l -P kinst, give a more complete example
Christos Margiolis [Mon, 27 Feb 2023 14:44:13 +0000 (09:44 -0500)]
dtrace_kinst.4: mention dtrace -l -P kinst, give a more complete example

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38801

17 months agokbdreg.h: include opt_kbd.h
Warner Losh [Mon, 27 Feb 2023 14:27:45 +0000 (07:27 -0700)]
kbdreg.h: include opt_kbd.h

This is a kernel-only file, so it's safe to include opt_kbd.h. However,
add #ifdef _KERNEL guards to emphasize that. And also move the include
of opt_kbd.h in atkbdcreg.h to inside the kernel guards. Nothing outside
the kernel in tree uses the rest of that file, but I'm less comfortable
moving the #ifdef _KERNEL to the top of that file.

Sponsored by: Netflix

17 months agonetlink: make the maximum allowed netlink socket buffer runtime tunable.
Alexander V. Chernikov [Mon, 27 Feb 2023 10:44:54 +0000 (10:44 +0000)]
netlink: make the maximum allowed netlink socket buffer runtime tunable.

Dumping large routng tables (>1M paths with multipath) require the socket
 buffer which is larger than the currently defined limit.
Allow the limit to be set in runtime, similar to kern.ipc.maxsockbuf.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 1 day

17 months agokbd: Tweaks to KBD_DELAY[12]
Warner Losh [Mon, 27 Feb 2023 03:48:07 +0000 (20:48 -0700)]
kbd: Tweaks to KBD_DELAY[12]

Make sure NOTES has a different value than the defaults, and properly
document the default values in atkbdc(4) and bump .Dd

Sponsored by: Netflix

17 months agopowerpc64*: port mlx5, OFED, KTLS and krping
Piotr Kubaj [Sat, 25 Feb 2023 21:09:41 +0000 (22:09 +0100)]
powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

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

17 months agopseudofs: Fix LOR in VOP_READDIR.
Dag-Erling Smørgrav [Sun, 26 Feb 2023 15:30:53 +0000 (15:30 +0000)]
pseudofs: Fix LOR in VOP_READDIR.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20862

17 months agoEnsure .inc files are regenerated when llvm/clang tblgen binaries change
Dimitry Andric [Sat, 25 Feb 2023 15:25:57 +0000 (16:25 +0100)]
Ensure .inc files are regenerated when llvm/clang tblgen binaries change

When doing a fully incremental build (with WITHOUT_CLEAN enabled), from
a commit before llvm 15 was merged (3264f6b88fce), to a commit after
that, a number of .inc files were not regenerated. This could lead to
unexpected compilation errors when these .inc files were included from
llvm-project sources, similar to:

  In file included from /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:8268:
  /usr/obj/usr/src/amd64.amd64/lib/clang/libclang/clang/Basic/arm_mve_builtin_cg.inc:279:18: error: no matching constructor for initialization of 'clang::CodeGen::Address'
    Address Val2 = Address(Val1, CharUnits::fromQuantity(2));
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Work around this by making the .inc files dependent on the tblgen binary
used for generating them. E.g., we can relatively safely assume that if
the binary gets updated, the .inc files must also be updated. (Although
this is not 100% optimal, the gain by complicating things even more is
probaby not worth the effort.)

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38770

17 months agonfs: patch up MNT_LAZY on sync
Mateusz Guzik [Fri, 24 Feb 2023 19:18:11 +0000 (19:18 +0000)]
nfs: patch up MNT_LAZY on sync

It is a de facto noop, just make it less costly.

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D38763

17 months agolinprocfs(4): Fixup process size in the /proc/pid/stat file
Dmitry Chagin [Sun, 26 Feb 2023 13:42:22 +0000 (16:42 +0300)]
linprocfs(4): Fixup process size in the /proc/pid/stat file

According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.

The fix is based on a fernape@ analysis.

PR: 265937
Reported by: Ray Bellis
MFC after: 3 days

17 months agoroute.8: Fix mandoc warnings
Gordon Bergling [Sun, 26 Feb 2023 13:33:58 +0000 (14:33 +0100)]
route.8: Fix mandoc warnings

- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

17 months agoroute.8: Add information about ROUTE_MPATH and FIB_ALGO
Gordon Bergling [Sun, 26 Feb 2023 13:15:34 +0000 (14:15 +0100)]
route.8: Add information about ROUTE_MPATH and FIB_ALGO

Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by: pauamma, Jose Luis Duran <jlduran at gmail dot com>
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D38783

17 months agoctf: Remove unused function prototype for getpname()
Zhenlei Huang [Sun, 26 Feb 2023 04:18:25 +0000 (12:18 +0800)]
ctf: Remove unused function prototype for getpname()

This function prototype should have been removed along with the
implementation.

Fixes: 3dd552426409 ctfdump: Use getprogname()
MFC after: 1 day

17 months agopowerpc: fix warning: a function declaration without a prototype is deprecated in...
Piotr Kubaj [Sat, 25 Feb 2023 23:34:27 +0000 (00:34 +0100)]
powerpc: fix warning: a function declaration without a prototype is deprecated in all versions of C

Reviewers: #powerpc
Approved by: alfredo

Subscribers: imp, jhibbits

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

17 months agoRevert "powerpc64*: port mlx5, OFED, KTLS and krping"
Piotr Kubaj [Sat, 25 Feb 2023 23:57:41 +0000 (00:57 +0100)]
Revert "powerpc64*: port mlx5, OFED, KTLS and krping"

Wrong push, another commit was supposed to be pushed.

This reverts commit 83d6d8877ef7dad4f4e8f409a01c9f28139cd026.

17 months agopowerpc64*: port mlx5, OFED, KTLS and krping
Piotr Kubaj [Sat, 25 Feb 2023 21:09:41 +0000 (22:09 +0100)]
powerpc64*: port mlx5, OFED, KTLS and krping

Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

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

17 months agokern: Remove gcc2_compiled stripping
Warner Losh [Sat, 25 Feb 2023 18:33:22 +0000 (11:33 -0700)]
kern: Remove gcc2_compiled stripping

Bruce added stripping of gcc2_compiled and other symbols when he made
the boot loader load the symbols for the kernel in 1995 (b5d89ca8ade3)
before the FreeBSD 2.1 release.  This was copied around a bit and
tweaked over the years, but these symbols aren't produced by clang, nor
gcc12. The were to support dbx for a.out stabs format. gcc removed them
with stabs support last year. gcc 2.95.4 in FreeBSD 4.x continued to
emit these symbols unconditionally (it was missing a test for aout vs
elf it would appaer). They disappeared entirely with gcc 3.2.4 in 5.x
for all non a.out builds, and entirely in FreeBSD 6.x which had gcc
3.2.6.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D38764

17 months agostand: fix buffer overflow in getrootmount()
Robert Wing [Sat, 25 Feb 2023 09:37:32 +0000 (09:37 +0000)]
stand: fix buffer overflow in getrootmount()

Reviewed by: imp, allanjude
Sponsored By:   Beckhoff Automation GmbH & Co. KG
Sponsored By:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38734

17 months agokldxref: skip .pkgsave files
Mina Galić [Sat, 25 Feb 2023 17:31:58 +0000 (10:31 -0700)]
kldxref: skip .pkgsave files

This should help people transitioning from traditional setups to pkgbase
experience a lot less friction.

We do this by skipping all files containing two dots.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/661
Differential Revision: https://reviews.freebsd.org/D27959

17 months agouniq(1): use strtonum to parse options
Daniel Tameling [Sat, 25 Feb 2023 17:25:51 +0000 (10:25 -0700)]
uniq(1): use strtonum to parse options

Previously strtol was used and the result was directly cast to an int
without checking for an overflow. Use strtonum instead since it is
safer and tells us what went wrong.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/643

17 months agostand: fix build userboot without zfs
Michael Paepcke [Fri, 24 Feb 2023 19:27:40 +0000 (19:27 +0000)]
stand: fix build userboot without zfs

Fix regression in building userboot -DWITHOUT_LOADER_ZFS

Fixes: e307eb94ae520
MFC After: 3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/665

17 months agoChange hw_tls to a bool
Alfonso [Tue, 20 Jul 2021 20:17:28 +0000 (16:17 -0400)]
Change hw_tls to a bool

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/512

17 months agoapic: prevent divide by zero in CPU frequency init
Mina Galić [Fri, 24 Feb 2023 11:07:42 +0000 (11:07 +0000)]
apic: prevent divide by zero in CPU frequency init

If a CPU for some reason returns 0 as CPU frequency, we currently panic
on the resulting divide by zero when trying to initialize the CPU(s) via
APIC. When this happens, we'll fallback to measuring the frequency
instead.

PR: 269767
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/664

17 months agopowerd.8: Provide a whole path to power_profile for clarity
Mateusz Piotrowski [Sat, 25 Feb 2023 16:28:49 +0000 (17:28 +0100)]
powerd.8: Provide a whole path to power_profile for clarity

MFC after: 3 weeks

17 months agozpool: install vdevprops(7) man page
Yuri [Fri, 24 Feb 2023 20:15:20 +0000 (21:15 +0100)]
zpool: install vdevprops(7) man page

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/666

17 months agoXref rc.conf in my previous addition.
Poul-Henning Kamp [Sat, 25 Feb 2023 16:08:06 +0000 (16:08 +0000)]
Xref rc.conf in my previous addition.

Prodded by: karels

17 months agock_queue: add CK_*_FOREACH_FROM
Mark Johnston [Sat, 25 Feb 2023 15:21:19 +0000 (10:21 -0500)]
ck_queue: add CK_*_FOREACH_FROM

This is a variant of CK_*_FOREACH from FreeBSD queue.h which starts
iteration at the specified item.  If the item pointer is NULL, iteration
starts from the beginning of the list.

Upstream commit 74366be35a6f4635f248a3c62d2d23245a4eb0f4.

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

17 months agosys/conf/NOTES: clean up whitespace
Mike Karels [Sat, 25 Feb 2023 14:04:00 +0000 (08:04 -0600)]
sys/conf/NOTES: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

I missed this file on the last pass.

17 months agoinet6_opt_init.3: Some enhancements
Gordon Bergling [Sat, 25 Feb 2023 13:11:27 +0000 (14:11 +0100)]
inet6_opt_init.3: Some enhancements

- Be consistent with RFC references, so add a space after 'RFC'
- Add a LIBRARY section
- Use standard integer types in the SYNOPSIS section

Obtained from: DragonflyBSD
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D27548

17 months agoUPDATING
Michael Paepcke [Tue, 21 Feb 2023 05:36:24 +0000 (05:36 +0000)]
UPDATING

Add notice to kernel options KBD_DELAY1 and KBD_DELAY2

Reviewed by: imp (tweaked whitespace too)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

17 months agosys/conf/NOTES add new KBD_DELAY kernel options
Michael Paepcke [Tue, 21 Feb 2023 06:17:00 +0000 (06:17 +0000)]
sys/conf/NOTES add new KBD_DELAY kernel options

add section for new kernel keyboard options

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

17 months agokbd: ukbd.4 and atkbdc.4 add section about new kernel options
Michael Paepcke [Tue, 21 Feb 2023 05:41:18 +0000 (05:41 +0000)]
kbd: ukbd.4 and atkbdc.4 add section about new kernel options

add section about  new kernel options KBD_DELAY1 and KBD_DELAY2

Reviewed by: imp (small tweaks to man page)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

17 months agokbd: add KBD_DELAY1 and KBD_DELAY2
Michael Paepcke [Sat, 18 Feb 2023 09:11:37 +0000 (09:11 +0000)]
kbd: add KBD_DELAY1 and KBD_DELAY2

Allow to configure KBD_DELAY* via KERNCONF for user-land less embedded
and security appliances

Reviewed by: imp (folded)
Pull Request: https://github.com/freebsd/freebsd-src/pull/649

17 months agolockstat: Use gelf.h instead of playing games with the preprocessor
Mark Johnston [Sat, 25 Feb 2023 01:15:21 +0000 (20:15 -0500)]
lockstat: Use gelf.h instead of playing games with the preprocessor

This reverts a portion of 1477dd823ee ("Merge OpenZFS support in to
HEAD.").  No functional change intended.

MFC after: 1 week

17 months agolockstat: Use the correct type for a symbol size
Mark Johnston [Sat, 25 Feb 2023 01:11:08 +0000 (20:11 -0500)]
lockstat: Use the correct type for a symbol size

No functional change intended.

MFC after: 1 week

17 months agogh-bc: don't disable LTO on powerpc64
Piotr Kubaj [Fri, 24 Feb 2023 13:26:31 +0000 (14:26 +0100)]
gh-bc: don't disable LTO on powerpc64

Summary:
The LTO issue has been fixed. While -flto for some reason is commented out,
since it wasn't completely removed, it may be expected to be reenabled.

Reviewers: se
Approved by: se
MFC after: 3 days
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D38755

17 months agousr.bin/gh-bc: clean-up Makefile
Stefan Eßer [Fri, 24 Feb 2023 23:07:25 +0000 (00:07 +0100)]
usr.bin/gh-bc: clean-up Makefile

Remove commented out debug options and re-enable LTO for most
architectures.

17 months agovendor/bc: import version 6.3.1
Stefan Eßer [Fri, 24 Feb 2023 22:14:58 +0000 (23:14 +0100)]
vendor/bc: import version 6.3.1

This version adds a command to dc to query whether extended registers
are enabled or not.

(cherry picked from commit 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427)

17 months agomake cross build from arm64 work..
John-Mark Gurney [Fri, 24 Feb 2023 05:47:03 +0000 (05:47 +0000)]
make cross build from arm64 work..

Reviewed by: dim, imp, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38762

17 months agoAdd gnn@ as my mentor.
Joseph Koshy [Sun, 19 Feb 2023 09:25:22 +0000 (09:25 +0000)]
Add gnn@ as my mentor.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D38673

17 months agovfs: s/ppsratecheck/eventratecheck
Mateusz Guzik [Fri, 24 Feb 2023 19:30:49 +0000 (19:30 +0000)]
vfs: s/ppsratecheck/eventratecheck

nfc

17 months agotime: s/ppsratecheck/eventratecheck
Mateusz Guzik [Thu, 23 Feb 2023 12:49:11 +0000 (12:49 +0000)]
time: s/ppsratecheck/eventratecheck

The routine is used as a general event-limiting routine in places which
have nothing to do with packets.

Provide a define to keep everything happy.

Reviewed by: rew
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D38746

17 months agoconfig: drop reference to removed System_spec
Kyle Evans [Fri, 24 Feb 2023 19:14:50 +0000 (13:14 -0600)]
config: drop reference to removed System_spec

Fixes the following warning:

yacc: w - the symbol System_spec is undefined
yacc: 3 rules never reduced

Reported by: otis
Fixes: 6a836ea741c7 ("config(8): Remove obsolete 'config' directive.")

17 months agoscmi: Suppress a couple of -Wunused-function warnings
Mark Johnston [Fri, 24 Feb 2023 18:40:58 +0000 (13:40 -0500)]
scmi: Suppress a couple of -Wunused-function warnings

No functional change intended.

Sponsored by: Klara, Inc.

17 months agolibc: handle zero alignment in memalign()
Paul Floyd [Fri, 24 Feb 2023 16:29:01 +0000 (11:29 -0500)]
libc: handle zero alignment in memalign()

For compatibility with glibc. The previous code would trigger a division
by zero in roundup() and terminate.  Instead, just pass through to
malloc() for align == 0.

PR: 269688
Reviewed by: imp, mjg
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/655

17 months agobcm_dma: don't dereference NULL softc
Mitchell Horne [Fri, 24 Feb 2023 17:19:54 +0000 (13:19 -0400)]
bcm_dma: don't dereference NULL softc

This file defines a small API to be used by other drivers. If any of
these functions are called before the bcm_dma device has attached we
should handle the error gracefully. Fix a formatting quirk while here.

Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38756

17 months agobcm_dma: attach at an earlier bus pass
Mark Millard [Fri, 17 Feb 2023 20:30:35 +0000 (16:30 -0400)]
bcm_dma: attach at an earlier bus pass

The sdhci_bcm driver attach routine relies on bcm_dma already being
attached, in order to allocate a DMA channel. However, both drivers
attached at the default pass so this is not guaranteed. Newer RPI
firmware exposes this assumption, and the result is a NULL-dereference
in bcm_dma_allocate().

To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma.

PR: 268835
Reviewed by: mhorne
MFC after: 1 week

17 months agonfsd: Fix a use after free when vnet prisons are deleted
Rick Macklem [Fri, 24 Feb 2023 15:36:28 +0000 (07:36 -0800)]
nfsd: Fix a use after free when vnet prisons are deleted

The Kasan tests show the nfsrvd_cleancache() results
in a modify after free. I think this occurs because the
nfsrv_cleanup() function gets executed after nfs_cleanup()
which free's the nfsstatsv1_p.

This patch makes them use the same subsystem and sets
SI_ORDER_FIRST for nfs_cleanup(), so that it will be called
after nfsrv_cleanup() via VNET_SYSUNINIT().

The patch also sets nfsstatsv1_p NULL after free'ng it,
so that a crash will result if it is used after free'ng.

Tested by: markj
Reviewed by: markj
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D38750

17 months agoping: Fix unsigned integer underflow resuling in a ping -R segfault
Cy Schubert [Thu, 23 Feb 2023 05:43:17 +0000 (21:43 -0800)]
ping: Fix unsigned integer underflow resuling in a ping -R segfault

ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or
the unsigned int hlen happens to be less than the size of an IP header:

slippy$ ping -R 192.168.0.101
PING 192.168.0.101 (192.168.0.101): 56 data bytes
64 bytes from 192.168.0.101: icmp_seq=0 ttl=63 time=1.081 ms
RR:  192.168.0.1
192.168.0.101
192.168.0.101
10.1.1.254
10.1.1.91
unknown option bb
unknown option 32
unknown option 6
...
unknown option 96
unknown option 2d
Segmentation fault

The reason for this is while looping through loose source routing (LSRR)
and strict source routing (SSRR), hlen will become smaller than the IP
header. It may even become negative. This should terminate the loop.
However, when hlen is unsigned, an integer underflow occurs becoming a
large number causing the loop to continue virtually forever until hlen
is either by chance smaller than the lenghth of an IP header or it
segfaults.

Reviewed by: asomers
Fixes: 46d7b45a267b
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38744

17 months agoriscv kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:45:08 +0000 (11:45 -0600)]
riscv kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agopowerpc kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:44:18 +0000 (11:44 -0600)]
powerpc kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agoi386 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:42:59 +0000 (11:42 -0600)]
i386 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agoarm64 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:41:31 +0000 (11:41 -0600)]
arm64 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agoarm kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:38:26 +0000 (11:38 -0600)]
arm kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agoamd64 kernel config: clean up whitespace
Mike Karels [Thu, 23 Feb 2023 17:09:39 +0000 (11:09 -0600)]
amd64 kernel config: clean up whitespace

Most options in kernel config files use "options<space><tab>OPTION".
This allows the option to be commented out without shifting columns.
A few options had two tabs, and some had spaces.  Make them consistent.

17 months agoUpdate leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)
Dimitry Andric [Fri, 24 Feb 2023 12:17:16 +0000 (13:17 +0100)]
Update leap-seconds to latest leap-seconds.3676924800 (expires 2023-12-28)

Obtained from: ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

17 months agonetlink: fix NOINET6 build.
Alexander V. Chernikov [Fri, 24 Feb 2023 10:19:12 +0000 (10:19 +0000)]
netlink: fix NOINET6 build.

Reported by: Michael Paepcke <bugs.fbsd@paepcke.de>
PR: 269787
MFC after: 3 days

17 months agobuf: Make bufspace_daemon_shutdown() a no-op after a panic
Mark Johnston [Fri, 24 Feb 2023 02:56:36 +0000 (21:56 -0500)]
buf: Make bufspace_daemon_shutdown() a no-op after a panic

This function doesn't need to do anything in that context, and calling
wakeup() can lead to recursive panics.

Discussed with: mhorne
MFC after: 1 week

17 months agoconfig: Include errno.h in mkmakefile.cc
Mark Johnston [Fri, 24 Feb 2023 02:45:01 +0000 (21:45 -0500)]
config: Include errno.h in mkmakefile.cc

Commit da8884202940 ("config: error out on malformed env/hint lines")
added a reference to EINVAL.  In some configurations the bootstrap tools
build fails for lack of errno definitions.

Fixes: da8884202940 ("config: error out on malformed env/hint lines")
Reported by: syzbot+b1a5d112a737d9a2be9b@syzkaller.appspotmail.com

17 months agoiconvlist(3): fix count argument type
Kyle Evans [Thu, 23 Feb 2023 21:22:12 +0000 (15:22 -0600)]
iconvlist(3): fix count argument type

count is just an unsigned int, not a pointer.

Sponsored by: Klara, Inc.

17 months agotools/git: fix typos in documentation
Mina Galić [Thu, 23 Feb 2023 21:05:33 +0000 (21:05 +0000)]
tools/git: fix typos in documentation

and change mention of svn to git.

Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/659

17 months agonet80211: ieee80211_swscan_bg_scan() track return variable under lock
Bjoern A. Zeeb [Sat, 18 Feb 2023 01:15:21 +0000 (01:15 +0000)]
net80211: ieee80211_swscan_bg_scan() track return variable under lock

As the comment says it probably does not matter but use a local
variable to track state under lock so we can return the last known
good state of what we thought we were operating under after unlocking.

Likely no functional changes.

Sponsored by: The FreeBSD Foundation
MFC atfer: 3 days
Reviewed by: enweiwu, adrian
Differential Revision: https://reviews.freebsd.org/D38660

17 months agoefibootmgr: add missing break for 'u' case
Ed Maste [Thu, 23 Feb 2023 14:52:14 +0000 (09:52 -0500)]
efibootmgr: add missing break for 'u' case

Reviewed by: imp, zlei
Reported by: Coverity
CID: 1505695
Fixes: 9a7915299484 ("efibootmgr: Add --efidev (-u) to dis...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38747

17 months agoDelete obsolete Solaris compat header file stdlib.h
Zhenlei Huang [Thu, 23 Feb 2023 18:00:09 +0000 (02:00 +0800)]
Delete obsolete Solaris compat header file stdlib.h

This drops function `getexecname()` redirection.

Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.

Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.

PR: 269738
Reviewed by: markj
Fixes: 9e5787d2284e Merge OpenZFS support in to HEAD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38733

17 months agonetlink: fix addition of blackhole/reject routes.
Alexander V. Chernikov [Thu, 23 Feb 2023 17:38:18 +0000 (17:38 +0000)]
netlink: fix addition of blackhole/reject routes.

* Make nhop_set_blackhole() set all necessary properties for the
 nexthop
* Make nexthops blackhole/reject based on the rtm_type netlink
 property instead of using rtflags.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days

17 months agoarm: Fix initialization of VFP context
Kornel Dulęba [Mon, 20 Feb 2023 14:48:40 +0000 (14:48 +0000)]
arm: Fix initialization of VFP context

Make sure that pcb_vfpsaved is always initialized.
Create a vfp_new_thread helper that is heavily based on the arm64 logic.
While here remove un unnecessary assigment and add an assertion
to make sure that it's been properly initialized before we return
from a VFP exception.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38698

17 months agoarm: Unbreak debugging programs that use FP instructions
Kornel Dulęba [Mon, 20 Feb 2023 14:44:36 +0000 (14:44 +0000)]
arm: Unbreak debugging programs that use FP instructions

Contrary to arm64, on armv7 get_vfpcontext/set_vfpcontext can be called
from cpu_ptrace. This can be triggered when gdb hits a breakpoint
in a userspace program.
Relax td == currthread assertion to account for that situation.
While here update an outdated comment in vfp_discard.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38696

17 months agox86: whack kernel gcov vestige
Mateusz Guzik [Thu, 23 Feb 2023 16:40:40 +0000 (16:40 +0000)]
x86: whack kernel gcov vestige

Sponsored by: Rubicon Communications, LLC ("Netgate")

17 months agoctfdump: Use getprogname()
Zhenlei Huang [Thu, 23 Feb 2023 16:28:35 +0000 (00:28 +0800)]
ctfdump: Use getprogname()

Also remove no longer used function `getpname()`.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38740

17 months agomroute: partially sanitize the file
Mateusz Guzik [Fri, 17 Feb 2023 11:23:35 +0000 (12:23 +0100)]
mroute: partially sanitize the file

There is rampant inconsistent formatting all around, make it mostly
style(9)-conformant.

While here:
- drop malloc casts
- rename a rw lock from mroute_mtx to mroute_lock
- replace NOTREACHED comment with __assert_unreachable

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D38652

17 months agotmpfs: support the nosymfollow mount option
Konstantin Belousov [Thu, 23 Feb 2023 13:15:17 +0000 (15:15 +0200)]
tmpfs: support the nosymfollow mount option

PR: 269772
Reported by: firk@cantconnect.ru
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

17 months agoveriexec(4): Fix a compiler error
Mina Galić [Thu, 23 Feb 2023 11:14:41 +0000 (12:14 +0100)]
veriexec(4): Fix a compiler error

When building WITH_BEARSSL=1 veriexec(4) failes to compile.
So update the function prototype so that veriexec(4)
compiles again.

Reported by: gbe
Reviewed by: mjg, gbe
Approved by: mjg
Pull Request: https://github.com/freebsd/freebsd-src/pull/657

17 months agolinux(4): Fixup the interface name translation in netlink
Dmitry Chagin [Thu, 23 Feb 2023 08:01:18 +0000 (11:01 +0300)]
linux(4): Fixup the interface name translation in netlink

Netlink should translate a FreeBSD interface name to a Linux
interface name.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38715
MFC after: 3 days

17 months agolinux(4): Consolidate a FreeBSD interface names translation code
Dmitry Chagin [Thu, 23 Feb 2023 08:00:29 +0000 (11:00 +0300)]
linux(4): Consolidate a FreeBSD interface names translation code

We have some amount of interface names translation functions which are
differs by bugs implementation. Consolidates it in a one place.

Fixup loopback interface names translation and use ifnet methods and
accessors, where possible.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38714
MFC after: 3 days
X-MFC with: 32fdc75fe7

17 months agolinux(4): Use predefined constant instead of hardcoded value
Dmitry Chagin [Thu, 23 Feb 2023 07:59:34 +0000 (10:59 +0300)]
linux(4): Use predefined constant instead of hardcoded value

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38713
MFC after: 3 days

17 months agoif_ovpn: ovpn_find_peer_by_ip() is unused without INET
Kristof Provost [Thu, 23 Feb 2023 02:58:14 +0000 (03:58 +0100)]
if_ovpn: ovpn_find_peer_by_ip() is unused without INET

Don't define ovpn_find_peer_by_ip() if INET is not set, and do the same
for ovpn_find_peer_by_ip6() and INET6.

Reported by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")

17 months agounix/dgram tests: match the kernel behavior
Gleb Smirnoff [Thu, 23 Feb 2023 04:44:46 +0000 (20:44 -0800)]
unix/dgram tests: match the kernel behavior

In CURRENT for some time an overflowed unix/dgram socket would
return EAGAIN if it has O_NONBLOCK set.  This proved to be
undesired.  See 71e70c25c00 for details.  Update tests to match
the "new" behavior, which actually is the historical behavior.

17 months agoFix Coverity issue in the NVDIMM driver
Robert Herndon [Thu, 13 Oct 2022 17:02:28 +0000 (12:02 -0500)]
Fix Coverity issue in the NVDIMM driver

Summary:
Coverity reports a potential memory leak in the nvdimm
driver. Examination shows it's real; fix it.

Sponsored by: Dell Technologies
MFC after: 1w

Test Plan: Changes in use at $WORK

Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com

Subscribers: imp, badger

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

17 months agotcp: ensure the tcpcb is not NULL when logging an event
Michael Tuexen [Thu, 23 Feb 2023 01:01:53 +0000 (02:01 +0100)]
tcp: ensure the tcpcb is not NULL when logging an event

When calling tcp_bblog_pru() on some error paths, tp is NULL,
therefore handle it.

Sponsored by: Netflix, Inc.

17 months agonfsd.c: Log a more meaningful failure message
Rick Macklem [Wed, 22 Feb 2023 22:09:15 +0000 (14:09 -0800)]
nfsd.c: Log a more meaningful failure message

For the cases where the nfsd(8) daemon is already running or
has failed to start within a prison due to an incorrect prison
configuration, the failure message logged is:
  Can't read stable storage file: operation not permitted

This patch replaces the above with more meaningful messages.
It depends on commit 10dff9da9748 to differentiate between the
above two cases, however even without this commit, the messages
should be an improvement.

MFC after: 3 months

17 months agonfsd: Return ENXIO instead of EPERM when nfsd(8) already running
Rick Macklem [Wed, 22 Feb 2023 21:19:07 +0000 (13:19 -0800)]
nfsd: Return ENXIO instead of EPERM when nfsd(8) already running

The nfsd(8) daemon generates an error message that does not
indicate that the nfsd daemon is already running when the nfssvc(2)
syscall fails for the NFSSVC_STABLERESTART.  Also, the check for
running nfsd(8) in a vnet prison will return EPERM when it fails.

This patch replaces EPERM with ENXIO so that the nfsd(8) daemon
can generate more reasonable failure messages.  The nfsd(8) daemon
will be patched in a future commit.

MFC after: 3 months

17 months agobyacc: Adjust expected test output to match our patches.
Dag-Erling Smørgrav [Wed, 22 Feb 2023 19:04:06 +0000 (20:04 +0100)]
byacc: Adjust expected test output to match our patches.

Sponsored by: Klara, Inc.

17 months agofusefs: add some more test cases for bad fuse servers
Alan Somers [Tue, 21 Feb 2023 23:26:37 +0000 (16:26 -0700)]
fusefs: add some more test cases for bad fuse servers

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38719

17 months agofusefs: fix a buffer overflow in the tests
Alan Somers [Wed, 22 Feb 2023 00:13:56 +0000 (17:13 -0700)]
fusefs: fix a buffer overflow in the tests

The actual overflow occured in the ReadAhead.readahead test.
Surprisingly it has never segfaulted or resulted in any bad behavior.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38718