]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agolinuxkpi: Implement the wait_event_interruptible macro
Neel Chauhan [Mon, 26 Apr 2021 15:12:18 +0000 (08:12 -0700)]
linuxkpi: Implement the wait_event_interruptible macro

This is needed by the drm-kmod 5.5 update and is similar in logic to the
existing wait_event_killable macro.

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

(cherry picked from commit 057f145aae9a3528ccd722c8f566d740d5cafcbb)

3 years agoports.7: Add an example of setting variables for selected ports
Mateusz Piotrowski [Sat, 16 Jan 2021 23:10:44 +0000 (00:10 +0100)]
ports.7: Add an example of setting variables for selected ports

Reviewed by: crees
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28202

(cherry picked from commit c0e41dff700cf8a4a06000f19bd2342cd6fe284d)

3 years agoFix zgrep --version
Mateusz Piotrowski [Tue, 13 Apr 2021 10:12:53 +0000 (12:12 +0200)]
Fix zgrep --version

"zgrep --version" is expected to print the version information in the
same way as "zgrep -V". However, the case handling the --version flag
is never reached, so "zgrep --version" prints:
    zgrep: missing pattern
instead of:
    grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Reviewed by: yuripv
Approved by: yuripv (src)
Differential Revision: https://reviews.freebsd.org/D29813

(cherry picked from commit 16e0391f8e2124eb85af984204548cf841648db5)

3 years ago[fib algo] Do not print algo attach/detach message on boot
Alexander V. Chernikov [Sun, 25 Apr 2021 08:51:57 +0000 (08:51 +0000)]
[fib algo] Do not print algo attach/detach message on boot

MFC after: 1 day

(cherry picked from commit c23385612da5dd3195a9b73bfb22bd969dbd26c2)

3 years agoMake gcc happy by initializing error in rib_handle_ifaddr_info().
Alexander V. Chernikov [Sun, 25 Apr 2021 08:44:20 +0000 (08:44 +0000)]
Make gcc happy by initializing error in rib_handle_ifaddr_info().

(cherry picked from commit a81e2e7890c2fce2a74dbb859e6855e0414a6ea1)

3 years agoImprove debugging output on routing tests failure.
Alexander V. Chernikov [Fri, 23 Apr 2021 21:28:38 +0000 (21:28 +0000)]
Improve debugging output on routing tests failure.

Most of the routing tests create per-test VNET, making
 it harder to repeat the failure with CLI tools.
Provide an additional route/nexthop data on failure.

Differential Revision: https://reviews.freebsd.org/D29957
Reviewed by: kp
MFC after: 2 weeks

(cherry picked from commit bddae5c8a64dc6b292198945cbe676bb2158d438)

3 years agoRelax rtsock message restrictions.
Alexander V. Chernikov [Mon, 19 Apr 2021 20:49:18 +0000 (20:49 +0000)]
Relax rtsock message restrictions.

Address multiple issues with strict rtsock message validation.

D28668 "normalisation" approach was based on the assumption that
 we always have at least "standard" sockaddr len.
It turned out to be false - certain older applications like quagga
 or routed abuse sin[6]_len field and set it to the offset to the
 first fully-zero bit in the mask. It is impossible to normalise
 such sockaddrs without reallocation.

With that in mind, change the approach to use a distinct memory
 buffer for the altered sockaddrs. This allows supporting the older
 software while maintaining the guarantee on the "standard" sockaddrs.

PR: 255273,255089
Differential Revision: https://reviews.freebsd.org/D29826
MFC after: 3 days

(cherry picked from commit b31fbebeb3d59af359a3417cddfbcf666b2c56c9)

3 years agoImprove error reporting in rtsock.c
Alexander V. Chernikov [Mon, 19 Apr 2021 20:36:41 +0000 (20:36 +0000)]
Improve error reporting in rtsock.c

MFC after: 3 days

(cherry picked from commit 758c9d54d44f8ce957570b8c2ef6d1b3f28a792d)

3 years agoFix typo in rtsock_common.h
Alexander V. Chernikov [Mon, 19 Apr 2021 20:24:42 +0000 (20:24 +0000)]
Fix typo in rtsock_common.h

MFC after: 3 days

(cherry picked from commit 37c0f4a2077739e735732374d67525cf6de36d21)

3 years agoFib algo: extend KPI by allowing algo to set datapath pointers.
Alexander V. Chernikov [Thu, 15 Apr 2021 17:44:11 +0000 (18:44 +0100)]
Fib algo: extend KPI by allowing algo to set datapath pointers.

Some algorithms may require updating datapath and control plane
 algo pointers after the (batched) updates.

Export fib_set_datapath_ptr() to allow setting the new datapath
 function or data pointer from the algo.
Add fib_set_algo_ptr() to allow updating algo control plane
 pointer from the algo.
Add fib_epoch_call() epoch(9) wrapper to simplify freeing old
 datapath state.

Reviewed by: zec
Differential Revision: https://reviews.freebsd.org/D29799
MFC after: 1 week

(cherry picked from commit e2f79d9e518f885bf875f6613e70af39b7c397de)

3 years agolinuxkpi: reduce number of stray mm_struct allocations
Konstantin Belousov [Thu, 11 Mar 2021 06:48:22 +0000 (08:48 +0200)]
linuxkpi: reduce number of stray mm_struct allocations

(cherry picked from commit fad437ba612a7c19f5cf1633e2d0d1c44d4dd478)

3 years agolinuxkpi: guarantee allocations of task and mm for interrupt threads
Konstantin Belousov [Thu, 11 Mar 2021 06:34:42 +0000 (08:34 +0200)]
linuxkpi: guarantee allocations of task and mm for interrupt threads

(cherry picked from commit 165ba13fb806c8596f868981883631a5ee78d6c8)

3 years agolinuxkpi: some style, wrap too long lines
Konstantin Belousov [Thu, 11 Mar 2021 06:08:51 +0000 (08:08 +0200)]
linuxkpi: some style, wrap too long lines

(cherry picked from commit 4ce1f6162e9eb576ac40f24b8538f55e83ef5eb4)

3 years agoixgbe: Clarify index name in ixgbe_mc_filter_apply
Kevin Bowling [Sat, 17 Apr 2021 01:17:43 +0000 (18:17 -0700)]
ixgbe: Clarify index name in ixgbe_mc_filter_apply

"It looks like it would be less confusing to rename 'count' to
something like 'idx', since that's what it's used for in this
function."

Reviewed by: erj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29798

(cherry picked from commit 21afed4b1d18578aa8c9fa31e9e677971f8b4300)

3 years agonfsd: fix replies from session cache for multiple retries
Rick Macklem [Sat, 10 Apr 2021 22:50:25 +0000 (15:50 -0700)]
nfsd: fix replies from session cache for multiple retries

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

Commit 05a39c2c1c18 fixed replying with the cached reply in
in the session slot if same session slot sequence#.
However, the code uses the reply and, as such,
will fail for a subsequent retry of the RPC.
A subsequent retry would be an extremely rare event,
but this patch fixes this, so long as m_copym(..M_NOWAIT)
does not fail, which should also be a rare event.

This fix affects the exceedingly rare case where a NFSv4
client retries a non-idempotent RPC, such as a lock
operation, multiple times.  Note that retries only occur
after the client has needed to create a new TCP connection,
with a new TCP connection for each retry.

(cherry picked from commit 22cefe3d8378f58adcdbb2c7589b9f30c2a38315)

3 years agompt(4): Remove incorrect S/G segments limits.
Alexander Motin [Sat, 17 Apr 2021 14:41:35 +0000 (10:41 -0400)]
mpt(4): Remove incorrect S/G segments limits.

First, two of those four checks are unreachable.
Second, I don't believe there should be ">=" instead of ">".
Third, bus_dma(9) already returns the same EFBIG if ">".

This fixes false I/O errors in worst S/G cases with maxphys >= 2MB.

MFC after: 1 week

(cherry picked from commit 0f29396e493bd87ffa6a63fcb602b12e79d21a1e)

3 years agoCirrus-CI: use FreeBSD 13.0 image for base system CI build
Ed Maste [Mon, 19 Apr 2021 18:36:21 +0000 (14:36 -0400)]
Cirrus-CI: use FreeBSD 13.0 image for base system CI build

We generally want to build and test on the highest release version, and
FreeBSD 13.0 also brings some performance benefits.

Reviewed by: lwhsu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29842

(cherry picked from commit 407abff2b91847e23711625ad7c69c17e99b3d1d)

3 years agolex: Use NULL instead of 0 for pointers
Jung-uk Kim [Thu, 11 Feb 2021 23:31:53 +0000 (18:31 -0500)]
lex: Use NULL instead of 0 for pointers

Note araujo tried to fix it in r298241 but he only touched generated
files for bootstrap.  This commit properly fixes the problem.

(cherry picked from commit 34e67bb5977049afb3e965b52b86ac12ea4899b4)

3 years agoflex: Regen bootstrap files
Jung-uk Kim [Mon, 19 Apr 2021 18:20:51 +0000 (14:20 -0400)]
flex: Regen bootstrap files

This also partially reverts r326025 (8a16b7a18f5d).  I do not see any
point of adding SPDX tag in generated file.

Submitted by: Dan McGregor <dan.mcgregor@usask.ca> (initial version)
Differential Revision: https://reviews.freebsd.org/D28596

(cherry picked from commit 686cf5468c4a85c2a6385cdbab2383900876a41d)

3 years agoreadelf: return error in case of invalid file
Ed Maste [Fri, 23 Apr 2021 15:37:49 +0000 (11:37 -0400)]
readelf: return error in case of invalid file

GNU readelf exits with an error for a number of invalid file cases.
Previously ELF Tool Chain readelf always exited with 0.  Now we exit 1
upon detecting an error with one or more input files, but in any case
all of them are processed.

This should catch common failure cases.  We still do not report an error
for some types of malformed ELF files, but this is consistent with GNU
readelf.

PR: 252727
Reviewed by: jkoshy, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29377

(cherry picked from commit ea444392bb5b351c930f28a02a4e68f51b25ba69)

3 years agosysctl vm.objects: report backing object and swap use
Konstantin Belousov [Thu, 15 Apr 2021 09:27:02 +0000 (12:27 +0300)]
sysctl vm.objects: report backing object and swap use

(cherry picked from commit ecfbddf0cde3d4151217e3eb2d7c5388a423d397)

3 years agosysctl_handle_string: do not malloc when SYSCTL_IN cannot fault
Konstantin Belousov [Sun, 18 Apr 2021 16:09:30 +0000 (19:09 +0300)]
sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault

(cherry picked from commit 4342ba184c15f3b8912e95f93fe313731963f065)

3 years agovn_open_vnode(): handle error when fp == NULL
Konstantin Belousov [Mon, 19 Apr 2021 10:25:30 +0000 (13:25 +0300)]
vn_open_vnode(): handle error when fp == NULL

PR: 255119

(cherry picked from commit 54f98c4dbf9b1203a4e3e1b13fd0738441226991)

3 years agolinkat(2): check NIRES_EMPTYPATH on the first fd arg
Konstantin Belousov [Mon, 19 Apr 2021 13:35:25 +0000 (16:35 +0300)]
linkat(2): check NIRES_EMPTYPATH on the first fd arg

(cherry picked from commit 578c26f31c0c90c9e6b2f7125a8539c307a51dff)

3 years agoO_PATH: allow vnode kevent filter on such files
Konstantin Belousov [Wed, 7 Apr 2021 18:31:48 +0000 (21:31 +0300)]
O_PATH: allow vnode kevent filter on such files

(cherry picked from commit bbf7a4e878ed6828d13c7029c128a7e60dc25391)

3 years agoO_PATH: Allow to open symlink
Konstantin Belousov [Wed, 7 Apr 2021 03:23:25 +0000 (06:23 +0300)]
O_PATH: Allow to open symlink

(cherry picked from commit f9b923af34a6749c7703b957742f33cc02a485a2)

3 years agoMake files opened with O_PATH to not block non-forced unmount
Konstantin Belousov [Sat, 3 Apr 2021 18:55:11 +0000 (21:55 +0300)]
Make files opened with O_PATH to not block non-forced unmount

(cherry picked from commit a5970a529c2d952714f20e4bc6e529c74fd2b3b5)

3 years agoopen(2): Implement O_PATH
Konstantin Belousov [Thu, 18 Mar 2021 10:41:47 +0000 (12:41 +0200)]
open(2): Implement O_PATH

(cherry picked from commit 8d9ed174f3afba5f114742447e622fc1173d4774)

3 years agoAdd AT_EMPTY_PATH for several *at(2) syscalls
Konstantin Belousov [Sun, 7 Mar 2021 14:29:09 +0000 (16:29 +0200)]
Add AT_EMPTY_PATH for several *at(2) syscalls

(cherry picked from commit 509124b62616f73dcdc42263ee109392dafafd99)

3 years agovfs_vnops.c: Make vn_statfile() non-static
Konstantin Belousov [Thu, 18 Mar 2021 10:41:07 +0000 (12:41 +0200)]
vfs_vnops.c: Make vn_statfile() non-static

(cherry picked from commit 437c241d0c78f77a9d9e54494a353db01ce1a3de)

3 years agoStyle.
Konstantin Belousov [Thu, 18 Mar 2021 10:40:20 +0000 (12:40 +0200)]
Style.

(cherry picked from commit 42be0a7b10b14113ba9c4e4a738e8f20e235b736)

3 years agoAT_RESOLVE_BENEATH is bsd-specific
Konstantin Belousov [Thu, 11 Mar 2021 15:07:02 +0000 (17:07 +0200)]
AT_RESOLVE_BENEATH is bsd-specific

(cherry picked from commit d51b4b0aac43d9d25f7eb3f17b2d3034a5c851d8)

3 years agob_vflags update requries bufobj lock
Konstantin Belousov [Tue, 13 Apr 2021 10:22:56 +0000 (13:22 +0300)]
b_vflags update requries bufobj lock

(cherry picked from commit e3d675958539eee899d42438f5b46a26f3c64902)

3 years agorealtimer_expire: avoid proc lock recursion when called from itimer_proc_continue()
Konstantin Belousov [Tue, 13 Apr 2021 13:47:24 +0000 (16:47 +0300)]
realtimer_expire: avoid proc lock recursion when called from itimer_proc_continue()

(cherry picked from commit 5cc1d199412ead0b4c234e21e881a31ef893a4f0)

3 years agofilt_timerexpire: avoid process lock recursion
Konstantin Belousov [Tue, 13 Apr 2021 14:25:11 +0000 (17:25 +0300)]
filt_timerexpire: avoid process lock recursion

(cherry picked from commit 75c5cf7a720f5a73f17aff60adbc4a7b2fa86f84)

3 years agoStop arming kqueue timers on knote owner suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 23:29:08 +0000 (01:29 +0200)]
Stop arming kqueue timers on knote owner suspend or terminate

(cherry picked from commit 2fd1ffefaa4d2cd99a19f866a949cb2cd58ef998)

3 years agoAdd helper for kqueue timers callout scheduling
Konstantin Belousov [Fri, 5 Mar 2021 23:31:20 +0000 (01:31 +0200)]
Add helper for kqueue timers callout scheduling

(cherry picked from commit 533e5057ed2503013643bf8450588e4aa58c2b7e)

3 years agoStop arming realtime posix process timers on suspend or terminate
Konstantin Belousov [Thu, 11 Mar 2021 08:16:51 +0000 (10:16 +0200)]
Stop arming realtime posix process timers on suspend or terminate

(cherry picked from commit 4d27d8d2f3b8ae4ef3efc86b220c7ff2dbdbac5a)

3 years agoStop arming periodic process timers on suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 21:19:35 +0000 (23:19 +0200)]
Stop arming periodic process timers on suspend or terminate

(cherry picked from commit dc47fdf1319f18be1aadbcdef17c721a83415d84)

3 years agopseudofs: limit writes to 1M
Konstantin Belousov [Tue, 13 Apr 2021 19:48:44 +0000 (22:48 +0300)]
pseudofs: limit writes to 1M

(cherry picked from commit 5edf7227ec339f651c7328e63df323f6ef10345f)

3 years agosbuf_uionew(): sbuf_new() takes int as length
Konstantin Belousov [Tue, 13 Apr 2021 19:12:19 +0000 (22:12 +0300)]
sbuf_uionew(): sbuf_new() takes int as length

(cherry picked from commit 116f26f947b8bbf868dcd85d79226406029a45ee)

3 years agonfs client: depend on xdr
Konstantin Belousov [Tue, 13 Apr 2021 11:47:20 +0000 (14:47 +0300)]
nfs client: depend on xdr

(cherry picked from commit 8cca7b7f28feaf0c5e2dfedb985ae334a4013ef6)

3 years agolink(2): correct descriptor name in AT_RESOLVE_BENEATH description
Konstantin Belousov [Tue, 30 Mar 2021 21:56:28 +0000 (00:56 +0300)]
link(2): correct descriptor name in AT_RESOLVE_BENEATH description

(cherry picked from commit c78e124535febc6c0bc7c0756b42d6b845428d2e)

3 years agoptrace: restructure comments around reparenting on PT_DETACH
Konstantin Belousov [Sun, 11 Apr 2021 09:06:21 +0000 (12:06 +0300)]
ptrace: restructure comments around reparenting on PT_DETACH

(cherry picked from commit a091c353235e0ee97d2531e80d9d64e1648350f4)

3 years agoptrace: remove dead call to FIX_SSTEP()
Konstantin Belousov [Sun, 11 Apr 2021 09:02:34 +0000 (12:02 +0300)]
ptrace: remove dead call to FIX_SSTEP()

(cherry picked from commit 9d7e450b64f1e605c718fba0f357d49541c8147b)

3 years agoamd64 linux64: use x86_clear_dbregs()
Konstantin Belousov [Fri, 9 Apr 2021 23:22:48 +0000 (02:22 +0300)]
amd64 linux64: use x86_clear_dbregs()

(cherry picked from commit 2f1588474768f61f3a983af207e753bd0340a9e7)

3 years agox86: use x86_clear_dbregs() on fork
Konstantin Belousov [Fri, 9 Apr 2021 23:20:55 +0000 (02:20 +0300)]
x86: use x86_clear_dbregs() on fork

(cherry picked from commit 290b0d123ae2136ad84b268cd1884b1624d1d37f)

3 years agoamd64: clear debug registers on execing 32bit native binary
Konstantin Belousov [Fri, 9 Apr 2021 23:23:54 +0000 (02:23 +0300)]
amd64: clear debug registers on execing 32bit native binary

(cherry picked from commit d50adfec9ee73e88e8d365525f1acef2c1db798a)

3 years agoamd64: clear debug registers on execing 32bit Linux binary
Konstantin Belousov [Fri, 9 Apr 2021 23:25:06 +0000 (02:25 +0300)]
amd64: clear debug registers on execing 32bit Linux binary

(cherry picked from commit 94172affa43af15fe3b50293a96c292eca30c386)

3 years agox86: add x86_clear_dbregs() helper
Konstantin Belousov [Fri, 9 Apr 2021 23:19:23 +0000 (02:19 +0300)]
x86: add x86_clear_dbregs() helper

(cherry picked from commit a8b75a57c9b2cb3388746f097a55086a0f8c5d38)

3 years agortld_lock.h: add some comments about versioning of struct RtldLockInfo
Konstantin Belousov [Sun, 11 Apr 2021 08:12:48 +0000 (11:12 +0300)]
rtld_lock.h: add some comments about versioning of struct RtldLockInfo

(cherry picked from commit 9b33518ada2ebda727ca3c7979cdcdb30716f737)

3 years agortld: make dlerror() thread-local
Konstantin Belousov [Wed, 7 Apr 2021 22:02:33 +0000 (01:02 +0300)]
rtld: make dlerror() thread-local

(cherry picked from commit 4d9128da54f8f8e2a29190ffb18880c4f116a205)

3 years agortld: workaround for broken ABI
Konstantin Belousov [Sat, 10 Apr 2021 12:32:24 +0000 (15:32 +0300)]
rtld: workaround for broken ABI

(cherry picked from commit 08bfbd43594b7642de0d2487550f36b0ee1eceba)

3 years agortld: unstaticise lockinfo and obj_from_addr()
Konstantin Belousov [Sat, 10 Apr 2021 12:30:59 +0000 (15:30 +0300)]
rtld: unstaticise lockinfo and obj_from_addr()

(cherry picked from commit 4d7f08c84bcfcd75ba23b06e07a8e5dba1d4a44f)

3 years agortld: use _get_tp() in __tls_get_addr()
Konstantin Belousov [Wed, 7 Apr 2021 03:49:28 +0000 (06:49 +0300)]
rtld: use _get_tp() in __tls_get_addr()

(cherry picked from commit e8b9c508b7ae5be618ada089103468c400e465cd)

3 years agortld: avoid recursing on rtld_bind_lock for write
Konstantin Belousov [Tue, 6 Apr 2021 19:02:23 +0000 (22:02 +0300)]
rtld: avoid recursing on rtld_bind_lock for write

(cherry picked from commit 7cb32a0d03437f881169b1c55cce89cf70ed43dd)

3 years agortld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked
Konstantin Belousov [Tue, 6 Apr 2021 18:56:58 +0000 (21:56 +0300)]
rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked

(cherry picked from commit 89508048424837ffdb32c8444dab02261711f77d)

3 years agortld: style tls_get_addr_slow
Konstantin Belousov [Tue, 6 Apr 2021 18:55:10 +0000 (21:55 +0300)]
rtld: style tls_get_addr_slow

(cherry picked from commit 85d846b369f4d8c0033993d3d1307779d3b9aa62)

3 years agolibc dl_iterate_phdr(): dlpi_tls_data is wrong
Konstantin Belousov [Mon, 5 Apr 2021 03:38:07 +0000 (06:38 +0300)]
libc dl_iterate_phdr(): dlpi_tls_data is wrong

(cherry picked from commit dbd2053026a6af28adb1aa32e27603ae0d4efea6)

3 years agolibc: implement __tls_get_addr() for static binaries
Konstantin Belousov [Mon, 5 Apr 2021 03:29:47 +0000 (06:29 +0300)]
libc: implement __tls_get_addr() for static binaries

(cherry picked from commit ca46b5698e8ac38ab45d781d592700be59e7de97)

3 years agolibc: add _get_tp() private function
Konstantin Belousov [Mon, 5 Apr 2021 03:30:35 +0000 (06:30 +0300)]
libc: add _get_tp() private function

(cherry picked from commit 06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac)

3 years agortld: define TLS_DTV_OFFSET on all architectures
Konstantin Belousov [Wed, 7 Apr 2021 06:25:34 +0000 (09:25 +0300)]
rtld: define TLS_DTV_OFFSET on all architectures

(cherry picked from commit 99c2ce7ef12f0852f25155d1d6718beccafbae0e)

3 years agolibc: include rtld.h into static implementations of rtld interface
Konstantin Belousov [Mon, 5 Apr 2021 03:41:46 +0000 (06:41 +0300)]
libc: include rtld.h into static implementations of rtld interface

(cherry picked from commit 7f7489eba391a858b3930a34e7749d642b374c5c)

3 years agolibc: constify dummy error message string for dlfcn
Konstantin Belousov [Mon, 5 Apr 2021 04:14:39 +0000 (07:14 +0300)]
libc: constify dummy error message string for dlfcn

(cherry picked from commit 93c14c55ec0da311dc09c1c8c1c7ecd5f2fae51a)

3 years agortld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc
Konstantin Belousov [Mon, 5 Apr 2021 04:12:22 +0000 (07:12 +0300)]
rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc

(cherry picked from commit 34ca6025ddfea9899024eb6e7617091c5bc5149a)

3 years agortld/x86/reloc.c: style
Konstantin Belousov [Wed, 7 Apr 2021 06:12:10 +0000 (09:12 +0300)]
rtld/x86/reloc.c: style

(cherry picked from commit f61ecf60cfce6172df803a9e5e099aab2d4aedcd)

3 years agortld_lock.h: remove tautological extern's
Konstantin Belousov [Mon, 5 Apr 2021 04:11:49 +0000 (07:11 +0300)]
rtld_lock.h: remove tautological extern's

(cherry picked from commit 38e0610df7d5cd5ddd43a477c139ec6ce342c5c2)

3 years agortld dl_iterate_phdr(): dlpi_tls_data is wrong
Konstantin Belousov [Mon, 5 Apr 2021 03:05:44 +0000 (06:05 +0300)]
rtld dl_iterate_phdr(): dlpi_tls_data is wrong

(cherry picked from commit d36d6816151705907393889d661cbfd25c630ca8)

3 years agolinuxkpi: remove erronously committed diff save file
Konstantin Belousov [Tue, 6 Apr 2021 00:42:13 +0000 (03:42 +0300)]
linuxkpi: remove erronously committed diff save file

(cherry picked from commit 5b3b19db7305f8255f021d6f8d94d17ab778660f)

3 years agolinuxkpi: drop single-use variable
Konstantin Belousov [Tue, 30 Mar 2021 08:46:42 +0000 (11:46 +0300)]
linuxkpi: drop single-use variable

(cherry picked from commit 8011fb795baa59ba14371d6db5ab661a5db77615)

3 years agolinuxkpi: avoid counting per-thread use for the embedded linux cdevs
Konstantin Belousov [Tue, 30 Mar 2021 08:45:24 +0000 (11:45 +0300)]
linuxkpi: avoid counting per-thread use for the embedded linux cdevs

(cherry picked from commit f6b108837e7df7d7bfb35ec447f7cb62afa79441)

3 years agolinuxkpi: do not destroy/free embedded linux cdevs
Konstantin Belousov [Tue, 30 Mar 2021 08:44:19 +0000 (11:44 +0300)]
linuxkpi: do not destroy/free embedded linux cdevs

(cherry picked from commit 7f9867f8c65b1b3e590dba4dc432a4bc8cf01f68)

3 years agolinuxkpi: rename cdev to ldev
Konstantin Belousov [Tue, 30 Mar 2021 08:43:21 +0000 (11:43 +0300)]
linuxkpi: rename cdev to ldev

(cherry picked from commit 28b482e2baf43cdd30e8b9bd090e6d9f405cf4b3)

3 years agolinuxkpi: copy ldev into local to test and free the same pointer
Konstantin Belousov [Tue, 30 Mar 2021 08:41:00 +0000 (11:41 +0300)]
linuxkpi: copy ldev into local to test and free the same pointer

(cherry picked from commit 7b0125cbec1579a0a1bf38f7abe583b5f6fd79e7)

3 years agoFix leak in libc NFSv4 ACL flags parsing
Andrew Walker [Tue, 20 Apr 2021 19:34:44 +0000 (15:34 -0400)]
Fix leak in libc NFSv4 ACL flags parsing

Free memory allocated by strdup() in parse_flags_verbose().

Submitted by: Andrew Walker <walker.aj325_gmail.com>
Reported by: valgrind
Reviewed by: allanjude, freqlabs, rpokala
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29871

(cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56)

3 years agotcp: Deal with DSACKs, and adjust rescue hole on success.
Richard Scheffenegger [Tue, 20 Apr 2021 12:53:56 +0000 (14:53 +0200)]
tcp: Deal with DSACKs, and adjust rescue hole on success.

When a rescue retransmission is successful, rather than
inserting new holes to the left of it, adjust the old
rescue entry to cover the missed sequence space.

Also, as snd_fack may be stale by that point, pull it forward
in order to never create a hole left of snd_una/th_ack.

Finally, with DSACKs, tcp_sack_doack() may be called
with new full ACKs but a DSACK block. Account for this
eventuality properly to keep sacked_bytes >= 0.

MFC after: 3 days
Reviewed By: kbowling, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29835

(cherry picked from commit a649f1f6fd7a098ab173a69fe87916c04a8c6f8d)

3 years agotcp: keep SACK scoreboard sorted when doing rescue retransmission
Richard Scheffenegger [Sun, 18 Apr 2021 20:14:14 +0000 (22:14 +0200)]
tcp: keep SACK scoreboard sorted when doing rescue retransmission

Reviewed By: tuexen, kbowling, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29825

(cherry picked from commit b87cf2bc841b2a336b7f0c6cd89573610412a84f)

3 years agopms(4): Limit maximum I/O size to 256KB instead of 1MB.
Alexander Motin [Fri, 16 Apr 2021 19:39:01 +0000 (15:39 -0400)]
pms(4): Limit maximum I/O size to 256KB instead of 1MB.

There is a weird limit of AGTIAPI_MAX_DMA_SEGS (128) S/G segments per
I/O since the initial driver import.  I don't know why it was added,
can only guess some hardware limitation, but in worst case it means
maximum I/O size of 508KB.  Respect it to be safe, rounding to 256KB.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 3e347834200b5d91a33384e696793e4ac20a44d4)

3 years agopms(4): Do not return CAM_REQ_CMP on errors.
Alexander Motin [Fri, 16 Apr 2021 19:16:09 +0000 (15:16 -0400)]
pms(4): Do not return CAM_REQ_CMP on errors.

It is a direct request for data corruptions, one report of which we
have received.  I am very surprised that only one.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 8434a65ce49bd6bc6779f0e57b0ce0f4bc46f48e)

3 years agorack: Fix ECN on finalizing session.
Richard Scheffenegger [Sat, 17 Apr 2021 18:16:06 +0000 (20:16 +0200)]
rack: Fix ECN on finalizing session.

Maintain code similarity between RACK and base stack
for ECN. This may not strictly be necessary, depending
when a state transition to FIN_WAIT_1 is done in RACK
after a shutdown() or close() syscall.

MFC after: 3 days
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29658

(cherry picked from commit 2e97826052d169f6e2e1d2f87b086f56d1cf2b0b)

3 years agotcp: Prepare PRR to work with NewReno LossRecovery
Richard Scheffenegger [Thu, 8 Apr 2021 16:52:20 +0000 (18:52 +0200)]
tcp: Prepare PRR to work with NewReno LossRecovery

Add proper PRR vnet declarations for consistency.
Also add pointer to tcpopt struct to tcp_do_prr_ack, in preparation
for it to deal with non-SACK window reduction (after loss).

No functional change.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29440

(cherry picked from commit 90cca08e91f54214747af0419c988aba868398ed)

3 years agotcp: Use PRR for ECN congestion recovery
Richard Scheffenegger [Fri, 26 Mar 2021 01:05:22 +0000 (02:05 +0100)]
tcp: Use PRR for ECN congestion recovery

MFC after: 2 weeks
Reviewed By: #transport, rrs
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28972

(cherry picked from commit b9f803b7d4b7ee3799ab94f66c02c3b6e58c153a)

3 years agotcp: Refactor PRR code
Richard Scheffenegger [Thu, 25 Mar 2021 22:58:46 +0000 (23:58 +0100)]
tcp: Refactor PRR code

No functional change intended.

MFC after: 2 weeks
Reviewed By: #transport, rrs
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29411

(cherry picked from commit eb3a59a83112f5fcd60aab44ac0ac68331b6aedf)

3 years agostats.7: Add dwatch(1) to the list
Fernando ApesteguĂ­a [Thu, 22 Apr 2021 13:54:45 +0000 (15:54 +0200)]
stats.7: Add dwatch(1) to the list

PR: 255303
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29924

(cherry picked from commit 2e5929a75634504d388cc04d24e6a558840e18cb)

3 years agozfs: merge openzfs/zfs@3522f57b6 (master)
Martin Matuska [Wed, 14 Apr 2021 10:49:10 +0000 (12:49 +0200)]
zfs: merge openzfs/zfs@3522f57b6 (master)

Notable upstream pull request merges:
  #11742 When specifying raidz vdev name, parity count should match
  #11744 Use a helper function to clarify gang block size
  #11771 Support running FreeBSD buildworld on Arm-based macOS hosts

This is the last update that will be MFCed into stable/13.

From now on, the tracking of OpenZFS branches will be different:
- main continues tracking openzfs/zfs/master
- stable/13 is going to track openzfs/zfs/zfs-2.1-release

Obtained from: OpenZFS

(cherry picked from commit 6db169e920810bf1d7e9bd2fad5da92bfb696677)

3 years agopowerpc64: add missing TLB invalidations to radix
Leandro Lupori [Tue, 6 Apr 2021 11:31:44 +0000 (08:31 -0300)]
powerpc64: add missing TLB invalidations to radix

Radix MMU code was missing TLB invalidations when some Level 3 PDEs were
modified. This caused TLB multi-hit machine check interrupts when
superpages were enabled.

Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D29511

(cherry picked from commit 28d14569c8735060d0a1646a3422562c0741ac44)

3 years agopowerpc64: clear low-order bits of ARPN
Leandro Lupori [Thu, 25 Mar 2021 16:30:56 +0000 (13:30 -0300)]
powerpc64: clear low-order bits of ARPN

PowerISA 2.07B says that the low-order p-12 bits of the real page number
contained in ARPN and LP fields of a PTE must be 0s and are ignored
by the hardware (Book III-S, 5.7.7.1), where 2^p is the actual page size
in bytes, but we were clearing only the LP field.

This worked on bare metal and QEMU with KVM, that ignore these bits,
but caused a kernel panic on QEMU with TCG, that expects them to be
cleared.

This fixes running FreeBSD with HPT superpages enabled on QEMU
with TCG.

Sponsored by: Eldorado Research Institute (eldorado.org.br)

(cherry picked from commit 3d0399c718b260da087d28825069f26d4f670065)

3 years agonfsd: fix replies from session cache for retried RPCs
Rick Macklem [Thu, 8 Apr 2021 21:04:22 +0000 (14:04 -0700)]
nfsd: fix replies from session cache for retried RPCs

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

The FreeBSD server failec to reply using the cached
reply in the session slot when an RPC was retried on
the session slot, as indicated by same slot sequence#.

This patch fixes this.  It should also fix a similar
failure for NFSv4.0 mounts, when the sequence# in
the open/lock_owner requires a reply be done from
an entry locked into the DRC.

This fix affects the fairly rare case where a NFSv4
client retries a non-idempotent RPC, such as a lock
operation.  Note that retries only occur after the
client has needed to create a new TCP connection.

(cherry picked from commit 05a39c2c1c18cd0c4382a4f58e0952d3f77e7dfa)

3 years agoAllow lib/msun/logarithm_test to pass on ld128 platforms
Alex Richardson [Mon, 19 Apr 2021 23:22:45 +0000 (00:22 +0100)]
Allow lib/msun/logarithm_test to pass on ld128 platforms

For some reason the ld128 log1pl() implementation is less accurate than
logl(), but does at least guarantee precision >= the ld80 implementation.
Mark log1p_accuracy_tests as XFAIL for ld128 and increase the log1p tolerance
to the ld80 equivalent in accuracy_tests to avoid losing test coverage for
the other functions.

PR: 253984
Reviewed By: ngie, dim
Differential Revision: https://reviews.freebsd.org/D29039

(cherry picked from commit 1ad83445fc0f1d2aecd32635f4ae713a057aa091)

3 years agoRemove XFAIL from tests/lib/msun/lround_test:main
Alex Richardson [Thu, 15 Apr 2021 15:07:58 +0000 (16:07 +0100)]
Remove XFAIL from tests/lib/msun/lround_test:main

This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c.

PR: 205451
MFC after: 1 week

(cherry picked from commit 062293c2c471c6affb46f0ba44e7b7ee5b77b591)

3 years agoRemove amd64 XFAIL from tests/lib/msun/fma_test:infinities
Alex Richardson [Thu, 15 Apr 2021 15:04:19 +0000 (16:04 +0100)]
Remove amd64 XFAIL from tests/lib/msun/fma_test:infinities

This test no longer fails after 3b00222f156dca5700c839d73e36daf479fa640c.

PR: 205448
MFC after: 1 week

(cherry picked from commit 3f01d8c2fe5d31866258c9872f35030d98828e48)

3 years agolib/msun: Exclude ignored-pragmas from -Werror
Alex Richardson [Thu, 15 Apr 2021 15:27:52 +0000 (16:27 +0100)]
lib/msun: Exclude ignored-pragmas from -Werror

This avoids build failures due to the clang 12 warning:
    '#pragma FENV_ACCESS' is not supported on this target - ignored

Clang 12 currently emits this warning for all non-x86 architectures.
While this can result in incorrect code generation (e.g. on AArch64 some
exceptions are not raised as expected), this is a pre-existing issue and
we should not fail the build due to this warning.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29743

(cherry picked from commit 168234fa67c38f898b784b3265dd77ace0b0a2f9)

3 years agolib/msun/tests: Drop WARNS=6
Alex Richardson [Mon, 22 Mar 2021 16:56:10 +0000 (16:56 +0000)]
lib/msun/tests: Drop WARNS=6

This is the default already, so there is no need to override it.

Reported by: kevans

(cherry picked from commit f33b4fa2f0d4acf3978c7490b25c999b319c543b)

3 years agolib/msun/tests: Re-enable csqrt_test on AArch64
Alex Richardson [Mon, 22 Mar 2021 16:54:38 +0000 (16:54 +0000)]
lib/msun/tests: Re-enable csqrt_test on AArch64

The LLVM bug was fixed a long time ago and with D29076 this test actually
passes now.

Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D29092

(cherry picked from commit dbb2d6f5e1231a9f6b49efdc720ce97b520da2ba)

3 years agoFix lib/msun/tests/csqrt_test on platforms with 128-bit long double
Alex Richardson [Mon, 22 Mar 2021 16:54:02 +0000 (16:54 +0000)]
Fix lib/msun/tests/csqrt_test on platforms with 128-bit long double

If long double has more than 64 mantissa bits, using uint64_t to hold the
mantissa bits will truncate the value and result in test failures. To fix
this problem use __uint128_t since all platforms that have
__LDBL_MANT_DIG__ > 64 also have compiler support for 128-bit integers.

Reviewed By: rlibby
Differential Revision: https://reviews.freebsd.org/D29076

(cherry picked from commit ce88eb476b86cac63cef7466bd71f14b611ab03a)

3 years agoFix unused functions in invtrig_test.c
Alex Richardson [Mon, 22 Mar 2021 13:05:28 +0000 (13:05 +0000)]
Fix unused functions in invtrig_test.c

I only tested the WARNS=6 change on AArch64 and AMD64, but this file has
unused functions for architectures with LDBL_PREC == 53.

While touching this file change the LDBL_PREC == 53 checks to i386 checks.
The long double tests should only be disabled for i386 (due to the rather
odd rounding mode that it uses) not all architectures where long double
is the same as double.

PR: 205449
Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6")
Reported by: Jenkins

(cherry picked from commit 7f5693d05329ab976287b8d449e694e7a0f99e88)

3 years agoDon't add -Winline for WARNS=6
Alex Richardson [Mon, 22 Mar 2021 11:55:45 +0000 (11:55 +0000)]
Don't add -Winline for WARNS=6

This warning is very rarely useful (inline is a hint and not mandatory).
This flag results in many warnings being printed when compiling C++
code that uses the standard library with GCC.

This flag was originally added in back in r94332 but the flag is a no-op
in Clang ("This diagnostic flag exists for GCC compatibility, and has no
effect in Clang"). Removing it should make the GCC build output slightly
more readable.

Reviewed By: jrtc27, imp
Differential Revision: https://reviews.freebsd.org/D29235

(cherry picked from commit c8c62548bffb83f3d25e062929c45d66fea755f1)

3 years agolib/msun/tests: Add more debug output to fenv_test.c
Alex Richardson [Thu, 4 Mar 2021 18:41:06 +0000 (18:41 +0000)]
lib/msun/tests: Add more debug output to fenv_test.c

Output a hex dump of the current fenv and the expected value to allow
comparing them without having to resort to interactive use of GDB.

(cherry picked from commit 6ccdee8ab576577224fb9e4baed05bd0efe933fd)

3 years agolib/msun/tests: Skip fenv_test:masking if exceptions can't be trapped
Alex Richardson [Mon, 22 Mar 2021 11:53:40 +0000 (11:53 +0000)]
lib/msun/tests: Skip fenv_test:masking if exceptions can't be trapped

Some CPUs (e.g. AArch64 QEMU) cannot trap on floating point exceptions and
therefore ignore the writes to the floating point control register inside
feenableexcept(). If no exceptions are enabled after
feenableexcept(FE_ALL_EXCEPT), we can assume that the CPU does not
support exceptions and we can then skip the test.

Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D29095

(cherry picked from commit 2b9dbcd390dfbd573d3403360a36c5ade9815266)

3 years agolib/msun: Allow building tests with WARNS=6
Alex Richardson [Thu, 25 Feb 2021 14:28:17 +0000 (14:28 +0000)]
lib/msun: Allow building tests with WARNS=6

The only change needed is to mark a few variables as static.

(cherry picked from commit 87d65c747a4389901c2bbbcb1ec4878b2df7b32c)