Commit graph

256304 commits

Author SHA1 Message Date
Kyle Evans
f31de79df2 kerberos5: fix the WITH_OPENLDAP build
Restore WARNS to its former glory prior to the global WARNS change to fix
the build.

(cherry picked from commit e948d980f7)
2021-02-03 20:55:59 -06:00
Kyle Evans
1535f67017 ofed: fix the WITH_OFED_EXTRA build
This option was not tested when WARNS was globally lifted in the src tree up
to 6.  Drop WARNS back down to unbreak the build; note that this is still
enabling more warnings than it had before the WARNS change, so the gcc build
may need to be independently evaluated at this level.

PR:		252865

(cherry picked from commit 9ca71db495)
2021-02-03 20:55:56 -06:00
Mateusz Guzik
8a680912a1 Revert "Reimplement strlen"
This reverts commit 710e45c4b8.

It breaks for some corner cases on big endian ppc64.
Given the stage of the release process it is best to revert for now.

Reported by:	jhibbits

(cherry picked from commit 33f0540b13)
2021-02-03 19:39:49 +00:00
Mark Johnston
1996360d73 qat: Add support for separate AAD and output buffers
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit bd674d8b1f)
2021-02-03 09:37:41 -05:00
Kristof Provost
18697b446b pf: Improve pf_rule input validation
Move the validation checks to pf_rule_to_krule() to reduce duplication.
This also makes the checks consistent across different ioctls.

Reported-by:	syzbot+e9632d7ad17398f0bd8f@syzkaller.appspotmail.com
Reviewed by:	tuexen@, donner@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28362

(cherry picked from commit 7a808c5ee3)
2021-02-03 15:19:52 +01:00
Roger Pau Monné
51ab5e0d82 stand/multiboot: adjust the protocol between loader and kernel
There's a currently ad-hoc protocol to hand off the FreeBSD kernel
payload between the loader and the kernel itself when Xen is in the
middle of the picture. Such protocol wasn't very resilient to changes
to the loader itself, because it relied on moving metadata around to
package it using a certain layout. This has proven to be fragile, so
replace it with a more robust version.

The new protocol requires using a xen_header structure that will be
used to pass data between the FreeBSD loader and the FreeBSD kernel
when booting in dom0 mode. At the moment the only data conveyed is the
offset of the start of the module metadata relative to the start of the
module itself.

This is a slightly disruptive change since it also requires a change
to the kernel which is contained in this patch. In order to update
with this change the kernel must be updated before updating the
loader, as described in the handbook. Note this is only required when
booting a FreeBSD/Xen dom0. This change doesn't affect the normal
FreeBSD boot protocol.

This fixes booting FreeBSD/Xen in dom0 mode after
3630506b9d.

(cherry picked from commit b6d85a5f51)
2021-02-03 14:07:43 +01:00
Stefan Eßer
601ac82194 bc: Vendor import of Gavin Howard's bc version 3.2.6
(cherry picked from commit 47a52dc4d4)
2021-02-03 11:37:34 +01:00
Kyle Evans
e3cd8246c7 lualoader: position hyphens at the beginning of character classes
According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction
between ranges and classes is not defined and hyphens must be specified at
either the beginning or the end of a set if they are not escaped.

Move all such occurrences to the beginning.

(cherry picked from commit b24872cf7b)
2021-02-03 00:55:51 -06:00
Kyle Evans
13de72571e stand: lua: enhance lfs.dir() to speed up kernels_autodetect
This eliminates a lot of stat() calls that happen when lualoader renders the
menu with the default settings, and greatly speeds up rendering on my
laptop.

ftype is nil if loader/loader.efi hasn't been updated yet, falling back to
lfs.attributes() to test.

This is technically incompatible with lfs, but not in a particularly
terrible way.

(cherry picked from commit e25ee296c9)
2021-02-03 00:55:47 -06:00
Oleksandr Tymoshenko
10625515ad MFC: mips: fix early kernel panic when setting up interrupt counters
Commit 248f0ca converted intrcnt and intrnames from u_long[]
and char[] to u_long* and char* respectively, but for non-INTRNG mips
these symbols were defined in .S file as a pre-allocated static arrays,
so the problem wasn't cought at compile time. Conversion from an array
to a pointer requires pointer initialization and it wasn't done
for MIPS, so whatever happenned to be in the begginning of intcnt[]
array was used as a pointer value.

Move intrcnt/intrnames to C code and allocate them dynamically
although with a fixed size at the moment.

Reviewed by:	emaste
PR:		253051
Differential Revision:	https://reviews.freebsd.org/D28424
MFC after:	1 day

(cherry picked from commit e0a0a3efcb)

mips: fix NLM platforms breakage caused by e0a0a3ef

NetLogic platforms have their own implementation of cpu_init_interrupts.
Apply the same logic to it as to intr_machdep.c.

PR:	253051

(cherry picked from commit d6f9c5a6d2)
2021-02-02 21:06:37 -08:00
Alexander Motin
c738bfc506 cxgb(4): Remove assumption of physically contiguous mbufs.
Investigation of iSCSI target data corruption reports brought me to
discovery that cxgb(4) expects mbufs to be physically contiguous, that
is not true after I've started using m_extaddref() in software iSCSI
for large zero-copy transmissions.  In case of fragmented memory the
driver transmitted garbage from pages following the first one due to
simple use of pmap_kextract() for the first pointer instead of proper
bus_dmamap_load_mbuf_sg().  Seems like it was done as some optimization
many years ago, and at very least it is wrong in a world of IOMMUs.

This patch just removes that optimization, plus limits packet coalescing
for mbufs crossing page boundary, also depending on assumption of one
segment per packet.

Sponsored by:	iXsystems, Inc.

(cherry picked from commit 9dc7c250b8)
2021-02-02 23:08:43 -05:00
Mateusz Guzik
4e29933d09 cache: fix trailing slash support in face of permission problems
Reported by:	Johan Hendriks <joh.hendriks gmail.com>
Tested by:	kevans

(cherry picked from commit 45456abc4c)
2021-02-02 18:15:48 +00:00
Toomas Soome
a66467dcfd userboot: provide stub gfx functions
Make sure we have needed functions present, to avoi getting undefined
symbols error(s).

PR: 253088
Reported by: John Kennedy

(cherry picked b79f2bc6c5)
2021-02-02 12:21:49 +02:00
Toomas Soome
b79f2bc6c5 vt: panic while changing vt font
Set refcount for loader provided font to 1 to prevent this font
from being released (so we can reset to default).

As we get started with no memory allocator, we set up static font data
for font passed by loader (if there is any). At this time, we also must
set refcount 1, and refcount will get incremented in cnprobe() callback.

At some point the memory allocator will be available, and we will set up
properly allocated font data, but we should not disturb the refcount.

PR: 252833
PR: 253147

(cherry picked and squashed 93ebd6307e and
1912d2b15e)
2021-02-02 12:11:38 +02:00
Toomas Soome
0d381d1b92 loader: create built in font from bold font face
We did replace full version of default font 8x16v with bold, also
use bold version for built in font.

(cherry picked from commit 6c789c55c4)
2021-02-02 12:00:30 +02:00
Marcin Wojtas
cd925aaa73 marvell: ap806_clock: add missing frequency modes
In the driver init routine the CPU clock frequency
value is obtained from a dedicated register. Until now
only part of the values were handled by the mv_ap806_clock
driver. Fix that by adding missing cases.

Submitted by: Zyta Szpak <zr@semihalf.com>
MFC after: 1 week
Obtained from: Semihalf
Sponsored by: Marvell

(cherry picked from commit a86b0839d7)
2021-02-02 13:28:35 +01:00
Bjoern A. Zeeb
4d85bfa412 __FreeBSD_version: update the references to the doc tree
Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

(cherry picked from commit abd619045a)
2021-02-02 11:54:30 +00:00
Bjoern A. Zeeb
91a07ed50f Bump __FreeBSD_version for multiple LinuxKPI updates conflicting
with DRM.  Be sure to update your drm-kmod port to after the update.

Sponsored-by:	The FreeBSD Foundation
2021-02-02 11:52:50 +00:00
Bjoern A. Zeeb
ff119f7c4a LinuxKPI: implement devres() framework parts and two examples
This code implements a version of the devres framework found
working for various iwlwifi use cases and also providing functions
for ttm_page_alloc_dma.c from DRM.

Part of the framework replicates the consumed KPI, while others
are internal helper functions.

In addition the simple devm_k*malloc() consumers were implemented
and kvasprintf() was enhanced to also work for the devm_kasprintf()
case.
Addmittingly lkpi_devm_kmalloc_release() could be avoided but for
the overall understanding of the code and possible memory tracing
it may still be helpful.

Further devsres consumer are implemented for iwlwifi but will follow
later as the main reason for this change is to sort out overlap with
DRM.

Sponsored-by:	The FreeBSD Foundation
Obtained-from:	bz_iwlwifi
MFC After:	3 days
Reviewed-by:	hselasky, manu
Differential Revision:	https://reviews.freebsd.org/D28189

(cherry picked from commit fa765ca73e)
2021-02-02 11:51:26 +00:00
Bjoern A. Zeeb
3ac9e87b76 LinuxKPI: enhance PCI bits for DRM
In pci_domain_nr() directly return the domain which got set in
lkpifill_pci_dev() in all cases.  This was missed between D27550
and 105a37cac7 .

In order to implement pci_dev_put() harmonize further code
(which was started in the aforementioned commit) and add kobj
related bits (through the now common lkpifill_pci_dev() code)
to the DRM specific calls without adding the DRM allocated
pci devices to the pci_devices list.
Add a release for the lkpinew_pci_dev() (DRM) case so freeing
will work.
This allows the DRM created devices to use the normal kobj/refcount
logic and work with, e.g., pci_dev_put().
(For a slightly more detailed code walk see the review).

Sponsored-by:	The FreeBSD Foundation
Obtained-from:	bz_iwlwifi (partially)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D28188

(cherry picked from commit 1fac2cb4d6)
2021-02-02 11:51:20 +00:00
Bjoern A. Zeeb
ec06521ee8 LinuxKPI: upstream a collection of drm-kmod conflicting changes
The upcoming in-kernel implementations for LinuxKPI based on work on
iwlwifi (and other wireless drivers) conflicts in a few places with
the drm-kmod graphics work outside the base system.

In order to transition smoothly extract the conflicting bits.
This included "unaligned" accessor functions, sg_pcopy_from_buffer(),
IS_*() macros (to be further restricted in the future), power management
bits (possibly no longer conflicting with DRM), and other minor changes.

Obtained-from:  bz_iwlwifi
Sponsored-by:   The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	kib, hselasky, manu, bdragon (looked at earlier versions)
Differential Revision: https://reviews.freebsd.org/D26598

(cherry picked from commit 4abbf816bf)
2021-02-02 11:51:15 +00:00
Bjoern A. Zeeb
ffd05df717 LinuxKPI: add firmware loading support
Implement linux firmware KPI compat code.
This includes: request_firmware() request_firmware_nowait(),
request_firmware_direct(), firmware_request_nowarn(),
and release_firmware().

Given we will try to map requested names from natively ported
or full-linuxkpi-using drivers to a firmware(9) auto-loading
name format (.ko file name and image name matching),
we quieten firmware(9) and print success or failure (unless
the _nowarn() version was called) in the linuxkpi implementation.
At the moment we try up-to 4 different naming combinations,
with path stripped, original name, and requested name with '/'
or '.' replaced.

We do not currently defer loading in the "nowait" case.

Sponsored-by:	The FreeBSD Foundation
Sponsored-by:	Rubicon Communications, LLC ("Netgate")
		(firmware(9) nowarn update from D27413)
MFC after:	3 days
Reviewed by:	kib, manu (looked at older versions)
Differential Revision:	https://reviews.freebsd.org/D27414

(cherry picked from commit a6c2507d1b)
(cherry picked from commit 4a26380ba6)
2021-02-02 11:50:38 +00:00
Warner Losh
f19a4e97d3 newvers: tweak uname to be more useful
The current uname is branch-cXXXX-gHASH

Three changes to make uname more useful.
1. Move from using git rev-list --count to git rev-lis --count --first-parent
   since that gives a better, incrementing number.
2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of
   a hash and we've changed the sematnics of XXXXX
3. Remove g to make HASH cut and pastable.

Durting review, #1 & #3 had the largest consensus. There was a diversity of
opinion on #2, but on the whole it was positive so I'll acknowledge the dissent,
but move forward with something seems to have support since the dissent was all
about what letter to use where I chose 'n'.

MFC After: 3 days
Reviewed by: rgrimes, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D28338

(cherry picked from commit 8a51f14a78)
2021-02-01 15:31:35 -07:00
Mitchell Horne
c415d0df47 bsdinstall: riscv-specific tweaks
Make the installer more useful, by allowing it to create a bootable
installation. Also, enable the menu option for ZFS-on-root.

Like arm64, RISC-V boots by UEFI only, so arm64's partedit
implementation is renamed and shared among the two platforms.

Reviewed by:	gjb

(cherry picked from commit 7b08a307e8)
2021-02-01 10:54:09 -04:00
Mitchell Horne
14640ac789 bsdinstall: create /efi/boot directory in ESP
If the installer is creating a new ESP, then this directory will not
exist and the subsequent cp will fail silently. This is usually of no
consequence if /efi/freebsd/loader.efi is set up correctly.

Reviewed by:	imp

(cherry picked from commit 676b7d077c)
2021-02-01 10:53:21 -04:00
Jamie Landeg-Jones
3728c4d314 diff: fix incorrectly displaying files as duplicates
When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_status() with the return value.

However, in these cases, the return value isn't changed from the initial
default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this
works out ok, however, if the "-s" flag is set, a message is displayed
showing identicality:

case D_SAME:
                if (sflag)
                        printf("Files %s%s and %s%s are identical\n",                                                                                                       path1, entry, path2, entry);
                break;

This then produces such results as:

% diff  -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff  -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Create a D_ERROR status which is returned in such cases, and
print_status() then deals with that status seperately from D_SAME

PR:		252614
MFC after:	1 week

(cherry picked from commit fefb3c46a8)
2021-02-01 14:05:25 +01:00
Baptiste Daroussin
0702bf9c49 diff: add a test case for failed -s option
(cherry picked from commit 13860e71eb)
2021-02-01 14:05:24 +01:00
Mateusz Guzik
71b4605138 Drop temporary compat in setproctitle
(cherry picked from commit 46f168bc66)
2021-02-01 12:39:19 +00:00
Mateusz Guzik
006ec2ed15 cache: add trailing slash support
Tested by:	pho

(cherry picked from commit e027e24bfa)
2021-02-01 12:39:19 +00:00
Mateusz Guzik
6a3047840d cache: handle NOFOLLOW requests for symlinks
Tested by:	pho

(cherry picked from commit 8cbd164a17)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
be03df57d6 amd64: retire sse2_pagezero
All page zeroing is using temporal stores with rep movs*, the routine is
unused for several years.

Should a need arise for zeroing using non-temporal stores, a more
optimized variant can be implemented with a more descriptive name.

(cherry picked from commit d1de5698df)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
3975d4c9e1 amd64: add missing ALIGN_TEXT to loops in memset and memmove
(cherry picked from commit 164c3b8184)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
e5b674594e Reimplement strlen
The previous code neglected to use primitives which can find the end
of the string without having to branch on every character.

While here augment the somewhat misleading commentary -- strlen as
implemented here leaves performance on the table, especially so for
userspace. Every arch should get a dedicated variant instead.

In the meantime this commit lessens the problem.

Tested with glibc test suite.

Naive test just calling strlen in a loop on Haswell (ops/s):

$(perl -e "print 'A' x 3"):
before:	211198039
after:	338626619

$(perl -e "print 'A' x 100"):
before:	83151997
after:	98285919

(cherry picked from commit 710e45c4b8)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
2bf72739da poll: use fget_unlocked or fget_only_user when feasible
This follows select by eleminating the use of filedesc lock.
This is a win for single-threaded processes and a mixed bag for others
as at small concurrency it is faster to take the lock instead of
refing/unrefing each file descriptor.

Nonetheless, removal of shared lock usage is a step towards a
mtx-protected fd table.

(cherry picked from commit 45e1f85414)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
233225ef7d select: employ fget_only_user
Since most select users are single-threaded this avoid a lot of work
in the common case.

For example select of 16 fds (ops/s):
before:	2114536
after:	2991010

(cherry picked from commit 6affe1b712)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
1077e49657 fd: add fget_only_user
This can be used by single-threaded processes which don't share a file
descriptor table to access their file objects without having to
reference them.

For example select consumers tend to match the requirement and have
several file descriptors to inspect.

(cherry picked from commit eaad8d1303)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
569ac57608 cache: add missing MNT_NOSYMFOLLOW check to symlink traversal
(cherry picked from commit 5c325977b1)
2021-02-01 12:39:18 +00:00
Mateusz Guzik
e13587448a cache: fallback when encountering a mount point during .. lookup
The current abort is overzealous.

(cherry picked from commit 5fc384d181)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
dcba4f2b43 conf/kern.mk: save some work by using realpath instead of cd ; pwd
I did not check if the entire ordeal can be avoided in the first place.

(cherry picked from commit bcb7f57aa2)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
742285d283 cache: tidy up handling of foo/bar lookups where foo is not a directory
The code was performing an avoidable check for doomed state to account
for foo being a VDIR but turning VBAD. Now that dooming puts a vnode
in a permanent "modify" state this is no longer necessary as the final
status check will catch it.

(cherry picked from commit a098a831a1)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
82efef21d0 cache: stop referring to removing entries as invalidating them
Said use is a remnant from the old code and clashes with the NCF_INVALID
flag.

(cherry picked from commit a51eca7936)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
51927c36b8 cache: convert cache_fplookup_parse to void now that it always succeeds
(cherry picked from commit 6943671b48)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
1f28a3afe4 cache: change ->v_cache_dd synchronisation rules
Instead of resorting to seqc modification take advantage of immutability
of entries and check if the entry still matches after everything got
prepared.

(cherry picked from commit e7cf562a40)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
9375a93b6c cache: make ->v_cache_dd accesses atomic-clean for lockless usage
(cherry picked from commit 6f08427649)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
247f652e62 cache: make ->nc_flag accesses atomic-clean for lockless usage
(cherry picked from commit 6ef8fede86)
2021-02-01 12:39:17 +00:00
Mateusz Guzik
8a44ccd058 cache: store vnodes in local vars in cache_zap_locked
(cherry picked from commit ffcf8f97f8)
2021-02-01 12:39:16 +00:00
Mateusz Guzik
872a0097fd tmpfs: drop acq fence now that vn_load_v_data_smr has consume semantics
(cherry picked from commit c09f799271)
2021-02-01 12:39:16 +00:00
Mateusz Guzik
7ba12ba0a2 zfs: use atomic_load_consume_ptr for z_cached_symlink
(cherry picked from commit 7af02ef0b2)
2021-02-01 12:39:16 +00:00
Mateusz Guzik
e8d3e38845 vfs: use atomic_load_consume_ptr in vn_load_v_data_smr
(cherry picked from commit 8d2a230e99)
2021-02-01 12:39:16 +00:00
Mateusz Guzik
fc301c224b atomic: add stub atomic_load_consume_ptr
(cherry picked from commit 054ce2b037)
2021-02-01 12:39:16 +00:00