summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-12-13mips: Extract HWREna configuration and call from APsstable/12Jessica Clarke
The intent of mips_get_identity is to perform any feature detection and corresponding global system configuration, but currently it is also abused to set HWREna.UL on the BSP when available, with APs being left unconfigured. Extract that part out into its own function that gets called after mips_get_identity on the BSP, and call it on the APs from smp_init_secondary. This is a direct commit to stable/13 as mips no longer exists in main. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D48064 (cherry picked from commit 8176157d69b89a811f997cbbe490dfd57595f264)
2024-12-13rtld-elf: Fix for mips with LLD 14+Jessica Clarke
As of LLD 14, it no longer falls back to the address of .text if it can't find the entry point, and instead just uses address 0. Since the mips port has always used rtld_start as its entry point symbol but has never set RTLD_ENTRY to match (instead getting the default .rtld_start), with LLD 14+ it ends up using an entry point of 0, i.e. reinterpreting various headers and metadata sections as code, and thus quickly dies, in my case with SIGILL. This has seemingly always been a warning with LLD even when it defaulted to .text, but that went unnoticed this whole time, until now. Fix this by specifying the right symbol name. This is a direct commit to stable/13 as mips no longer exists in main. (cherry picked from commit d7bf409a63501a28357a9a9ec24628e1208d530d)
2024-12-12Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOSAlex Richardson
In order to do so we need to install the msdosfs headers to the bootstrap sysroot and avoid includes of kernel headers that may not exist on every host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs on FreeBSD 11+ as well as Linux and macOS. We also have to avoid using the IO_SYNC macro since that may not be available. In makefs it is only used to switch between calling bwrite() and bdwrite() which both call the same function. Therefore we can simply always call bwrite(). For our CheriBSD builds we always bootstrap makefs by setting LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary from the build tree to create a bootable disk image. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D23201 (cherry picked from commit 162ae9c834f6d9f9cb443bd62cceb23e0b5fef48)
2024-12-12makefs: avoid warning when creating FAT filesystem on existing fileEd Maste
Previously the mkfs_msdos function (from newfs_msdos) emitted warnings in the case that an image size is specified and the target is not a file, or no size is specified and the target is not a character device. The latter warning (not a character device) doesn't make sense when this code is used in makefs, regardless of whether an image size is specified or not. Sponsored by: The FreeBSD Foundation (cherry picked from commit d9aee13f6fdad3de080ac0f8b9847daf6b9d567b)
2024-12-12mips/malta: Prefer _start over _locore for entry point symbolJessica Clarke
These are aliases, but it's probably nicer to use the same symbol as we use for the actual ELF entry point. This is a direct commit to stable/13 as mips no longer exists in main. (cherry picked from commit e32b14ef10a7b0c3130ead9e676c8e6f261f0b69)
2024-12-12mips/malta: Explicitly set AP entry point to _locoreJessica Clarke
Otherwise we rely on the firmware implicitly ending up there without faulting. Perhaps the hardware this was tested on does so, but on QEMU this is not the case, as the AP will otherwise re-run bootloader code that tries to reconfigure PCI BARs and ends up faulting, so the AP is never seen by FreeBSD to have started. This matches Linux's arch/mips/kernel/smp-mt.c:vsmp_boot_secondary, which unconditionally writes to TCRestart (this register), albeit using a separate entry point, whilst ours is shared. This is a direct commit to stable/13 as mips no longer exists in main. Obtained from: CheriBSD (diagnosis; patch rewritten from scratch) (cherry picked from commit cc521bcf790bdcc76fddd619f35d0279f22e535a)
2024-08-25libalias: fix subtle racy problem in outside-inside forwardingEugene Grosbein
sys/netinet/libalias/alias_db.c has internal static function UseLink() that passes a link to CleanupLink() to verify if the link has expired. If so, UseLink() may return NULL. _FindLinkIn()'s usage of UseLink() is not quite correct. Assume there is "redirect_port udp" configured to forward incoming traffic for specific port to some internal address. Such a rule creates partially specified permanent link. After first such incoming packet libalias creates new fully specified temporary LINK_UDP with default timeout of 60 seconds. Also, in case of low traffic libalias may assign "timestamp" for this new temporary link way in the past because LibAliasTime is updated seldom and can keep old value for tens of seconds, and it will be used for the temporary link. It may happen that next incoming packet for redirected port passed to _FindLinkIn() results in a call to UseLink() that returns NULL due to detected expiration. Immediate return of NULL results in broken translation: either a packet is dropped (deny_incoming mode) or delivered to original destination address instead of internal one. Fix it with additional check for NULL to proceed with a search for original partially specified link. In case of UDP, it also recreates temporary fully specified link with a call to ReLink(). Practical examples are "redirect_port udp" rules for unidirectional SYSLOG protocol (port 514) or some low volume VPN encapsulated in UDP. Thanks to Peter Much for initial analysis and first version of a patch. Reported by: Peter Much <pmc@citylink.dinoex.sub.org> PR: 269770 (cherry picked from commit 8132e959099f0c533f698d8fbc17386f9144432f) (cherry picked from commit e5b85380836378c9e321a4e6d300591e6faf622a)
2024-07-01openssh: Fix pre-authentication remote code execution in sshd.Philip Paeps
Reported by: Qualys Threat Research Unit (TRU) Approved by: so Security: FreeBSD-SA-24:04.openssh Security: CVE-2024-6387 (cherry picked from commit 2abea9df01655633aabbb9bf3204c90722001202) (cherry picked from commit 25cf430cd551158135ef6f0c1aadf273ff3430c9)
2024-06-21virtio(4): Fix two typos in KASSERT messagesGordon Bergling
- s/emtpy/empty/ (cherry picked from commit 018a361f8902d629fca64be372ef9b266fee53ba)
2024-06-19camcontrol.8: Fix a typo in the manual pageGordon Bergling
- s/emtpy/empty/ (cherry picked from commit d1e652bf04bd94ed3469a5a2fcb6938b3f4dcbc0)
2024-05-16ipfw: Fix a typo in a source code commentGordon Bergling
- s/defaul/default/ (cherry picked from commit 78e4dbc34559f7b18ea85cafd6663db4e6d54af9)
2024-04-28wtap: Fix typos in kernel messagesGordon Bergling
- s/cant/can't/ (cherry picked from commit 026520a5f2d2ec01e19494c37b87448df86ef21a)
2024-04-28vmm(4): Fix a typo in a kernel messageGordon Bergling
- s/cant/can't/ (cherry picked from commit 8b5c5cae92d5b44f03636540a787fd6e994ce816)
2024-04-25sys: Remove two double words in source code commentsGordon Bergling
- s/of of/of/ (cherry picked from commit cf5d9c41246c0583b28d5c1101c6f334e38a67e9)
2024-04-25mwlstats: Fix a typo in an error messageGordon Bergling
- s/the the/the/ (cherry picked from commit e1e149ad8ada85267e981cb9d4c6b48d4ce9e1f4)
2024-04-24arm: Fix a typo in a KASSERT messageGordon Bergling
- s/resoure/resource/ (cherry picked from commit 178cf4b9db4bb6726e845b10923788cf4e7a5ef0)
2024-04-24freescale: Fix a typo in a source code commentGordon Bergling
- s/cant/can't/ (cherry picked from commit 26f6c148bce2d6734a07ea621616724f1e76e4fd)
2024-04-24geom(4): Fix a typo in a source code commentGordon Bergling
- s/cant/can't/ (cherry picked from commit c0a01ee83d3d4749ac9e7e46d8d47b991c65537f)
2024-04-24uipc_domain: Fix a typo in a source code commentGordon Bergling
- s/cant/can't/ (cherry picked from commit 9576fc16ca6cb360e085735dfaf891ae6d7f6181)
2024-04-21oce(4): Fix a typo in a source code commentGordon Bergling
- s/addres/address/ (cherry picked from commit e991acd5d0f60fe3c57acb452003c551194a758b)
2024-04-21muge(4): Fix a typo in a source code commentGordon Bergling
- s/addres/address/ (cherry picked from commit 046fe202e76623988ac612b20047940b86dd373f)
2024-02-27if_hn: Fix two typos in source code commentsGordon Bergling
- s/managment/management/ - s/transacion/transaction/ Obtained from: NetBSD (cherry picked from commit 61b88a230bac766f55984d8d33b98845d2b0d1a9)
2024-02-25umcs(4): Fix two typos in source code commentsGordon Bergling
- s/frequences/frequencies/ (cherry picked from commit 059fd69e749953c12b2cf099b34d3323d9c67d11)
2024-02-25sk(4): Fix a typo in a source code commentGordon Bergling
- /integeated/integrated/ - s/extented/extended/ Obtained from: NetBSD (cherry picked from commit a53204c22790a94a15f0e3c153f7fa12f9d57d27)
2024-02-25bge(4): Fix some typos in source code commentsGordon Bergling
- s/firwmare/firmware/ - s/recue/reduce/ - s/throughpout/throughput/ - s/hardwares/hardware/ Obtainted from: NetBSD (cherry picked from commit d646dca3bc1bbd3bfd38bc5ed375d7a346768dcf)
2024-02-25random(4): Fix a typo in a source code commentGordon Bergling
- s/parmeter/parameter/ (cherry picked from commit 5e89e34f846a233fb97302c05af5a47c694405a1)
2024-02-25vge(4): Fix a typo in a source code commentGordon Bergling
- s/embadded/embedded/ (cherry picked from commit 04440331b5700e124c42b570ae1dfd00ea9c26f7)
2024-02-25uath(4): Fix a typo in a source code commentGordon Bergling
- s/parmeter/parameter/ (cherry picked from commit 5a476e64b543dc63fae7fcd243dc066dced31c3b)
2024-02-22iov.h: Fix a typo in a source code commentGordon Bergling
- s/subystem/subsystem/ (cherry picked from commit f24c816daa00852f4a1d37649d00905a0d67f1b3)
2024-02-21heimdal: Fix NULL derefCy Schubert
A flawed logical condition allows a malicious actor to remotely trigger a NULL pointer dereference using a crafted negTokenInit token. Upstream notes: Reported to Heimdal by Michał Kępień <michal@isc.org>. From the report: Acknowledgement --------------- This flaw was found while working on addressing ZDI-CAN-12302: ISC BIND TKEY Query Heap-based Buffer Overflow Remote Code Execution Vulnerability, which was reported to ISC by Trend Micro's Zero Day Security: CVE-2022-3116 Obtained from: upstream 7a19658c1 (cherry picked from commit fc773115fa2dbb6c01377f2ed47dabf79a4e361a) (cherry picked from commit 6b421e431a2de6eb9e8bd670efffe76e6617d520)
2024-02-16graid: MFC: unbreak Promise RAID1 with 4+ providersEugene Grosbein
Fix a problem in graid implementation of Promise RAID1 created with 4+ disks. Such an array generally works fine until reboot only due to a bug in metadata writing code. Before the fix, next taste erronously created RAID1E (kind of RAID10) instead of RAID1, hence graid used wrong offsets for I/O operations. The bug did not affect Promise RAID1 arrays with 2 or 3 disks only. Reviewed by: mav (cherry picked from commit 81092e92ea5184c4eeedad58044d72cfef72dd24)
2024-01-30msun: remove fabs from Symbol.map, and adjust commentDimitry Andric
We have s_fabs.c, but fabs(3) is already provided by libc due to historical reasons, so it is not compiled into libm. When the linker does not use --undefined-version, this leads to a complaint about the symbol being nonexistent, so remove it from Symbol.map. While here, adjust the comment about some functions being supplied by libc: while it is true that all these are indeed in libc, libm still includes its own versions of frexp(3), isnan(3), isnanf(3), and isnanl(3). Reported by: Steve Kargl <sgk@troutmask.apl.washington.edu> MFC after: 3 days (cherry picked from commit d04e03c19a8d7660ea36f62720eef9bc96b69889)
2024-01-15kern linker: Do not retry loading modules on EEXISTZhenlei Huang
LINKER_LOAD_FILE() calls linker_load_dependencies() which will return EEXIST in case the module to be loaded has already been compiled into the kernel. Since the format of the module is now recognized then there is no need to retry loading with a different linker, otherwise the userland will get misleading error number ENOEXEC. PR: 274936 Reviewed by: dfr MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42474 (cherry picked from commit ecf710f0e04e3314a492747124166ccb7cf4019e) (cherry picked from commit e7fd435d3d4e888d9894d8c212c29ae6e2768f74) (cherry picked from commit d18326a7cf14804086550c7463be9721e8d28b64)
2024-01-04heimdal: Fix man page and documentation typosCy Schubert
Reported by: Jens Schweikhardt <schweikh@schweikhardt.net> (cherry picked from commit fc55c20355d889bf3d3f81d94b3614a0c4253fa0)
2024-01-01nfscl: Fix handling of expired Kerberos credentials (NFSv4.1/4.2)Rick Macklem
If the NFS server detects that the Kerberos credentials provided by a NFSv4.1/4.2 mount using sec=krb5[ip] have expired, the NFS server replies with a krpc layer error of RPC_AUTHERROR. When this happened, the client erroneously left the NFSv4.1/4.2 session slot busy, so that it could not be used by other RPCs. If this happened for all session slots, the mount point would hang. This patch fixes the problem by releasing the session slot and resetting its sequence# upon receiving a RPC_AUTHERROR reply. This bug only affects NFSv4.1/4.2 mounts using sec=krb5[ip], but has existed since NFSv4.1 client support was added to FreeBSD. So, why has the bug remained undetected for so long? I cannot be sure, but I suspect that, often, the client detected the Kerberos credential expiration before attempting the RPC. For this case, the client would not do the RPC and, as such, there would be no busy session slot. Also, no hang would occur until all session slots are busied (64 for a FreeBSD client/server), so many cases of the bug probably went undetected? Also, use of sec=krb5[ip] mounts are not that common. PR: 275905 (cherry picked from commit a558130881e9d574dc5f37827fe2284667d5aba8)
2023-12-24Fix snprintf truncation in telnetDimitry Andric
Building telnet with clang 18 results in the following warning: contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^ The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case. Bump the buffer to 11 chars to avoid truncation. MFC after: 3 days (cherry picked from commit c794d188222a4d3414233ff9630d47eedc090fbe)
2023-12-24contrib/tzdata: import tzdata 2023dPhilip Paeps
Changes: https://github.com/eggert/tz/blob/2023d/NEWS (cherry picked from commit eebb9c2caea1584773ae4cec311cee1eea5b1655)
2023-12-17nfscl: Fix comment for commit 6aded1e6b2e5Rick Macklem
Commit 6aded1e6b2e5 fixed a rare case when handling an NFSv4 Rename reply when delegations are in use. This patch fixes the associated comment. (cherry picked from commit 0a958aa16fed1978879d64e3b225f1d232cc5a98)
2023-12-17nfscl: Fix processing of a rare Rename reply caseRick Macklem
When delegations are enabled (they are not by default in the FreeBSD NFSv4 server), rename will check for and return delegations. If the second of these DelegReturn operations were to fail (they rarely do), then the code would not retry the rename with returning delegations, as it is intended to do. The patch fixes the problem, since the DelegReturn reply status is the second iteration of the loop and not the first iteration. As noted, this bug would have rarely manifested a problem, since DelegReturn operations do not normally fail. (cherry picked from commit 6aded1e6b2e5549120031032e1c7f8b002882327)
2023-12-16rc.conf: correct $ntp_leapfile_sourcesPhilip Paeps
IETF is no longer serving leap-seconds.list. Point at IANA instead. This fixes "service ntpd fetch". (cherry picked from commit b1c95af45488bef649e9a84890e2414ff80b3a00)
2023-12-14tty: Avoid a kernel memory discloure via kern.ttysMark Johnston
Four pad bytes at the end of each xtty structure were not being cleared before being copied out. Fix this by clearing the whole structure before populating fields. MFC after: 3 days Reported by: KMSAN (cherry picked from commit 3c0fb026b2fc998fa9bea8aed76e96c58671aee3)
2023-12-10OpenZFS: Ensure that zfs_getattr() initializes the va_rdev fieldMark Johnston
Otherwise the field is left uninitialized, leading to a possible kernel memory disclosure to userspace or to the network. Use the same initialization value we use in zfsctl_common_getattr(). Reported-by: KMSAN Sponsored-by: The FreeBSD Foundation Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ed Maste <emaste@FreeBSD.org> Signed-off-by: Mark Johnston <markj@FreeBSD.org> (cherry picked from commit 11656234b560c401dec6a16e1bf048b20fd31aac) (cherry picked from commit af1e8b52d26502bac9a2484b87d1879334debd67) Differential Revision: https://reviews.freebsd.org/D42987
2023-12-05periodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.listXin LI
when ntpd is enabled. The leap-seconds.list is used exclusively by ntpd, therefore, do not bother to perform the fetch when ntpd is not enabled. PR: conf/275419 Reviewed by: cy, michaelo, imp Differential Revision: https://reviews.freebsd.org/D42875 (cherry picked from commit 3b3195f6767b39eb33b3523134ef988931c9c86d)
2023-12-06usbdevs: add quirk for WD MyPassport Ultra External HDDEugene Grosbein
WD MyPassport Ultra External HDD needs quirk UQ_MSC_NO_TEST_UNIT_READY to attach. (cherry picked from commit 970d73856b626a68597de19d37b68c376e2c0491)
2023-12-05pf: remove incorrect fragmentation checkKristof Provost
We do not need to check PFDESC_IP_REAS while tracking TCP state. Moreover, this check incorrectly considers no-data packets (e.g. RST) to be in-window when this flag is not set. Sponsored by: Rubicon Communications, LLC ("Netgate") Approved by: so Security: FreeBSD-SA-23:17.pf (cherry picked from commit 6284d5f76d6bd2d97fe287c5adabf59c79688eda)
2023-12-02rc.conf(5): add <service>_umask to run the service using this valueEugene Grosbein
None of tools working with login classes change umask(1) and we had no ways to specify non-default umask for a service not touching its startup script. This change makes in possible. Some file-sharing services that create new files may benefit from it. Differential: https://reviews.freebsd.org/D36309 (cherry picked from commit 160a2f2cdda806e104c0d3194bfb84b208ad1ae8)
2023-12-02rc: add ${name}_setup script supportFranco Fichtner
Run a service-based setup script before running the start command. Useful for automatic configuration file generation. Reviewed by: https://reviews.freebsd.org/D36006 (cherry picked from commit c9be47b34dd847da1d4ab0feee4a6100b2c5ea0d)
2023-12-01libc/libc/rpc: refactor some global variablesAlan Somers
* Combine dg_fd_locks and dg_cv into one array. * Similarly for vc_fd_locks and vc_cv * Turn some macros into inline functions This is a mostly cosmetic change to make refactoring these strutures in a future commit easier. Sponsored by: Axcient Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42597 (cherry picked from commit a5c2f4e939430f0048136c39fb9fa6093d401905) lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees This saves oodles of memory, especially when "ulimit -n" is large. It also prevents a buffer overflow if getrlimit should fail. Also replace per-fd condvars with mutexes to simplify the code. PR: 274968 Sponsored by: Axcient Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42597 (cherry picked from commit 24938f9311c9c9acc1ce747f4e6a088c2dbc967d)
2023-11-30dnode_is_dirty: check dnode and its data for dirtinessRob Norris
Over its history this the dirty dnode test has been changed between checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and `dn_dirty_record`. It turns out both are actually required. In the case of appending data to a newly created file, the dnode proper is dirtied (at least to change the blocksize) and dirty records are added. Thus, a single logical operation is represented by separate dirty indicators, and must not be separated. The incorrect dirty check becomes a problem when the first block of a file is being appended to while another process is calling lseek to skip holes. There is a small window where the dnode part is undirtied while there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)` would not know that the file is dirty, and would go to `dnode_next_offset()`. Since the object has no data blocks yet, it returns `ESRCH`, indicating no data found, which results in `ENXIO` being returned to `lseek()`'s caller. This change simply updates the dirty check to check both types of dirty. If there's anything dirty at all, we immediately go to the "wait for sync" stage, It doesn't really matter after that; both changes are on disk, so the dirty fields should be correct. Sponsored by: Klara, Inc. Sponsored by: Wasabi Technology, Inc.
2023-11-29ng_ipfw: allow use of 32 bits wide cookiesEugene Grosbein
There is no reason in truncating 32 bits cookie value to 16 bits. Reviewed by: glebius (cherry picked from commit 20e1f207cc789a28783344614d6d1d1c639c5797)