aboutsummaryrefslogtreecommitdiff
path: root/sys
Commit message (Collapse)AuthorAgeFilesLines
* acpi_powerres: `acpi_pwr_get_state` and getting initial D-state for deviceHEADmainAymeric Wibo44 min.2-5/+160
| | | | | | | | | | | | | | | | | | | | | Add `acpi_pwr_get_state` as a prerequisite to LPI (low-power idle) states. Since these states define minimum D-state constraints on other devices to be able to enter them, it will be necessary to use this function to check them before attempting to do so. Aside from that, this function is used to get the initial D-state of a power consumer when registering it (previously the `ac_state` value would be set to `ACPI_STATE_UNKNOWN`). It uses the `_PSC` method if available (older devices), or infers the D-state through the `_PRx` objects (cached in `ac_prx`) with `acpi_pwr_infer_state` if not. `acpi_pwr_switch_consumer` now uses this to verify that the D-state of a power consumer was switched correctly. Reviewed by: imp, markj, jrm (mentor) Approved by: markj, jrm (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48386
* certctl: Reimplement in CDag-Erling Smørgrav60 min.1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Notable changes include: * We no longer forget manually untrusted certificates when rehashing. * Rehash will now scan the existing directory and progressively replace its contents with those of the new trust store. The trust store as a whole is not replaced atomically, but each file within it is. * We no longer attempt to link to the original files, but we don't copy them either. Instead, we write each certificate out in its minimal form. * We now generate a trust bundle in addition to the hashed diretory. This also contains only the minimal DER form of each certificate. This allows e.g. Unbound to preload the bundle before chrooting. * The C version is approximately two orders of magnitude faster than the sh version, with rehash taking ~100 ms vs ~5-25 s depending on whether ca_root_nss is installed. * We now also have tests. Reviewed by: kevans, markj Differential Revision: https://reviews.freebsd.org/D42320 Differential Revision: https://reviews.freebsd.org/D51896
* acpi_powerres: Fix turning off power resources on first D-state switchAymeric Wibo88 min.1-5/+105
| | | | | | | | | | | | | | | | | | | | | | The power resource dependencies for each `_PRx` object are discovered and cached in `ac_prx` on the power consumer struct (`struct acpi_powerconsumer`) when a power consumer is registered. This is done in `acpi_pwr_get_power_resources`. ACPI guarantees these `_PRx` objects will evaluate to the same thing each time they are called. This discovery process also registers those power resources, which were previously only registered when they were referenced by the relevant `_PRx` object for the target D-state when switching. This meant that the first D-state switch for a power consumer would not turn off any power resources as they wouldn't have been registered yet. This change fixes this. `ac_prx` will be used by subsequent patches. Reviewed by: markj, imp, jrm (mentor) Approved by: markj, jrm (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48385
* netlink: Fix IFF_UP flag handling in RTM_NEWLINK's modify_link handlerMuhammad Saheed98 min.1-4/+8
| | | | | | | | | | | | | | IFF_UP could previously only be unset via RTM_NEWLINK. Requests to set IFF_UP, though they succeed, did not actually set the flag. RTM_NEWLINK messages with ifi_change=0 are treated as ifi_change=0xFFFFFFFF, modifying all the link flags (currently IFF_UP and IFF_PROMISC) to match the behavior seen on Linux. Reviewed by: obiwac, kp, mckusick (mentor) Approved by: obiwac, mckusick (mentor) Sponsored by: Google LLC (GSoC) Differential Revision: https://reviews.freebsd.org/D51871
* zfs readdir: if there were no dirents to copy out, return EINVAL same as UFSKonstantin Belousov119 min.1-1/+3
| | | | | | | Reviewed by: allanjude, markj, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51930
* zfs readdir: set *eofp to 1 on eofKonstantin Belousov119 min.1-1/+1
| | | | | | | | Reported by: rmacklem Reviewed by: allanjude, markj, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51930
* zfsctl_root_readdir: if there were no dirents to copy out, return EINVALKonstantin Belousov119 min.1-14/+26
| | | | | | | | | same as UFS. Reviewed by: allanjude, markj, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51930
* zfsctl_root_readdir(): properly set eofKonstantin Belousov119 min.1-0/+2
| | | | | | | | | PR: 288889 Reported by: bakul Reviewed by: allanjude, markj, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51930
* nfsport.h: minor comments cleanupKonstantin Belousov12 hours1-12/+0
| | | | | | | Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D51987
* Revert "vfs: Assert that st_rdev is NODEV for non-devices"Dag-Erling Smørgrav16 hours1-2/+0
| | | | This reverts commit f9ff1e48cc1b77f1840fd514050ccc5904a0cac2.
* NOTES: improve HIDRAW_MAKE_UHID_ALIAS descriptionVladimir Kondratyev18 hours1-1/+1
| | | | | Reviewed by: aokblast Differential Revision: https://reviews.freebsd.org/D51611
* u2f(4): a HID driver for FIDO/U2F security keysVladimir Kondratyev18 hours13-0/+610
| | | | | | | | | | | | | | | | | While FIDO/U2F keys were already supported by the generic uhid(4) and hidraw(4) drivers, this driver adds some additional features an does steps to tighten the security of FIDO/U2F access. - It automatically loads through devd. - Automatically enables HQ_NO_READAHEAD for FIDO/U2F devices. - Implements only miminum set of features. - Do not requires external devfs configuration to set character device permissions. - Names character device as u2f/# to make possible capsicum or any other pledge()-style sandboxing. PR: 265528 Differential Revision: https://reviews.freebsd.org/D51612
* usbhid(4): Implement USB_GET_DEVICEINFO ioctlVladimir Kondratyev18 hours4-36/+56
| | | | | | | | | | With factoring out of supporting code from ugen(4) driver. The ioctl is used in FIDO/U2F security key drivers to get USB product and manufacturer strings. PR: 264843 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51609
* hidraw(4): Rename to uhid if HIDRAW_MAKE_UHID_ALIAS is specifiedVladimir Kondratyev18 hours2-9/+9
| | | | | | | instead of renaming uhid(4) to hidraw to make easier import of coming u2f(4) driver which has similar option. Differential Revision: https://reviews.freebsd.org/D51608
* sys/conf.h: Add u2f group id to use in coming FIDO/U2F driverVladimir Kondratyev18 hours1-0/+1
| | | | | | | We have already reserved this group ID in /etc/group file. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51607
* hid: Allow serial execution of HID_INTR_START method.Vladimir Kondratyev18 hours3-35/+40
| | | | | | It is required to implement HQ_NO_READAHEAD HID quirk. Differential revision: https://reviews.freebsd.org/D51606
* hid: Add HQ_NO_READAHEAD quirk and implement it in usbhid(4)Vladimir Kondratyev18 hours2-1/+4
| | | | | | | | | | | It disables interrupt emulation on poll-driven buses like USB and forces aquiring of only one USB frame per read(2) operation. This avoids an FIDO/U2F issue where IN endpoint data received from the device right before the file handle is closed, gets lost. PR: 263995 Reviewed by: aokblast Differential revision: https://reviews.freebsd.org/D51605
* vfs: Assert that st_rdev is NODEV for non-devicesDag-Erling Smørgrav22 hours1-0/+2
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51956
* ext2fs: Set st_rdev to NODEV when not a deviceDag-Erling Smørgrav22 hours1-1/+1
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51955
* zfs: Set st_rdev to NODEV, not 0, when not a deviceDag-Erling Smørgrav22 hours2-2/+2
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51954
* vfs: Introduce VN_ISDEV() macroDag-Erling Smørgrav22 hours15-51/+51
| | | | | | | | | | | | | | We frequently need to check if a vnode refers to either a character or block special, so we might as well have a macro for it. We somewhat less frequently need to perform similar checks on things that aren't vnodes (usually a struct vattr *), so add VATTR_ISDEV() and a generic VTYPE_ISDEV() as well. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51947
* ufs_times_locked(): styleKonstantin Belousov23 hours1-7/+7
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* ufs: st_rdev is only meaningful for special nodesKonstantin Belousov23 hours1-4/+8
| | | | | | | | | | Instead of leaking di_db[0] (for regular files this is the index of the first block of the file), return NODEV when not a special node. Reported and reviewed by: des Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51943
* Revert "amd64: re-enable la57"Konstantin Belousov26 hours1-1/+1
| | | | | | | This reverts commit 2abf24b3698c08c9fc906580fd5be67be65c9feb. The la57 should be not force-enabled. Sponsored by: The FreeBSD Foundation
* g_part: Fix a few typos in source code commentsGordon Bergling30 hours1-3/+3
| | | | | | - s/partitition/partition/ MFC after: 3 days
* isa: Fix a typo in a source code commentGordon Bergling30 hours1-1/+1
| | | | | | - s/Monochome/Monochrome/ MFC after: 3 days
* udp: Fix a typo in a source code commentGordon Bergling30 hours2-2/+2
| | | | | | - s/datgram/datagram/ MFC after: 3 days
* ice(4): Fix a few typos in source code commentsGordon Bergling31 hours4-5/+5
| | | | | | | | | | - s/wit/with/ - s/Recceive/Receive/ - s/convenction/convention/ - s/metaddata/metadata/ Obtained from: OpenBSD MFC after: 3 days
* amd64: re-enable la57Konstantin Belousov31 hours1-1/+1
| | | | | | | | | It benefits KVA. For userspace la57 is disabled by default for quite some time, to avoid compat issues. Reviewed by: alc, imp, olce Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D51929
* isci(4): Fix a typo in a source code commentGordon Bergling32 hours1-1/+1
| | | | | | - s/contants/constants/ MFC after: 3 days
* bnxt(4): Fix typos in a comment and a kernel messageGordon Bergling32 hours1-2/+2
| | | | | | - s/priviledged/privileged/ MFC after: 5 days
* arm: Fix two typos in kernel messages of pmu_fdt.cGordon Bergling32 hours1-2/+2
| | | | | | - s/interupt/interrupt/ MFC after: 5 days
* amd64 GENERIC: Add ufshciJaeyoon Choi45 hours1-0/+3
| | | | | | Sponsored by: Samsung Electronics Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51507
* ufshci: Add functions for UTP Task ManagementJaeyoon Choi45 hours6-118/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds UTP Task Management Request functions and revisits the UTR/UTRM construction logic. It also introduces ufshci_ctrlr_cmd_send_task_mgmt_request(), which will be used for timeout handling in a follow-up commit. Test: I temporarily added the code below to the ufshci_ctrlr_start() function to test it on a Galaxy Book S. ``` static void ufshci_ctrlr_start(struct ufshci_controller *ctrlr) { ... /* Test: Task Mangement Request */ ufshci_printf(ctrlr, "Test: Task Mangement Request\n"); struct ufshci_completion_poll_status status; status.done = 0; ufshci_ctrlr_cmd_send_task_mgmt_request(ctrlr, ufshci_completion_poll_cb, &status, UFSHCI_TASK_MGMT_FUNCTION_QUERY_TASK, 0, 0, 0); ufshci_completion_poll(&status); if (status.error) { ufshci_printf(ctrlr, "ufshci_ctrlr_cmd_send_task_mgmt_request failed!\n"); return; } uint32_t service_response; service_response = status.cpl.response_upiu.task_mgmt_response_upiu.output_param1; ufshci_printf(ctrlr, "Task Management Service Response = 0x%x\n", service_response); ... } ``` Sponsored by: Samsung Electronics Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51506
* Belatedly bump __FreeBSD_version for setgroups/getgroups revisionsKyle Evans45 hours1-1/+1
| | | | | | | 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) [...]") added new versions of the getgroups(2)/setgroups(2) syscalls. Requested by: cperciva
* libkern: Drop incorrect qsort optimizationDag-Erling Smørgrav3 days1-13/+1
| | | | | | | | | See 5205b32de3fb for details. PR: 287089 MFC after: 1 week Reviewed by: jlduran Differential Revision: https://reviews.freebsd.org/D51919
* ucred groups: restore a useful commentEric van Gyzen3 days1-1/+2
| | | | | | | | | The most useful comments are those that explain _why_. Restore such an explanation dropped by commit 6d2efbb34fd. Reviewed by: kevans Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D51918
* nfsd: Fix slow leaks of NAMEI buffersRick Macklem3 days2-0/+7
| | | | | | | | | | | | | | | | | Commit 5b5b7e2ca2fa changed namei()s behaviour such that it does not free the NAMEI buffer unless returning an error. The nfsd was not fixed for this. Fortunately, the only leak would be one NAMEI buffer each time mountd(8) reloads the exports. (There were also leaks in the pNFS server configuration, but almost no one uses it.) This patch fixes the leaks by adding NDFREE_PNBUF() macros in the appropriate places. MFC after: 2 weeks Discussed with: kib Fixes: 5b5b7e2ca2fa ("vfs: always retain path buffer after lookup")
* ossl: Add chacha-armv8-sve.S on aarch64John Baldwin3 days2-0/+3
| | | | Fixes: 4757b351ea9d ("openssl: Import version 3.5.1")
* iflib: Only define lro_enabled if either INET or INET6 is definedJohn Baldwin3 days1-0/+4
| | | | Fixes: e69573bc2bee ("iflib: simplify lro & use tcp_lro_queue_mbuf()")
* Revert "Remove Secure RPC DES authentication"Lexi Winter3 days1-0/+26
| | | | | | This reverts commit 7ac276298b72982189ac1a5b17461936dc00163e. Requested by: kib
* kern: fix freebsd14 getgroups(2) compatKyle Evans3 days1-1/+1
| | | | | | | | | | | We need to actually copyout the remainder of the groups if the egid succeeded, not failed. My test that was designed to catch this along with the previously-found syzkaller panic did not zero out the groups array prior to re-fetching, so it did not catch that entries beyond the first were not actually populated. Pointy hat: kevans Fixes: 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) [...]")
* makefs: zfs uberblock location is calculated wrongToomas Soome3 days1-0/+6
| | | | | | | | | | | The shift used to calculate uberblock location depends both on minimum size (UBERBLOCK_SHIFT) and MAX_UBERBLOCK_SHIFT. Since makefs defaults to use ashift 12, it incidentally does get the correct size, but ashift 9 does not work with current code. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51860
* ipheth(4): Add CDC-NCM support for RXShengYi Hung3 days2-48/+191
| | | | | | | | | | | | | | | The CDC-NCM (USB Communications Device Class – Network Control Model) protocol allows multiple Ethernet frames to be encapsulated into a single USB transfer. On iOS, CDC-NCM is currently implemented for RX only and uses a fixed number of entries (16). To maintain compatibility with older iOS versions, we attempt to enable NCM on the USB device first; if this fails, we fall back to the original behavior. Approved by: lwhsu (mentor), markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* sysent: regenerate after bumping setgroups/getgroupsKyle Evans3 days10-133/+159
|
* kern: fix setgroups(2) and getgroups(2) to match other platformsKyle Evans3 days2-50/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | On most other platforms observed, including OpenBSD, NetBSD, and Linux, these system calls have long since been converted to only touching the supplementary groups of the process. This poses both portability and security concerns in porting software to and from FreeBSD, as this subtle difference is a landmine waiting to happen. Bugs have been discovered even in FreeBSD-local sources, since this behavior is somewhat unintuitive (see, e.g., fix 48fd05999b0f for chroot(8)). Now that the egid is tracked outside of cr_groups in our ucred, convert the syscalls to deal with only supplementary groups. Some remaining stragglers in base that had baked in assumptions about these syscalls are fixed in the process to avoid heartburn in conversion. For relnotes: application developers should audit their use of both setgroups(2) and getgroups(2) for signs that they had assumed the previous FreeBSD behavior of using the first element for the egid. Any calls to setgroups() to clear groups that used a single array of the now or soon-to-be egid can be converted to setgroups(0, NULL) calls to clear the supplementary groups entirely on all FreeBSD versions. Co-authored-by: olce (but bugs are likely mine) Relnotes: yes (see last paragraph) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51648
* watchdog: Convert to using sbintime_t formatJustin Hibbits4 days2-100/+119
| | | | | | | | | | | | | | Summary: Some watchdogs are now based on a countdown timer instead of a bit check. To deal with these, convert the watchdog framework to use sbintime_t instead of power-of-2-nanoseconds. This allows more precision, and more variety of watchdog timeouts. Keep the old method as a compatibility layer, so that drivers can be migrated slowly, as needed. Reviewed by: jhb Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D49183
* watchdog: Add a new "Control" ioctlJustin Hibbits4 days2-0/+28
| | | | | | | | | | Summary: In preparation for a new watchdog timeout interface using sbintime_t, add a new control ioctl to arm, pat, and disarm the watchdog. Reviewed by: jhb, phk Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D49182
* inotify: Fix a namei path buffer leakMark Johnston4 days1-0/+1
| | | | | | Reviewed by: kib Fixes: f1f230439fa4 ("vfs: Initial revision of inotify") Differential Revision: https://reviews.freebsd.org/D51900
* mlx5: plug theoretical leak in vxlan rulesEric van Gyzen5 days1-2/+2
| | | | | | | | | | Plug a theoretical memory/refcount leak when adding a vxlan rule. This is not currently an actual leak, but it could become one. PR: 287945 Reviewed by: kib Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D51883