]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoFix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".
Kirk McKusick [Wed, 19 May 2021 21:38:21 +0000 (14:38 -0700)]
Fix fsck_ffs Pass 1b error exit "bad inode number 256 to nextinode".

Pass 1b of fsck_ffs runs only when Pass 1 has found duplicate blocks.
Pass 1 only knows that a block is duplicate when it finds the second
instance of its use. The role of Pass 1b is to find the first use
of all the duplicate blocks. It makes a pass over the cylinder groups
looking for these blocks. When moving to the next cylinder group,
Pass 1b failed to properly calculate the starting inode number for
the cylinder group resulting in the above error message when it
tried to read the first inode in the cylinder group.

Reported by:  Px
Tested by:    Px
PR:           255979
MFC after:    3 days
Sponsored by: Netflix

2 years agobsd-family-tree: Add NetBSD 9.2
Warner Losh [Wed, 19 May 2021 21:29:11 +0000 (15:29 -0600)]
bsd-family-tree: Add NetBSD 9.2

NetBSD 9.2 was released on May 12, 2021

Submitted by: Martin Husemann
Sponsored by: Netflix

2 years agotcsh: update to version 6.22.04.
Dmitry Chagin [Wed, 19 May 2021 21:12:27 +0000 (00:12 +0300)]
tcsh: update to version 6.22.04.

Merge commit '174d8b60324d7e8754709f7155e13ca95220b48c' into main.

MFC After: 2 weeks

2 years agotcsh: cleanup source tree to reduce diff size.
Dmitry Chagin [Wed, 19 May 2021 21:08:25 +0000 (00:08 +0300)]
tcsh: cleanup source tree to reduce diff size.

Remove makefiles, configure files and unused at build time files
to reduce the diff size. Otherwise the diff contains a lot of
unnecessary lines what makes reviewing and merging proccess so hard,
especially for re@.

MFC after: 2 weeks

2 years agoi2c(8): Add interpreted mode for batch/scripted i2c operations
Poul-Henning Kamp [Wed, 19 May 2021 18:56:59 +0000 (18:56 +0000)]
i2c(8): Add interpreted mode for batch/scripted i2c operations

2 years agoi2c(8): Change default mode to "transfer", which should work everywhere¹
Poul-Henning Kamp [Wed, 19 May 2021 18:48:28 +0000 (18:48 +0000)]
i2c(8): Change default mode to "transfer", which should work everywhere¹

¹ According to @ian

2 years agoi2c(8): Polish: sort switches, dont confuse address & offset
Poul-Henning Kamp [Wed, 19 May 2021 18:47:32 +0000 (18:47 +0000)]
i2c(8): Polish: sort switches, dont confuse address & offset

2 years agofdescfs: allow shared locking of root vnode
Mateusz Guzik [Wed, 19 May 2021 15:59:20 +0000 (17:59 +0200)]
fdescfs: allow shared locking of root vnode

Eliminates fdescfs from lock profile when running poudriere.

2 years agopseudofs: use vget_prep + vget_finish instead of vget + the interlock
Mateusz Guzik [Wed, 19 May 2021 14:20:23 +0000 (14:20 +0000)]
pseudofs: use vget_prep + vget_finish instead of vget + the interlock

2 years agomd5: Create md5sum, etc compatible programs
Warner Losh [Wed, 19 May 2021 17:26:20 +0000 (11:26 -0600)]
md5: Create md5sum, etc compatible programs

On Linux, there's a similar set of programs to ours, but that end in the
letters 'sum'. These act basically like FreeBSD versions run with the -r
option. Add code so that when the program ends in 'sum' you get the
linux -r behavior. This is enough to make most things that use sha*sum
work correctly (the -c / --check options, as well as the long args are
not implemented). When running with the -sum programs, ignore -t instead
of running internal speed tests and make -c an error.

Reviewed by: sef, and kp and allanjude (earlier version)
Relnotes: yes
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30309

2 years agoFix packet cbs/ebs conversion.
Alexander Motin [Wed, 19 May 2021 15:00:21 +0000 (11:00 -0400)]
Fix packet cbs/ebs conversion.

Each packet is counted as 128 bytes by the code, not 125.  Not sure
what I was thinking about here 14 years ago.  May be just a typo.

Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 2 weeks

3 years agorc.d: unbreak sysctl lastload
Eugene Grosbein [Wed, 19 May 2021 13:02:31 +0000 (20:02 +0700)]
rc.d: unbreak sysctl lastload

/etc/rc.d/securelevel is supposed to run /etc/rc.d/sysctl lastload
late at boot time to apply /etc/sysctl.conf settings that fail
to apply early. However, this does not work in default configuration
because of kern_securelevel_enable="NO" by default.

Add new script /etc/rc.d/sysctl lastload that starts unconditionally.

Reported by: Marek Zarychta
MFC after: 1 month

3 years agoarm64: rockchip, implement the two rk805/808 clocks
Bjoern A. Zeeb [Thu, 6 May 2021 14:25:52 +0000 (14:25 +0000)]
arm64: rockchip, implement the two rk805/808 clocks

While the xin32k clk was implemented in rk3399_cru as a fixed rate
clock, migrate it to rk805 as we will also need the 2nd clock
'rtc_clko_wifi' for SDIO and BT.
Both clocks remain fixed rate, and while the 1st one is always on
(though that is not expressed in the clk framework), the 2nd one
we can toggle on/off.

Reviewed-by: manu
Tested-by: manu
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26870

3 years agostress2: Added a new "mdconfig -o force" test scenario
Peter Holm [Wed, 19 May 2021 06:22:09 +0000 (08:22 +0200)]
stress2: Added a new "mdconfig -o force" test scenario

3 years agocxgbe(4): Remove some dead code.
Navdeep Parhar [Wed, 19 May 2021 06:16:03 +0000 (23:16 -0700)]
cxgbe(4): Remove some dead code.

MFC after: 3 days

3 years agonfsd: Reduce the callback timeout to 800msec
Rick Macklem [Tue, 18 May 2021 23:17:58 +0000 (16:17 -0700)]
nfsd: Reduce the callback timeout to 800msec

Recent discussion on the nfsv4@ietf.org mailing list confirmed
that an NFSv4 server should reply to an RPC in less than 1second.
If an NFSv4 RPC requires a delegation be recalled,
the server will attempt a CB_RECALL callback.
If the client is not responsive, the RPC reply will be delayed
until the callback times out.
Without this patch, the timeout is set to 4 seconds (set in
ticks, but used as seconds), resulting in the RPC reply taking over 4sec.
This patch redefines the constant as being in milliseconds and it
implements that for a value of 800msec, to ensure the RPC
reply is sent in less than 1second.

This patch only affects mounts from clients when delegations
are enabled on the server and the client is unresponsive to callbacks.

MFC after: 2 weeks

3 years agonfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open
Rick Macklem [Tue, 18 May 2021 22:53:54 +0000 (15:53 -0700)]
nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open

The Linux NFSv4.1/4.2 client now uses the CLAIM_DELEG_CUR_FH
variant of the Open operation when delegations are recalled and
the client has a local open of the file.  This patch adds
support for this variant of Open to the NFSv4.1/4.2 server.

This patch only affects mounts from Linux clients when delegations
are enabled on the server.

MFC after: 2 weeks

3 years agoDo not forward datagrams originated by link-local addresses
Zhenlei Huang [Tue, 18 May 2021 20:51:37 +0000 (22:51 +0200)]
Do not forward datagrams originated by link-local addresses

The current implement of ip_input() reject packets destined for
169.254.0.0/16, but not those original from 169.254.0.0/16 link-local
addresses.

Fix to fully respect RFC 3927 section 2.7.

PR: 255388
Reviewed by: donner, rgrimes, karels
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29968

3 years agong_parse: IP address parsing in netgraph eating too many characters
Markus Stoff [Tue, 18 May 2021 20:35:33 +0000 (22:35 +0200)]
ng_parse: IP address parsing in netgraph eating too many characters

Once the final component of the IP address has been parsed, the offset
on the input must not be advanced, as this would remove an unparsed
character from the input.

Submitted by: Markus Stoff
Reviewed by: donner
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D26489

3 years agotest/libalias: Tests for instantiation
Lutz Donnerhacke [Sun, 16 May 2021 21:37:37 +0000 (23:37 +0200)]
test/libalias: Tests for instantiation

In order to modify libalias for performance, the existing
functionality must not change.  Enforce this.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30307

3 years agosocket: Release cred reference later in sodealloc()
Lv Yunlong [Tue, 18 May 2021 19:23:15 +0000 (15:23 -0400)]
socket: Release cred reference later in sodealloc()

We dereference so->so_cred to update the per-uid socket buffer
accounting, so the crfree() call must be deferred until after that
point.

PR: 255869
MFC after: 1 week

3 years agodummynet: Fix mbuf tag allocation failure handling
Mark Johnston [Tue, 18 May 2021 19:22:21 +0000 (15:22 -0400)]
dummynet: Fix mbuf tag allocation failure handling

PR: 255875, 255878, 255879, 255880
Reviewed by: donner, kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30318

3 years agottydev_write: prevent stops while terminal is busied
Konstantin Belousov [Thu, 13 May 2021 01:35:06 +0000 (04:35 +0300)]
ttydev_write: prevent stops while terminal is busied

Since busy state is checked by all blocked writes, stopping a process
which waits in ttydisc_write() causes cascade.  Utilize sigdeferstop()
to avoid the issue.

Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
PR: 255816
MFC after: 1 week

3 years agovfs: refactor vdrop
Mateusz Guzik [Fri, 14 May 2021 19:01:32 +0000 (21:01 +0200)]
vfs: refactor vdrop

In particular move vunlazy into its own routine.

3 years agovfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_*
Mateusz Guzik [Fri, 14 May 2021 19:01:56 +0000 (21:01 +0200)]
vfs: change vn_freevnodes_* prefix to idiomatic vfs_freevnodes_*

3 years agoPropagate down USB explore error codes, so that failures to enumerate USB HUBs
Hans Petter Selasky [Tue, 18 May 2021 13:52:00 +0000 (15:52 +0200)]
Propagate down USB explore error codes, so that failures to enumerate USB HUBs
behind USB HUBs are detected and the USB reset counter logic will kick in
preventing enumeration of continuously failing ports.

Submitted by: phk@
Tested by: bz@
PR: 237666
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoUpdate USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which
Hans Petter Selasky [Tue, 18 May 2021 13:22:32 +0000 (15:22 +0200)]
Update USB_PORT_RESET_RECOVERY to comply with the USB 2.0 specification which
says it should be max 10 milliseconds.

This may fix some USB enumeration issues:
> usbd_req_re_enumerate: addr=3, set address failed! (USB_ERR_IOERROR, ignored)
> usbd_setup_device_desc: getting device descriptor at addr 3 failed,

Found by: Zhichao1.Li@dell.com
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoUpdate usb_timings_sysctl_handler() to accept any value for timings between
Hans Petter Selasky [Tue, 18 May 2021 13:16:29 +0000 (15:16 +0200)]
Update usb_timings_sysctl_handler() to accept any value for timings between
0 milliseconds and 2 seconds inclusivly. Some style fixes while at it.

The USB specification has minimum values and maximum values,
and not only minimum values.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agox86/xen: further PVHv1 removal cleanup
Roger Pau Monné [Tue, 18 May 2021 08:43:19 +0000 (10:43 +0200)]
x86/xen: further PVHv1 removal cleanup

The AP startup extern variable declarations are not longer needed,
since PVHv2 uses the native AP startup path using the lapic. Remove
the declaration and make the variables static to mp_machdep.c

Sponsored by: Citrix Systems R&D

3 years agosndstat.4: Improve manpage wording
Goran Mekić [Tue, 18 May 2021 07:34:34 +0000 (15:34 +0800)]
sndstat.4: Improve manpage wording

Reviewed by:    bcr, khng
Differential Revision: https://reviews.freebsd.org/D30027

3 years agoFix buffer overflow in preloaded hostuuid cleaning
Colin Percival [Fri, 14 May 2021 18:07:37 +0000 (11:07 -0700)]
Fix buffer overflow in preloaded hostuuid cleaning

When a module of type "hostuuid" is provided by the loader,
prison0_init strips any trailing whitespace and ASCII control
characters by (a) adjusting the buffer length, and (b) zeroing out
the characters in question, before storing it as the system's
hostuuid.

The buffer length adjustment was correct, but the zeroing overwrote
one byte higher in memory than intended -- in the typical case,
zeroing one byte past the end of the hostuuid buffer.  Due to the
layout of buffers passed by the boot loader to the kernel, this will
be the first byte of a subsequent buffer.

This was *probably* harmless; prison0_init runs after preloaded kernel
modules have been linked and after the preloaded /boot/entropy cache
has been processed, so in both cases having the first byte overwritten
will not cause problems.  We cannot however rule out the possibility
that other objects which are preloaded by the loader could suffer from
having the first byte overwritten.

Since the zeroing does not in fact serve any purpose, remove it and
trim trailing whitespace and ASCII control characters by adjusting
the buffer length alone.

Fixes: c3188289 Preload hostuuid for early-boot use
Reviewed by: kevans, markj
MFC after: 3 days

3 years agoFix 'hostuuid: preload data malformed' warning
Colin Percival [Sat, 15 May 2021 05:57:38 +0000 (22:57 -0700)]
Fix 'hostuuid: preload data malformed' warning

If the preloaded hostuuid value is invalid and verbose booting is
enabled, a warning is printed.  This printf had two bugs:

1. It was missing a trailing \n character.
2. The malformed UUID is printed with %s even though it is not known
to be NUL-terminated.

This commit adds the missing \n and uses %.*s with the (already known)
length of the preloaded UUID to ensure that we don't read past the end
of the buffer.

Reported by: kevans
Fixes: c3188289 Preload hostuuid for early-boot use
MFC after: 3 days

3 years agocxgbe: Cast pointer arguments to trunc_page() to vm_offset_t.
John Baldwin [Tue, 18 May 2021 00:04:22 +0000 (17:04 -0700)]
cxgbe: Cast pointer arguments to trunc_page() to vm_offset_t.

Reported by: mjg, jenkins, rmacklem
Fixes: 46bee8043ee2bd352d420cd573e0364ca45f813e
Sponsored by: Chelsio Communications

3 years agoCorrect assert added to dump program.
Kirk McKusick [Mon, 17 May 2021 23:33:59 +0000 (16:33 -0700)]
Correct assert added to dump program.

The dump program was exiting with the message:

Assertion failed: (spcl.c_count + blks < TP_NINDIR), function appendextdata, file /usr/src/sbin/dump/traverse.c, line 759.

The problem arose when dumping external attributes.

This assertion was added in this commit with no review by someone
with expertise in the dump program:

    commit 2d518c6518cdb256ff6f2c463e6b115d89c104c3
    Author:     Warner Losh <imp@FreeBSD.org>
    AuthorDate: Mon Jun 11 19:32:36 2018 +0000
    Commit:     Warner Losh <imp@FreeBSD.org>
    CommitDate: Mon Jun 11 19:32:36 2018 +0000

Add asserts to prevent overflows of c_addr.

It is clearly wrong as the statement immediately above it in the
code which is deciding if the data will fit is:

if (spcl.c_count + blks > TP_NINDIR)
return (0);

As is pointed out in the bug report, the assert should be:

(spcl.c_count + blks <= TP_NINDIR)

This commit corrects the assert. I am sorry that it took so long to
be brought to my attention and get fixed.

Reported by:  Hampton Finger
PR:           244470
MFC after:    3 days
Sponsored by: Netflix

3 years agoipfw: reload sysctl.conf variables if needed
Eugene Grosbein [Mon, 17 May 2021 21:03:15 +0000 (04:03 +0700)]
ipfw: reload sysctl.conf variables if needed

Currently ipfw has multiple components that are not parts
of GENERIC kernel like dummynet etc. They can bring in important
sysctls if enabled with rc.conf(5) and loaded with ipfw startup script
by means of "required_modules" after initial consult
with /etc/sysctl.conf at boot time. Here is an example of one
increasing limit for dummynet hold queues that defaults to 100:

net.inet.ip.dummynet.pipe_slot_limit=1000

This makes it possible to use ipfw/dummynet rules such as:

ipfw pipe 1 config bw 50Mbit/s queue 1000

Such rule is rejected unless above sysctl is applied.
Another example is a group of net.inet.ip.alias.* sysctls
created after libalias.ko loaded as dependency of ipfw_nat.

This is not a problem if corresponding code compiled in custom kernel
so sysctls exist when sysctl.conf is read early or kernel modules
loaded with a loader. This change makes it work also for GENERIC
and modules loaded by means of rc.conf(5) settings.

MFC after: 1 month

3 years agoxen: Remove leftover bits missed in commit ac3ede5371
Mark Johnston [Mon, 17 May 2021 17:05:58 +0000 (13:05 -0400)]
xen: Remove leftover bits missed in commit ac3ede5371

Fixes: ac3ede5371 ("x86/xen: remove PVHv1 code")
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D30316

3 years agodummynet: Remove unused code
Kristof Provost [Mon, 17 May 2021 11:41:39 +0000 (13:41 +0200)]
dummynet: Remove unused code

We never set 'busy' and never dequeue from the pending mq. Remove this
code.

Reviewed by: ae
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30313

3 years agopf tests: More set skip on <ifgroup> tests
Kristof Provost [Sun, 16 May 2021 06:51:54 +0000 (08:51 +0200)]
pf tests: More set skip on <ifgroup> tests

Test the specific case reported in PR 255852. Clearing the skip flag
on groups was broken because pfctl couldn't work out if a kif was a
group or not, because the kernel no longer set the pfik_group pointer.

PR: 255852
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30285

3 years agopf: Set the pfik_group for userspace
Kristof Provost [Sun, 16 May 2021 06:50:17 +0000 (08:50 +0200)]
pf: Set the pfik_group for userspace

Userspace relies on this pointer to work out if the kif is a group or
not. It can't use it for anything else, because it's a pointer to a
kernel address. Substitute 0xfeedc0de for 'true', so that we don't leak
kernel memory addresses to userspace.

PR: 255852
Reviewed by: donner
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30284

3 years agoFix locking in qoriq_gpio
Justin Hibbits [Mon, 17 May 2021 13:22:30 +0000 (08:22 -0500)]
Fix locking in qoriq_gpio

qoriq_gpio_pin_setflags() locks the device mutex, as does
qoriq_gpio_map_gpios(), causing a recursion on non-recursive lock.  This
was missed during testing for 16e549ebe.

3 years agoMake ISA_206_ATOMICS a kernel option
Justin Hibbits [Mon, 17 May 2021 13:46:33 +0000 (08:46 -0500)]
Make ISA_206_ATOMICS a kernel option

Summary:
To make it easier to build a kernel with PowerISA 2.06 atomics (sub-word
atomics), add a kernel config option.  User space still needs to specify
it as a CFLAG but that seems easier to do than for the kernel config.

Reviewed By: luporl
Differential Revision: https://reviews.freebsd.org/D29809

3 years agopowerpc: Rework IPI message processing
Justin Hibbits [Tue, 27 Apr 2021 00:10:41 +0000 (19:10 -0500)]
powerpc: Rework IPI message processing

Summary:
There's no need to use a while loop in the IPI handler, the message list
is cached once and processed.  Instead, since the existing code calls
ffs(), sort the handlers, and use a simple 'if' sequence.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D30018

3 years agopowerpc64/radix mmu: Remove dead variable
Justin Hibbits [Mon, 10 May 2021 00:37:42 +0000 (19:37 -0500)]
powerpc64/radix mmu: Remove dead variable

Remove dead variable from mmu_radix_extract_and_hold().  Based on
r352408 for amd64.

3 years agox86/xen: remove PVHv1 code
Roger Pau Monné [Wed, 12 May 2021 10:17:53 +0000 (12:17 +0200)]
x86/xen: remove PVHv1 code

PVHv1 was officially removed from Xen in 4.9, so just axe the related
code from FreeBSD.

Note FreeBSD supports PVHv2, which is the replacement for PVHv1.

Sponsored by: Citrix Systems R&D
Reviewed by: kib, Elliott Mitchell
Differential Revision: https://reviews.freebsd.org/D30228

3 years agoxen: remove hypervisor_info
Mitchell Horne [Thu, 6 May 2021 21:16:10 +0000 (18:16 -0300)]
xen: remove hypervisor_info

This was a source of indirection needed to support PVHv1. Now that that
support has been removed, we can eliminate it.

Reviewed by: royger

3 years agoxen: remove support for PVHv1 bootpath
Mitchell Horne [Thu, 6 May 2021 20:45:40 +0000 (17:45 -0300)]
xen: remove support for PVHv1 bootpath

PVHv1 is a legacy interface supported only by Xen versions 4.4 through
4.9.

Reviewed by: royger

3 years agoAdd myself (ygy) as a ports committer
Guangyuan Yang [Mon, 17 May 2021 03:54:25 +0000 (23:54 -0400)]
Add myself (ygy) as a ports committer

Approved by: lwhsu (mentor)
Differential Revision: https://reviews.freebsd.org/D30308

3 years agolinux: Fix a mistake in commit fb58045145
Mark Johnston [Mon, 17 May 2021 02:17:53 +0000 (22:17 -0400)]
linux: Fix a mistake in commit fb58045145

The change to futex_andl_smap() should have ordered stac before the
load from a user address, otherwise it does not fix anything.

Fixes: fb58045145 ("linux: Fix SMAP-enabled futex routines")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agovirtio_scsi: Zero stack-allocated CCBs
Mark Johnston [Mon, 17 May 2021 02:14:41 +0000 (22:14 -0400)]
virtio_scsi: Zero stack-allocated CCBs

Fixes: 3394d4239b ("cam: allocate CCBs from UMA for SCSI and ATA IO")
Reported by: syzbot+2e9ce63919709feb3d1c@syzkaller.appspotmail.com
Reviewed by: trasz
Sponsored by: The FreeBSD Foundation

3 years agoFix handling of embedded symbolic links (and history lesson).
Kirk McKusick [Mon, 17 May 2021 00:02:42 +0000 (17:02 -0700)]
Fix handling of embedded symbolic links (and history lesson).

The original filesystem release (4.2BSD) had no embedded sysmlinks.
Historically symbolic links were just a different type of file, so
the content of the symbolic link was contained in a single disk block
fragment. We observed that most symbolic links were short enough that
they could fit in the area of the inode that normally holds the block
pointers. So we created embedded symlinks where the content of the
link was held in the inode's pointer area thus avoiding the need to
seek and read a data fragment and reducing the pressure on the block
cache. At the time we had only UFS1 with 32-bit block pointers,
so the test for a fastlink was:

di_size < (NDADDR + NIADDR) * sizeof(daddr_t)

(where daddr_t would be ufs1_daddr_t today).

When embedded symlinks were added, a spare field in the superblock
with a known zero value became fs_maxsymlinklen. New filesystems
set this field to (NDADDR + NIADDR) * sizeof(daddr_t). Embedded
symlinks were assumed when di_size < fs->fs_maxsymlinklen. Thus
filesystems that preceeded this change always read from blocks
(since fs->fs_maxsymlinklen == 0) and newer ones used embedded
symlinks if they fit. Similarly symlinks created on pre-embedded
symlink filesystems always spill into blocks while newer ones will
embed if they fit.

At the same time that the embedded symbolic links were added, the
on-disk directory structure was changed splitting the former
u_int16_t d_namlen into u_int8_t d_type and u_int8_t d_namlen.
Thus fs_maxsymlinklen <= 0 (as used by the OFSFMT() macro) can
be used to distinguish old directory formats. In retrospect that
should have just been an added flag, but we did not realize we
needed to know about that change until it was already in production.

Code was split into ufs/ffs so that the log structured filesystem could
use ufs functionality while doing its own disk layout. This meant
that no ffs superblock fields could be used in the ufs code. Thus
ffs superblock fields that were needed in ufs code had to be copied
to fields in the mount structure. Since ufs_readlink needed to know
if a link was embedded, fs_maxlinklen gets copied to mnt_maxsymlinklen.

The kernel panic that arose to making this fix was triggered when a
disk error created an inode of type symlink with no allocated data
blocks but a large size. When readlink was called the uiomove was
attempted which segment faulted.

static int
ufs_readlink(ap)
struct vop_readlink_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
doff_t isize;

isize = ip->i_size;
if ((isize < vp->v_mount->mnt_maxsymlinklen) ||
    DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */
return (uiomove(SHORTLINK(ip), isize, ap->a_uio));
}
return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
}

The second part of the "if" statement that adds

DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */

is problematic. It never appeared in BSD released by Berkeley because
as noted above mnt_maxsymlinklen is 0 for old format filesystems, so
will always fall through to the VOP_READ as it should. I had to dig
back through `git blame' to find that Rodney Grimes added it as
part of ``The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.''
He must have brought it across from an earlier FreeBSD. Unfortunately
the source-control logs for FreeBSD up to the merger with the
AT&T-blessed 4.4BSD-Lite conversion were destroyed as part of the
agreement to let FreeBSD remain unencumbered, so I cannot pin-point
where that line got added on the FreeBSD side.

The one change needed here is that mnt_maxsymlinklen is declared as
an `int' and should be changed to be `u_int64_t'.

This discovery led us to check out the code that deletes symbolic
links. Specifically

if (vp->v_type == VLNK &&
    (ip->i_size < vp->v_mount->mnt_maxsymlinklen ||
     datablocks == 0)) {
if (length != 0)
panic("ffs_truncate: partial truncate of symlink");
bzero(SHORTLINK(ip), (u_int)ip->i_size);
ip->i_size = 0;
DIP_SET(ip, i_size, 0);
UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE);
if (needextclean)
goto extclean;
return (ffs_update(vp, waitforupdate));
}

Here too our broken symlink inode with no data blocks allocated
and a large size will segment fault as we are incorrectly using the
test that we have no data blocks to decide that it is an embdedded
symbolic link and attempting to bzero past the end of the inode.
The test for datablocks == 0 is unnecessary as the test for
ip->i_size < vp->v_mount->mnt_maxsymlinklen will do the right
thing in all cases.

The test for datablocks == 0 was added by David Greenman in this commit:

Author: David Greenman <dg@FreeBSD.org>
Date:   Tue Aug 2 13:51:05 1994 +0000

    Completed (hopefully) the kernel support for old style "fastlinks".

    Notes:
svn path=/head/; revision=1821

I am guessing that he likely earlier added the incorrect test in the
ufs_readlink code.

I asked David if he had any recollection of why he made this change.
Amazingly, he still had a recollection of why he had made a one-line
change more than twenty years ago. And unsurpisingly it was because
he had been stuck between a rock and a hard place.

FreeBSD was up to 1.1.5 before the switch to the 4.4BSD-Lite code
base. Prior to that, there were three years of development in all
areas of the kernel, including the filesystem code, from the combined
set of people including Bill Jolitz, Patchkit contributors, and
FreeBSD Project members. The compatibility issue at hand was caused
by the FASTLINKS patches from Curt Mayer. In merging in the 4.4BSD-Lite
changes David had to find a way to provide compatibility with both
the changes that had been made in FreeBSD 1.1.5 and with 4.4BSD-Lite.
He felt that these changes would provide compatibility with both systems.

In his words:
``My recollection is that the 'FASTLINKS' symlinks support in
FreeBSD-1.x, as implemented by Curt Mayer, worked differently than
4.4BSD. He used a spare field in the inode to duplicately store the
length. When the 4.4BSD-Lite merge was done, the optimized symlinks
support for existing filesystems (those that were initialized in
FreeBSD-1.x) were broken due to the FFS on-disk structure of
4.4BSD-Lite differing from FreeBSD-1.x. My commit was needed to
restore the backward compatibility with FreeBSD-1.x filesystems.
I think it was the best that could be done in the somewhat urgent
circumstances of the post Berkeley-USL settlement. Also, regarding
Rod's massive commit with little explanation, some context: John
Dyson and I did the initial re-port of the 4.4BSD-Lite kernel to
the 386 platform in just 10 days. It was by far the most intense
hacking effort of my life. In addition to the porting of tons of
FreeBSD-1 code, I think we wrote more than 30,000 lines of new code
in that time to deal with the missing pieces and architectural
changes of 4.4BSD-Lite. We didn't make many notes along the way.
There was a lot of pressure to get something out to the rest of the
developer community as fast as possible, so detailed discrete commits
didn't happen - it all came as a giant wad, which is why Rod's
commit message was worded the way it was.''

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
History by:   David Greenman Lawrence
MFC after:    1 week
Sponsored by: Netflix

3 years agoNFSv4 server: Re-establish the delegation recall timeout
Rick Macklem [Sun, 16 May 2021 23:40:01 +0000 (16:40 -0700)]
NFSv4 server: Re-establish the delegation recall timeout

Commit 7a606f280a3e allowed the server to do retries of CB_RECALL
callbacks every couple of seconds.  This was needed to allow the
Linux client to re-establish the back channel.
However this patch broke the delegation timeout check, such that
it would just keep retrying CB_RECALLS.
If the client has crashed or been network patitioned from the
server, this continues until the client TCP reconnects to
the server and re-establishes the back channel.

This patch modifies the code such that it still times out the
delegation recall after some minutes, so that the server will
allow the conflicting client request once the delegation times out.

This patch only affects the NFSv4 server when delegations are
enabled and a NFSv4 client that holds a delegation has crashed
or been network partitioned from the server for at least several
minutes when a delegation needs to be recalled.

MFC after: 2 weeks

3 years agocam: turn KASSERTs into printfs for now
Edward Tomasz Napierala [Sun, 16 May 2021 19:11:46 +0000 (20:11 +0100)]
cam: turn KASSERTs into printfs for now

It looks like I've missed a couple of places where we don't clear
stack-allocated CCBs.  Don't panic when that happens, just print
a warning.

This is a temporary measure until I get those cases fixed.

Reviewed By: markj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30296

3 years agolinux: Fix SMAP-enabled futex routines
Mark Johnston [Sun, 16 May 2021 17:41:41 +0000 (13:41 -0400)]
linux: Fix SMAP-enabled futex routines

Some of them were dereferencing the user pointer before disabling SMAP.

PR: 255591
Reviewed by: kib
Tested by: pitwuu@gmail.com
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30276

3 years agonetgraph/ng_checksum: Fix double free error
Lutz Donnerhacke [Sat, 15 May 2021 09:32:57 +0000 (11:32 +0200)]
netgraph/ng_checksum: Fix double free error

m_pullup(9) frees the mbuf(9) chain in the case of an allocation error.
The mbuf chain must not be freed again in this case.

PR: 255874
Submitted by: <lylgood@foxmail.com>
Approved by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30273

3 years agocam: Fix race condition in dainit()
Edward Tomasz Napierala [Sun, 16 May 2021 09:35:31 +0000 (10:35 +0100)]
cam: Fix race condition in dainit()

Previously, daregister() could have been called before dainit()
initialized the UMA zone.  This would trip a KASSERT.

Reported By: pho
Tested By: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agocam: add missing zeroing of a stack-allocated CCB.
Edward Tomasz Napierala [Sun, 16 May 2021 09:28:04 +0000 (10:28 +0100)]
cam: add missing zeroing of a stack-allocated CCB.

This could cause a panic at boot.

Reported By: Shawn Webb <shawn.webb AT hardenedbsd.org>
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

3 years agoloader: gfx_fb_drawrect should use GfxFbBltVideoFill
Toomas Soome [Tue, 11 May 2021 18:05:12 +0000 (21:05 +0300)]
loader: gfx_fb_drawrect should use GfxFbBltVideoFill

The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very
slow on some systems. Use Blt() video fill primitive instead.

Testing done: Tested on mac mini 2012 where the issue was revealed

Reviewed by: yuripv
MFC after: 1 week

3 years agokerberos.8: Replace dead link
Guangyuan Yang [Sun, 16 May 2021 05:37:09 +0000 (01:37 -0400)]
kerberos.8: Replace dead link

Replace it with a tutorial hosted on kerberos.org and the classic
"dialogue" from Bill Bryant. The change has been reported and
merged upstream (https://github.com/heimdal/heimdal/commit/7f3445f1b7).

MFC after: 3 days
PR: 251854
Reported by: ktullavik@gmail.com
Submitted by: bjk (upstream github)
Reviewed by: bcr

3 years agolibalias: Ensure ASSERT behind varable declarations
Lutz Donnerhacke [Sat, 15 May 2021 22:49:11 +0000 (00:49 +0200)]
libalias: Ensure ASSERT behind varable declarations

At some places the ASSERT was inserted before variable declarations are
finished.  This is fixed now.

Reported by: kib
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30282

3 years agotmpfs: reimplement the mtime scan to use the lazy list
Mateusz Guzik [Fri, 7 May 2021 14:43:43 +0000 (14:43 +0000)]
tmpfs: reimplement the mtime scan to use the lazy list

Tested by: pho
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30065

3 years agovm: add another pager private flag
Mateusz Guzik [Fri, 14 May 2021 07:50:10 +0000 (09:50 +0200)]
vm: add another pager private flag

Move OBJ_SHADOWLIST around to let pager flags be next to each other.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D30258

3 years agobuild(7): use a more relevant example for PORTS_MODULES
Mitchell Horne [Sat, 15 May 2021 14:14:52 +0000 (11:14 -0300)]
build(7): use a more relevant example for PORTS_MODULES

emulators/kqemu-kmod no longer exists in the ports tree.

Reviewed by: imp, bcr
Differential Revision: https://reviews.freebsd.org/D30261

3 years agocam: allocate CCBs from UMA for SCSI and ATA IO
Edward Tomasz Napierala [Sat, 15 May 2021 10:17:22 +0000 (11:17 +0100)]
cam: allocate CCBs from UMA for SCSI and ATA IO

This patch makes it possible for CAM to use small CCBs allocated
from an periph-specific UMA zone instead of the usual, huge ones.
The end result is that CCBs issued via da(4) take 544B (size of
ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB,
rounded up by malloc(9)).  For ATA it's 272B.  We waste less
memory, we avoid zeroing the unused 1kB, and it should be easier
to allocate those CCBs in low memory conditions.  It should also
be possible to use uma_zone_reserve(9) to improve behaviour
in low memory conditions even further.

Note that this does not change the size, or the layout, of CCBs
as such.  CCBs get allocated in various different ways, in particular
on the stack, and I don't want to redo all that.  Instead, this
provides an opt-in mechanism for the periph to declare "my start()
callback is fine with receiving a CCB allocated from this UMA zone".
In other words, most of the code works exactly as it used to; the
change only happens to IOs issued by xpt_run_allockq(), which
is - conveniently - pretty much all that matters for performance.

The reason for doing it this way is that it's pretty small, localized
change, and can be implemented gradually and iteratively: take a
periph, make sure its start() callback only casts the CCBs it takes
to a particular type of CCB, for example ccb_scsiio, and that it only
casts CCBs returned by cam_periph_getccb() to that type, then add UMA
zone for that size, and declare it safe to XPT.

This is disabled by default.  Set 'kern.cam.ada.enable_uma_ccbs=1'
and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it.  Testing
is welcome; I will flip the default to enable in two weeks from now.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28674

3 years agolibalias: replace placeholder with static constant
Lutz Donnerhacke [Thu, 13 May 2021 21:47:57 +0000 (23:47 +0200)]
libalias: replace placeholder with static constant

The field nullAddress in struct libalias is never set and never used.
It exists as a placeholder for an unused argument only.

Reviewed by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30253

3 years agolibalias: Style cleanup
Lutz Donnerhacke [Fri, 14 May 2021 13:08:08 +0000 (15:08 +0200)]
libalias: Style cleanup

libalias is a convolut of various coding styles modified by a series
of different editors enforcing interesting convetions on spacing and
comments.

This patch is a baseline to start with a perfomance rework of
libalias.  Upcoming patches should be focus on the code, not on the
style.  That's why most annoying style errors should be fixed
beforehand.

Reviewed by: hselasky
Discussed by: emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30259

3 years agofstyp(8): define HAVE_ZFS macro when built with zfs
Robert Wing [Wed, 12 May 2021 02:57:24 +0000 (18:57 -0800)]
fstyp(8): define HAVE_ZFS macro when built with zfs

The HAVE_ZFS macro was dropped from the Makefile during the OpenZFS
merge, bring it back.

While here, drop unused WARNS setting.

PR:             255616
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Submitted by:   Michael Büker <freebsd@michael-bueker.de>
Fixes: 9e5787d2284e187abb5b654d924394a65772e004
Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D30221

3 years agogit-arc(1): fix usage formatting for stage command
Mitchell Horne [Fri, 14 May 2021 20:32:47 +0000 (17:32 -0300)]
git-arc(1): fix usage formatting for stage command

The branch argument is conditional on the -b flag.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D30262

3 years agocxgbei: Handle target transfers with excess unsolicited data.
John Baldwin [Fri, 14 May 2021 19:20:57 +0000 (12:20 -0700)]
cxgbei: Handle target transfers with excess unsolicited data.

The CTL frontend might have provided a buffer that is smaller than the
FirstBurstLength and thus smaller than the amount of unsolicited data
included in the request PDU.  Treat these transfers as an empty
transfer.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

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

3 years agocxgbei: Explicitly clear the page pode reservation pointer after freeing it.
John Baldwin [Fri, 14 May 2021 19:20:51 +0000 (12:20 -0700)]
cxgbei: Explicitly clear the page pode reservation pointer after freeing it.

A single union ctl_io can be reused across multiple transfers (in
particular by the ramdisk backend).  On a reuse, the reservation
pointer would retain its value from the previous transfer tripping an
assertion.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

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

3 years agocxgbei: Don't clamp iSCSI PDUs to 8K.
John Baldwin [Fri, 14 May 2021 19:17:31 +0000 (12:17 -0700)]
cxgbei: Don't clamp iSCSI PDUs to 8K.

The firmware no longer requires this workaround.

Discussed with: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29912

3 years agocxgbei: Don't leak resources for an aborted target transfer.
John Baldwin [Fri, 14 May 2021 19:17:26 +0000 (12:17 -0700)]
cxgbei: Don't leak resources for an aborted target transfer.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29911

3 years agocxgbei: Add support for zero-copy iSCSI target transmission/read.
John Baldwin [Fri, 14 May 2021 19:17:20 +0000 (12:17 -0700)]
cxgbei: Add support for zero-copy iSCSI target transmission/read.

- Switch to allocating the cxgbei version of icl_pdu explicitly
  as a separate refcounted object allocated via malloc/free
  instead of storing it in the bhs mbuf prior to the bhs.

- Support the icl_conn_pdu_queue_cb() method to set a callback
  on a PDU to be invoked when the PDU is freed.

- For ICL_NOCOPY buffers, use an external mbuf to manage the
  storage for the buffer via m_extaddref().  Each external mbuf
  holds a reference on the associated PDU, so the callback is
  invoked once all of the external mbufs have been freed.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29910

3 years agocxgbei: Rework the pdu_append_data hook to support M_WAITOK.
John Baldwin [Fri, 14 May 2021 19:17:14 +0000 (12:17 -0700)]
cxgbei: Rework the pdu_append_data hook to support M_WAITOK.

- Only allocate 16K jumbo mbufs if the region of data to be
  appended is sufficiently large, and use a loop.

- Use m_getm2() to allocate a chain for data less than 16K, or
  if m_getjcl() fails.

- Use ENOMEM as the return value instead of '1' if the hook fails due
  to a memory allocation error.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29909

3 years agocxgbei: Support DDP for target I/O S/G lists with more than one entry.
John Baldwin [Fri, 14 May 2021 19:17:06 +0000 (12:17 -0700)]
cxgbei: Support DDP for target I/O S/G lists with more than one entry.

A CAM target layer I/O CCB can use a S/G list of virtual address ranges
to describe its data buffer.  This change adds zero-copy receive support
for such requests.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29908

3 years agocxgbe tom: Account for pre-iSCSI mode data on suspended connections.
John Baldwin [Fri, 14 May 2021 19:17:02 +0000 (12:17 -0700)]
cxgbe tom: Account for pre-iSCSI mode data on suspended connections.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29907

3 years agocxgbei: Whitespace fixes, comment typo, and rewrap a comment.
John Baldwin [Fri, 14 May 2021 19:16:57 +0000 (12:16 -0700)]
cxgbei: Whitespace fixes, comment typo, and rewrap a comment.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29906

3 years agocxgbei: Use hardware RX flow control for offloaded iSCSI connections.
John Baldwin [Fri, 14 May 2021 19:16:51 +0000 (12:16 -0700)]
cxgbei: Use hardware RX flow control for offloaded iSCSI connections.

Forthcoming T6 iSCSI DDP support requires hardware RX flow control.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29905

3 years agocxgbe tom: Set the tid in the work requests to program page pods for iSCSI.
John Baldwin [Fri, 14 May 2021 19:16:40 +0000 (12:16 -0700)]
cxgbe tom: Set the tid in the work requests to program page pods for iSCSI.

As a result, CPL_FW4_ACK now returns credits for these work requests.
To support this, page pod work requests are now constructed in special
mbufs similar to "raw" mbufs used for NIC TLS in plain TX queues.
These special mbufs are stored in the ulp_pduq and dispatched in order
with PDU work requests.

Sponsored by: Chelsio Communications
Discussed with: np
Differential Revision: https://reviews.freebsd.org/D29904

3 years agocxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter.
John Baldwin [Fri, 14 May 2021 19:16:33 +0000 (12:16 -0700)]
cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29903

3 years agoFix a use after free in update_rtm_from_rc().
Alexander V. Chernikov [Fri, 14 May 2021 16:03:08 +0000 (16:03 +0000)]
Fix a use after free in update_rtm_from_rc().

update_rtm_from_rc() calls update_rtm_from_info() internally.
The latter one may update provided prtm pointer with a new rtm.
Reassign rtm from prtm afeter calling update_rtm_from_info() to
 avoid touching the freed rtm.

PR: 255871
Submitted by: lylgood@foxmail.com
MFC after: 3 days

3 years agovfs: add missing atomic conversion to writecount adjustment
Mateusz Guzik [Fri, 14 May 2021 15:41:39 +0000 (17:41 +0200)]
vfs: add missing atomic conversion to writecount adjustment

Fixes: ("vfs: lockless writecount adjustment in set/unset text")

3 years agoImplement own command line option for the frequently used -i usbusX -f Y syntax,
Hans Petter Selasky [Fri, 14 May 2021 15:12:57 +0000 (17:12 +0200)]
Implement own command line option for the frequently used -i usbusX -f Y syntax,
-d ugenX.Y, similar to what usbconfig(8) does.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoUpdate ugen(4) manual page.
Hans Petter Selasky [Fri, 14 May 2021 14:34:15 +0000 (16:34 +0200)]
Update ugen(4) manual page.

Fix description of generic USB character devices.

PR: 244842
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agovfs: add more safety against concurrent forced unmount to vn_write
Mateusz Guzik [Fri, 14 May 2021 11:26:56 +0000 (13:26 +0200)]
vfs: add more safety against concurrent forced unmount to vn_write

1. stop re-reading ->v_mount (can become NULL)
2. stop re-reading ->v_type (can change to VBAD)

3 years agovfs: lockless writecount adjustment in set/unset text
Mateusz Guzik [Fri, 7 May 2021 14:04:27 +0000 (16:04 +0200)]
vfs: lockless writecount adjustment in set/unset text

... for cases where this is not the first/last exec.

3 years agokqueue timer: Remove detached knotes from the process stop queue
Mark Johnston [Fri, 14 May 2021 14:07:56 +0000 (10:07 -0400)]
kqueue timer: Remove detached knotes from the process stop queue

There are some scenarios where a timer event may be detached when it is
on the process' kqueue timer stop queue.  If kqtimer_proc_continue() is
called after that point, it will iterate over the queue and access freed
timer structures.

It is also possible, at least in a multithreaded program, for a stopped
timer event to be scheduled without removing it from the process' stop
queue.  Ensure that we do not doubly enqueue the event structure in this
case.

Reported by: syzbot+cea0931bb4e34cd728bd@syzkaller.appspotmail.com
Reported by: syzbot+9e1a2f3734652015998c@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30251

3 years agoFix scripted installs on EFI systems using ZFS root with zfsboot.
Nathan Whitehorn [Fri, 14 May 2021 12:30:41 +0000 (08:30 -0400)]
Fix scripted installs on EFI systems using ZFS root with zfsboot.

Unlike attended installations, scripted installs did not mount non-ZFS
partitions when ZFS root (via zfsboot) was selected. Since this included
the ESP, the EFI loader was not installed. Copy logic from the
attended-install path to make this work.

PR: 255824, 255081
MFC after: 1 week
Obtained from: Mark Huizer

3 years agoqoriq_dw_pci: disable LS1028A support
Marcin Wojtas [Fri, 14 May 2021 08:39:46 +0000 (10:39 +0200)]
qoriq_dw_pci: disable LS1028A support

Enabled driver initialization causes an abort
on the NXP LS1028ARDB platform (without any external
endpoints connected). Temporarily disable qoriq_dw_pci
probe, so that to allow successful booting of the OS.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30229

3 years agosdhci_fsl_fdt.c: Read supported voltages from dts.
Marcin Wojtas [Thu, 22 Apr 2021 11:01:06 +0000 (13:01 +0200)]
sdhci_fsl_fdt.c: Read supported voltages from dts.

We shouldn't overwrite capability register. Instead, voltages supported
by the controller have to be read from dts, as the hardware doesn't
report correct values.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30123

3 years agosdhci_fsl_fdt.c: Add a missing call to mmc_fdt_parse.
Marcin Wojtas [Thu, 22 Apr 2021 10:54:41 +0000 (12:54 +0200)]
sdhci_fsl_fdt.c: Add a missing call to mmc_fdt_parse.

Add a missing call to mmc_fdt_parse, without it some dts properties
are not parsed.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30122

3 years agosdhci_fsl_fdt.c: Add support for LS1028a.
Marcin Wojtas [Thu, 15 Apr 2021 13:19:13 +0000 (15:19 +0200)]
sdhci_fsl_fdt.c: Add support for LS1028a.

Add data specific for SoC, including all necessary quirks.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30121

3 years agostress2: Added a regression test. Fixed a type on an old test
Peter Holm [Fri, 14 May 2021 07:18:39 +0000 (09:18 +0200)]
stress2: Added a regression test. Fixed a type on an old test

3 years agonetgraph/ng_bridge: Handle send errors during loop handling
Lutz Donnerhacke [Tue, 27 Apr 2021 07:49:50 +0000 (09:49 +0200)]
netgraph/ng_bridge: Handle send errors during loop handling

If sending out a packet fails during the loop over all links, the
allocated memory is leaked and not all links receive a copy.  This
patch fixes those problems, clarifies a premature abort of the loop,
and fixes a minory style(9) bug.

PR: 255430
Submitted by: Dancho Penev
Tested by: Dancho Penev
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30008

3 years agonetgraph/ng_bridge: Avoid cache thrashing
Lutz Donnerhacke [Thu, 11 Feb 2021 22:59:11 +0000 (23:59 +0100)]
netgraph/ng_bridge: Avoid cache thrashing

Hint the compiler, that this update is needed at most once per second.
Only in this case the memory line needs to be written.  This will
reduce the amount of cache trashing during forward of most frames.

Suggested by: zec
Approved by: zec
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28601

3 years agohwpmc: fix PMC_CPU_LAST
Mitchell Horne [Wed, 5 May 2021 18:40:39 +0000 (15:40 -0300)]
hwpmc: fix PMC_CPU_LAST

It is unused, but incorrect.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agolibpmc: fall-back to kernel tables if pmu-events fails
Mitchell Horne [Thu, 13 May 2021 18:57:37 +0000 (15:57 -0300)]
libpmc: fall-back to kernel tables if pmu-events fails

On x86, the pmu_events table is the source of truth for finding
supported events. However, events not found there may still be present
in the kernel's static event tables. For example, the pmc.soft(3) events
will never be available from pmu-events.

Update pmc_allocate() to search the legacy event tables if
pmc_pmu_pmcallocate() fails to return a result. This allows both event
sources to be consulted before giving up, thus restoring pmc.soft(3) and
pmc.tsc(3) on x86.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30216

3 years agolibpmc: remove PMC_MDEP_TABLE logic
Mitchell Horne [Thu, 13 May 2021 19:00:07 +0000 (16:00 -0300)]
libpmc: remove PMC_MDEP_TABLE logic

This logic was added for handling some of the complicated relationships
between events and x86 CPU models. Since that logic has been mostly
removed from libpmc(3) in favor of pmu-events, this no longer serves
much of a purpose. Mapping CPU types to event tables is already handled
by the switch statement in pmc_init().

Reviewed by: ray, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30196

3 years agolibpmc: remove unused PMC_MDEP_INIT_INTEL_V2
Mitchell Horne [Thu, 13 May 2021 18:56:39 +0000 (15:56 -0300)]
libpmc: remove unused PMC_MDEP_INIT_INTEL_V2

All uses of this macro were removed in e92a1350b50e. Remove
cpu_has_iaf_counters as well.

Reviewed by: ray, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30195

3 years agoUPDATING: fix spelling
Emmanuel Vadot [Thu, 13 May 2021 18:26:10 +0000 (20:26 +0200)]
UPDATING: fix spelling

Reported by: pstef

3 years agomodules: Only build sdhci_fdt for arm and arm64
Emmanuel Vadot [Thu, 13 May 2021 18:23:59 +0000 (20:23 +0200)]
modules: Only build sdhci_fdt for arm and arm64

Other FDT platform (like powerpc64* or riscv64) don't have gpio built
by default so just compile the module for those two arches.

Fixes: 9e08f82058cb ("modules: Add sdhci_fdt module")