Commit Graph

268892 Commits

Author SHA1 Message Date
Mathy Vanhoef
11572d7d7f net80211: reject mixed plaintext/encrypted fragments
ieee80211_defrag() accepts fragmented 802.11 frames in a protected Wi-Fi
network even when some of the fragments are not encrypted.
Track whether the fragments are encrypted or not and only accept
successive ones if they match the state of the first fragment.

This relates to section 6.3 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by:	Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security:	CVE-2020-26147
PR:		256118
Differential Revision: https://reviews.freebsd.org/D30663
2021-09-30 14:47:41 +00:00
Mitchell Horne
a20c10893e libpmc: add some AMD pmu counter aliases
Make it mostly compatible with what's defined for Intel. Except where
noted, these are defined for all of amdzen(1|2|3).

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32162
2021-09-30 11:15:26 -03:00
Mitchell Horne
937539e0a3 libpmc: fix the 'cycles' event alias on x86
Looking for "tsc-tsc" in the pmu tables will fail every time. Instead,
make this an alias for the static TSC event defined in pmc_events.h.
This fixes 'pmcstat -s cycles' on Intel and AMD.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32197
2021-09-30 11:15:26 -03:00
Mateusz Guzik
69ab528386 linprocfs: find cwd and root handling
The code would incorrectly use curthread instead of the target proc to
resolve vnodes.

Fixes:	8d03b99b9d ("fd: move vnodes out of filedesc into a dedicated structure")
PR:	258729
Noted by:	 Damjan Jovanovic <damjan.jov@gmail.com>
2021-09-30 12:59:58 +02:00
Mateusz Guzik
85c855d31b fd: add pwd_hold_proc 2021-09-30 12:49:51 +02:00
Ram Kishore Vegesna
41e9466943 ocs_fc: Fix device lost timer where device is not getting deleted.
Issue: Devices wont go away after the link down.

Device lost timer functionality in ocs_fc is broken,
`is_target` flag is not set in the target database and target delete is skipped.

Fix: Remove unused flags and delete the device when timer expires.

Reported by: ken@kdm.org
Reviewed by: mav, ken
2021-09-30 13:01:17 +05:30
Ram Kishore Vegesna
d063d1bc92 ocs_fc: When commands complete with an error, freeze the device queue.
Proper error recovery depends on freezing the device queue when an
error occurs, so we can recover from an error before sending
additional commands.

The ocs_fc(4) driver was not freezing the device queue for most
SCSI errors, and that broke error recovery.

sys/dev/ocs_fc/ocs_cam.c:
	In ocs_scsi_initiator_io_cb(), freeze the device queue if
        we're passing back status other than CAM_REQ_CMP.

Submitted by: ken@kdm.org
Reviewed by: mav, ken
2021-09-30 13:01:17 +05:30
Ram Kishore Vegesna
1af49c2eeb ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned.
In ocs_scsi_initiator_io_cb(), if the SCSI command that is
        getting completed had a residual equal to the transfer length,
        it was setting the CCB status to CAM_REQ_CMP.

        That breaks the expected behavior for commands like READ ATTRIBUTE.
        For READ ATTRIBUTE, if the first attribute requested doesn't exist,
        the command is supposed to return an error (Illegal Request,
        Invalid Field in CDB).  The broken behavior for READ ATTRIBUTE
        caused LTFS tape formatting to fail.  It looks for attribute
        0x1623, and expects to see an error if the attribute isn't present.

        In addition, if the residual is negative (indicating an overrun),
        only set the CCB status to CAM_DATA_RUN_ERR if we have not already
        reported an error.  The SCSI sense data will have more detail about
        what went wrong.

        sys/dev/ocs_fc/ocs_cam.c:
                In ocs_scsi_initiator_io_cb(), don't set the status to
                CAM_REQ_CMP if the residual is equal to the transfer length.

                Also, only set CAM_DATA_RUN_ERR if we didn't get SCSI
                status.

Submitted by: ken@kdm.org
Reviewed by: mav, ken
2021-09-30 13:01:16 +05:30
Ram Kishore Vegesna
322dbb8ce8 ocs_fc: Increase maximum supported SG elements to support larger transfer sizes.
Reported by: ken@kdm.org
Reviewed by: mav, ken
2021-09-30 13:01:16 +05:30
Ram Kishore Vegesna
3bf42363b0 ocs_fc: Emulex Gen 7 HBA support.
Emulex Gen7 adapter support in ocs_fc driver.

Reviewed by: mav, ken
2021-09-30 13:01:15 +05:30
Kyle Evans
335c4f8edb modules: iichid: needs opt_acpi.h
This fixes the standalone build.
2021-09-29 23:10:35 -05:00
Kyle Evans
a335f76f2a modules: a lot: need opt_kern_tls.h
This fixes the standalone build.
2021-09-29 23:10:31 -05:00
Kyle Evans
1d8c9d3c0c modules: p2sb: need opt_platform.h
This fixes the standalone build.
2021-09-29 23:09:45 -05:00
Kyle Evans
6caae81d93 modules: netflow: need opt_inet.h
This fixes the standalone build.
2021-09-29 23:09:43 -05:00
Kyle Evans
58ca99d116 modules: acpi_video: need opt_evdev.h
This fixes the standalone build.
2021-09-29 23:08:25 -05:00
Warner Losh
5547ed2cb2 bluetooth: Remove one more h4 reference.
Sponsored by:		Netflix
2021-09-29 22:02:25 -06:00
Warner Losh
24ccef8140 bluetooth: Remove stray btccc references
The 3com bluetooth PC Card adapter was removed from the tree when PC
Card support was removed earlier this year. Remove stray references to
it still in the tree.

Sponsored by:		Netflix
2021-09-29 21:58:27 -06:00
Warner Losh
66d6299848 bluetooth: remove hcseriald
Without ng_h4 gone, there's no need for hcseriald.

Sponsored by:		Netflix
2021-09-29 21:18:17 -06:00
Jung-uk Kim
4fa690be2c bluetooth: Fix build after ng_h4 removal
It was caused by 79a100e28e.
2021-09-29 23:10:56 -04:00
Warner Losh
e2c1243f42 fd: Move from using device_busy to a refcount
Use refcounting to delay the detach rather than device_busy and/or
device_unbusy. fd/fdc is one of the few consumers of device_busy in the
tree for that, and it's not a good fit. Also, nothing is waking 'fd' and
other drivers don't loop like this. Return EBUSY if we still have active
users.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31830
2021-09-29 20:18:28 -06:00
Warner Losh
8ea95b2fba loader.efi: remove extra extern ST
The definition for 'ST' is in efilib.h, so we don't need extern ST here.

Sponsored by:		Netflix
Reviewed by:		tsoome, kevans
Differential Revision:	https://reviews.freebsd.org/D32225
2021-09-29 20:07:13 -06:00
Warner Losh
79a100e28e bluetooth: complete removal of ng_h4
The ng_h4 module was disconnected 13 years ago when the tty later was
locked by Ed. It completely fails to compile, and has a number of false
positives for Giant use. Remove it for lack of interest. Bluetooth has
largely (completely?) moved on from bluetooth over UART transport.

OK'd by:		emax
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31846
2021-09-29 20:00:02 -06:00
Warner Losh
6a460811b3 ida: Use ida lock instead of Giant for bus_dma allocation
It looks like a reference to Giant was overloooked when jhb made this
MPSAFE in 6b5b57ae9f.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31841
2021-09-29 19:15:16 -06:00
Cy Schubert
4a7b49a0da ipfilter: Save time and cycles swapping bucket table sizes
NAT hash tables are inverted for inbound vs outbound. Rather than spend
the time and cycles swapping them, let's simply calculate the bucket
lengths inversely.

MFC after:	1 week
2021-09-29 17:44:02 -07:00
Warner Losh
9aa29457d5 loader_lua.8: Fix first version
Lua bindings appeared in FreeBSD 12.0. Delete the authors section of the
man page, since it's unclear who wrote different parts of the man
page.

Noted by:	Trond Endrestol
Sponsored by:	Netflix
2021-09-29 17:18:51 -06:00
Vladimir Kondratyev
30acf99a82 Bump __FreeBSD_version to 1400034 for LinuxKPI changes 2021-09-29 23:26:46 +03:00
Vladimir Kondratyev
062f15004f LinuxKPI: Remove vma argument from fault method of vm_operations_struct
It is removed from Linux since 4.11.
In FreeBSD it results in several #ifdefs in drm-kmod.

Reviewed by:	emaste, hselasky, manu
Differential revision:	https://reviews.freebsd.org/D32169
2021-09-29 23:26:32 +03:00
Vladimir Kondratyev
5ca1f3f5e3 LinuxKPI: Hide some internal symbols in linux_interrupt.c
Reviewed by:	hselasky, manu
Differential revision:	https://reviews.freebsd.org/D32168
2021-09-29 23:26:14 +03:00
Vladimir Kondratyev
c072f6e856 LinuxKPI: Import linux_page.c and some dependent code from drm-kmod
No functional changes intended

Reviewed by:	hselasky, manu, markj
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32167
2021-09-29 23:15:37 +03:00
Vladimir Kondratyev
88531adbfb LinuxKPI: Update pte_fn_t definition to match Linux 5.3
Reviewed by:	emaste, hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32166
2021-09-29 23:15:27 +03:00
Vladimir Kondratyev
b52e363840 LinuxKPI: Implement backlight_enable and backlight_disable functions
For now, disable backlight if brightness level is set to 0.
In the future we may implement separate knob in backlight(8).

Required by drm-kmod v5.6

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32165
2021-09-29 23:15:12 +03:00
Vladimir Kondratyev
3d86f8f1d7 LinuxKPI: Add dummy pgprot_decrypted() implementation
to reduce number of #ifdefs in drm-kmod

Reviewed by:	hselasky
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32094
2021-09-29 23:14:58 +03:00
Vladimir Kondratyev
37eba5b77a LinuxKPI: Cast offset_in_page() parameter to unsigned long
to reduce number of patches in drm-kmod

Reviewed by:	hselasky
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32093
2021-09-29 23:14:47 +03:00
Vladimir Kondratyev
6efabdeede LinuxKPI: Import linux/poison.h header
Required by drm-kmod 5.6

Reviewed by:	hselasky, imp, manu
MFC after:	2 weeks
Obtained from:	OpenBSD
Differential revision:	https://reviews.freebsd.org/D32092
2021-09-29 23:14:34 +03:00
Vladimir Kondratyev
b59ffedae8 LinuxKPI: Add helper functions to store integers to linux/xarray.h
Required by drm-kmod.

Reviewed by:	hselasky
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32091
2021-09-29 23:14:23 +03:00
Vladimir Kondratyev
62ff0566c9 LinuxKPI: Allow cdev_pager prefault handler to steal pages
from other vm_objects. This workarounds "Page already inserted" panic
in vm_page_insert routine triggered on attempt to mmap file created
with shmem_file_setup call. After introduction of "GTT mmap
interface v4" a.k.a. MMAP_OFFSET, vm_objects allocated by these calls
may try to own intersected sets of pages that leads to the assertion.

Reviewed by:	kib
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32090
2021-09-29 23:14:05 +03:00
Vladimir Kondratyev
bd6d55adb4 LinuxKPI: stub anon_inode_getfile
Although drm-kmod contains better implementation which is able to
allocate real entries on pseudofs, this feature has never been used.

Starting from drm-kmod v5.6 old implementation began to leak entries
on each drm device close(). Now just drop pseudofs support instead of
fixing it in drm-kmod and provide stub in base.

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32069
2021-09-29 23:13:53 +03:00
Vladimir Kondratyev
f6823dac8f LinuxKPI: Factor out vmf_insert_pfn_prot() routine
from GEM and TTM page fault handlers and move it in to base system. This
code is tightly integrated with LKPI mmap support to belong to drm-kmod.

As this routine requires associated vm_object to be locked, it got
additional _locked suffix.

Reviewed by:	hselasky, markj
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32068
2021-09-29 23:13:41 +03:00
Vladimir Kondratyev
7d92d48358 LinuxKPI: Invoke release handler when file is destroyed by fput()
Required by drm_kmod 5.6

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32067
2021-09-29 23:13:27 +03:00
Vladimir Kondratyev
2fe9ea5d3a LinuxKPI: allocate current before taking shrinkers lock
This fixes following warnings when shrinkers are invoked first time:

uma_zalloc_debug: zone "lkpicurr" with the following non-sleepable
locks held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

uma_zalloc_debug: zone "lkpimm" with the following non-sleepable locks
held: exclusive sleep mutex lkpi-shrinker (lkpi-shrinker)

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D32066
2021-09-29 23:12:58 +03:00
Vladimir Kondratyev
b58c916f11 LinuxKPI: implement _IOC_TYPE and _IOC_NR macros in linux/ioctl.h
They are used by drm-kmod

Reviewed by:	emaste, hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31674
2021-09-29 23:12:47 +03:00
Vladimir Kondratyev
66ea390652 LinuxKPI: Remove FreeBSD struct resource from all LKPI headers
except linux/pci.h to avoid conflicts with Linux version.
This allows to #define resource in drm-kmod globally and strip some #ifdef-s

Reviewed by:	hselasky, manu
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31673
2021-09-29 23:12:36 +03:00
Vladimir Kondratyev
a81b36c6d3 LinuxKPI: Implement get_file_rcu()
get_file_rcu() grabs a file if the file->f_count is not zero.

Required by drm-kmod 5.6

Reviewed by:	hselasky, manu (previous version)
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D31672
2021-09-29 23:12:25 +03:00
Mitchell Horne
ab4ed843a3 minidump: De-duplicate the progress bar
The implementation of the progress bar is simple, but duplicated for
most minidump implementations. Extract the common bits to kern_dump.c.
Ensure that the bar is reset with each subsequent dump; this was only
done on some platforms previously.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31885
2021-09-29 16:42:21 -03:00
Mitchell Horne
31991a5a45 minidump: De-duplicate is_dumpable()
The function is identical in each minidump implementation, so move it to
vm_phys.c. The only slight exception is powerpc where the function was
public, for use in moea64_scan_pmap().

Reviewed by:	kib, markj, imp (earlier version)
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31884
2021-09-29 16:41:52 -03:00
Kyle Evans
f66b9b40f4 cmp: add -b, --print-bytes
This is compatible with GNU cmp.

Reviewed by:	bapt, markj (earlier version)
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32074
2021-09-29 13:04:57 -05:00
Kyle Evans
8d546b6832 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32073
2021-09-29 13:03:34 -05:00
Kyle Evans
4e380e8474 cmp: add -n, --bytes to limit number of bytes to compare
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32072
2021-09-29 13:03:34 -05:00
Kyle Evans
f6787614fd cmp: accept SI suffixes for skip1 and skip2
This is compatible with GNU cmp.

Reviewed by:	bapt (earlier version), markj, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32071
2021-09-29 13:03:34 -05:00
Jamie Gritton
747a47261e Fix error return of kern.ipc.posix_shm_list, which caused it (and thus
"posixshmcontrol ls") to fail for all jails that didn't happen to own
the last shm object in the list.
2021-09-29 10:20:36 -07:00