]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 months agoacl_is_trivial_np(3): minor fixes
Kyle Evans [Mon, 19 Jun 2023 05:31:16 +0000 (00:31 -0500)]
acl_is_trivial_np(3): minor fixes

- Correct the document title
- This function has an _np suffix
- acl_strip_np has a manpage, xref it
- RETURN VALUES should describe acl_is_trivial_np, not acl_get_tag_type

Sponsored by: Klara, Inc.

(cherry picked from commit 0e96337b11910b444763439a722c89983d660a09)

12 months agovn_path_to_global_path_hardlink(): initialize len
Konstantin Belousov [Tue, 4 Jul 2023 07:46:15 +0000 (10:46 +0300)]
vn_path_to_global_path_hardlink(): initialize len

(cherry picked from commit d7614c010c762dcb29110073e7fbecf048fa3a32)

12 months agovn_path_to_global_path_hardlink(): avoid freeing non-initialized pointer
Konstantin Belousov [Mon, 3 Jul 2023 17:22:33 +0000 (20:22 +0300)]
vn_path_to_global_path_hardlink(): avoid freeing non-initialized pointer

(cherry picked from commit d6b900c915c19ac1bb5d57659695fd143864be66)

12 months agosys_setpgid(): style, remove extra ()s
Konstantin Belousov [Fri, 7 Jul 2023 16:59:41 +0000 (19:59 +0300)]
sys_setpgid(): style, remove extra ()s

(cherry picked from commit ed84cb591df70b860f988c455d70731e6df15186)

12 months agoifconfig.8: Document limitation of groupname
Koichiro Iwao [Tue, 20 Jun 2023 10:14:39 +0000 (19:14 +0900)]
ifconfig.8: Document limitation of groupname

Approved by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40645

(cherry picked from commit 9aca30d87804b9b9f646f9ef3ad5ae6af81fd40a)

12 months agohier(7): remove entry for non-existent /usr/compat
Mitchell Horne [Thu, 6 Jul 2023 14:11:21 +0000 (11:11 -0300)]
hier(7): remove entry for non-existent /usr/compat

This is historical (?), but today /compat is the default according to
linux(4). The only remaining reference to /usr/compat in the src tree is
under tools/test/stress2.

Add a next-level entry for /compat/linux.

PR: 261349
Reviewed by: grahamperrin, karels, dchagin
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40876

(cherry picked from commit 5e7308a7bcb6675de6049afd4a5dd9d6795057b2)

12 months agoif_bridge: fix potential panic
Kristof Provost [Thu, 18 May 2023 18:04:45 +0000 (20:04 +0200)]
if_bridge: fix potential panic

When a new bridge_rtnode is added it is added with a NULL brt_dst. The
brt_dst is set after the entry is added. This means there's a small
window where another core could also attempt to add this node, leading
to the code attempting to log that the MAC addresses moved to a new
interface.
Aside from that being a spurious log entry it also panics, because
obif is NULL (and we attempt to dereference it).

Avoid this by settings brt_dst before we insert the bridge_rtnode.
Assert that obif is non-NULL, as an extra precaution.

Reported by: olivier@
Reviewed by: zlei@
Differential Revision: https://reviews.freebsd.org/D40147

(cherry picked from commit f3546eacf0daac55fe08b6ad5849b0e440f75ffb)

12 months agopam_krb5: Add missing patch
Cy Schubert [Sat, 8 Jul 2023 03:09:18 +0000 (20:09 -0700)]
pam_krb5: Add missing patch

Include a portion of the patch that was missed in 813847e49e35.

Reported by: markj
Fixes: 813847e49e35

(cherry picked from commit bfa51318dee8afd9307f15e49a6a521938dccd06)

12 months agorelease/DVD_PACKAGES: Update the names of drm-kmod ports
Li-Wen Hsu [Tue, 4 Jul 2023 20:24:52 +0000 (04:24 +0800)]
release/DVD_PACKAGES: Update the names of drm-kmod ports

When MFC, graphics/drm-515-kmod is not merged as it only suports 14+.

Reviewed by: x11 (manu), re (gjb)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40770

(cherry picked from commit fea4a44c1965d4b709362a74abb0ab4b28ec29ac)

12 months agoriscv: improve KTR_TRAP trace entries
Mitchell Horne [Tue, 20 Jun 2023 14:52:26 +0000 (11:52 -0300)]
riscv: improve KTR_TRAP trace entries

For more informative records of exceptions, include key details such as
the exception code and stval register contents. Remove the curthread
argument as it is redundant (saved with every ktr entry), and the
trapframe as it is somewhat meaningless.

Add a new KTR_TRAP trace record for interrupts.

Reviewed by: markj, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40584

(cherry picked from commit 7756232199adf60343ae0b940e2b27fe363905bc)

12 months agoamdtemp: Fix missing 49 degree offset on current EPYC CPUs
Val Packett [Sat, 17 Jun 2023 16:29:53 +0000 (13:29 -0300)]
amdtemp: Fix missing 49 degree offset on current EPYC CPUs

On an EPYC 7313P, the temperature reported by amdtemp was off, because
the offset was not applied. Turns out it needs to be applied with one
more condition: https://lkml.org/lkml/2023/4/13/1095

Reviewed by: mhorne
Tested by: mike.jakubik@gmail.com
MFC after: 1 week
Sponsored by: https://www.patreon.com/valpackett
Pull Request: https://github.com/freebsd/freebsd-src/pull/754

(cherry picked from commit c1cbabe8ae5702a1e54d62401fe3b58a84fcb3e4)

12 months agoarm64/disassem.c: Add shifted register definitions with ror
Mykola Hohsadze [Sat, 17 Jun 2023 15:31:25 +0000 (12:31 -0300)]
arm64/disassem.c: Add shifted register definitions with ror

Add disassembly support for the following shifted register instructions:
* mvn
* orn
* orr
* and
* ands
* bic
* bics
* eon
* eor
* tst

According to Arm64 documenation, operational pseuducode of shifted
register instruction must return `UNDEFINED` if shift type is `RESERVED`
('11'). Hence, removed "rsv" from `shift_2` array and add "ror". In case
of shift type is 3 and this type is `RESERVED`, we will return
`undefined`.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40386

(cherry picked from commit 9aef25d2686b9e7fb9cb700d63291338e8e30bb6)

12 months agohier(7): adjust overlays/ subdirectory
Mitchell Horne [Thu, 29 Jun 2023 16:53:52 +0000 (13:53 -0300)]
hier(7): adjust overlays/ subdirectory

Device tree overlays are installed in /boot/dtb/overlays by default.
Adjust the comment to mention fdt_overlays and loader.conf, but do not
repeat what is said in the parent directory's description.

PR: 261349
Reviewed by: grahamperrin, kevans
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40785

(cherry picked from commit 651d1efd96a692a141a4c61d54d6a41ee2c0d851)

12 months agohier(7): tweak /media description
Mitchell Horne [Wed, 28 Jun 2023 16:21:28 +0000 (13:21 -0300)]
hier(7): tweak /media description

It comes as an empty directory by default. While here, use a serial
(Oxford) comma, per the FDP Primer.

PR: 261349
Reported by: karels
Reviewed by: grahamperrin, karels
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40774

(cherry picked from commit acdf666147eea8bf8626d3733087861493d90e23)

12 months agohier(7): improvement, modernisation
Graham Perrin [Sat, 10 Jun 2023 08:41:35 +0000 (09:41 +0100)]
hier(7): improvement, modernisation

Consistent use of lowercase, spacing between sections, etc.

Cease mentioning floppy disks.

De-list /usr/share/misc/fonts/, which has been ??? (without a
description) for twenty-seven years.

Change zpool to pool. (zpool is a command.)

Uppercase PPP for Point-to-Point Protocol.

A few other changes to wording, including avoidance of the phrase
pre-fab.

Update the descriptions of:

* /tmp/
* /usr/share/misc/
* /var/preserve/
* /var/tmp/
* /var/tmp/vi.recover/.

Refer to vi(1) instead of ex(1).

https://bugs.freebsd.org/261349

PR:                      261349
Reviewed by:             mhorne
Approved by:             mhorne
Pull request:            https://github.com/freebsd/freebsd-src/pull/763

(cherry picked from commit 6469f9c595c609dd552ec198a16c471c87df7c57)
(cherry picked from commit 5ca7f02946940ff698741d4da4a30b554cb0f592)
(cherry picked from commit b374a3921d97bdb20b103aaeb91988c3d355ea71)

12 months agohier(7): alphabetical order
Graham Perrin [Tue, 30 May 2023 19:30:20 +0000 (20:30 +0100)]
hier(7): alphabetical order

Approved by:  mhorne
Pull request: https://github.com/freebsd/freebsd-src/pull/756

(cherry picked from commit 2071e54c226a120a62baa710bef225c4f6ad5ee3)

12 months agomac(9): update SEE ALSO
Mitchell Horne [Mon, 12 Jun 2023 18:59:00 +0000 (15:59 -0300)]
mac(9): update SEE ALSO

Rather than maintaining an incomplete list of MAC modules references,
just reference mac(4), where such a list can be found.

Reviewed by: Mina Galić <freebsd@igalic.co>
Reviewed by: Pau Amma <pauamma@gundo.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40485

(cherry picked from commit 0449bc249b78a8c85afe375e581432351f90427d)

12 months agomac(4): update the references to MAC modules
Mitchell Horne [Mon, 12 Jun 2023 18:56:34 +0000 (15:56 -0300)]
mac(4): update the references to MAC modules

Add entries for mac_ntpd(4) and mac_priority(4) to the table of MAC
modules.

Drop the entry for mac_none(4) from the list, but retain the
cross-reference in SEE ALSO. This module has no functional impact and is
of minimal interest to users. Add a new cross-reference to the similar
mac_stub(4), limited to SEE ALSO for the same reasoning.

Reviewed by: Pau Amma <pauamma@gundo.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40483

(cherry picked from commit e2cb7201015dbd2d4cea5c9b4e0385d11614263c)

12 months agohier(7): document libdata/pkgconfig
Baptiste Daroussin [Mon, 25 Jul 2022 09:14:50 +0000 (11:14 +0200)]
hier(7): document libdata/pkgconfig

(cherry picked from commit 94778fc7382d2d9dd474eca1f88a86364f768f15)

12 months agohier.7: Document /var/db/freebsd-update
Mateusz Piotrowski [Thu, 4 Aug 2022 13:57:18 +0000 (15:57 +0200)]
hier.7: Document /var/db/freebsd-update

MFC after: 3 days
Sponsored by: Klara, Inc.

(cherry picked from commit 3c4f8adc794d769bdc332a92f0920af928002441)

12 months agohier.7: Add some missing Xr's
Mateusz Piotrowski [Tue, 28 Jun 2022 13:15:53 +0000 (15:15 +0200)]
hier.7: Add some missing Xr's

MFC after: 3 days

(cherry picked from commit c618ee727712900105212af29b3ebf16b1076875)

12 months agonetinet6: Implement in6_cksum_partial() using m_apply()
Mark Johnston [Fri, 23 Jun 2023 13:55:43 +0000 (09:55 -0400)]
netinet6: Implement in6_cksum_partial() using m_apply()

This ensures that in6_cksum_partial() can be applied to unmapped mbufs,
which can happen at least when icmp6_reflect() quotes a packet.

The basic idea is to restructure in6_cksum_partial() to operate on one
mbuf at a time.  If the buffer length is odd or unaligned, an extra
residual byte may be returned, to be incorporated into the checksum when
processing the next buffer.

PR: 268400
Reviewed by: cy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40598

(cherry picked from commit 6775ef4188b4d4c023e76ebd2b71fa8c2c7e7cd2)

12 months agonetinet tests: Add a test which connects a disconnected socket
Mark Johnston [Fri, 23 Jun 2023 14:06:13 +0000 (10:06 -0400)]
netinet tests: Add a test which connects a disconnected socket

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b1c66bc44af099174afb9840c7db011a5bd0225d)

12 months agopseudofs: Fix a potential out-of-bounds access in pfs_lookup()
Mark Johnston [Fri, 23 Jun 2023 13:54:39 +0000 (09:54 -0400)]
pseudofs: Fix a potential out-of-bounds access in pfs_lookup()

pseudofs nodes store their name in a flexible array member, so the node
allocation is sized using the length of the name, including a nul
terminator.  pfs_lookup() scans a directory of nodes, comparing names to
find a match.  The comparison was incorrect and assumed that all node
names were at least as long as the name being looked up, which of course
isn't true.

I believe the bug is mostly harmless since it cannot result in false
positive or negative matches from the lookup, but it triggers a KASAN
check.

Reported by: pho
Reviewed by: kib, Olivier Certner <olce.freebsd@certner.fr>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40692

(cherry picked from commit fc915f1be145a52c53f6f1c37525043216e32bb8)

12 months agoperiodic: Honor kern.localbase
Juraj Lutter [Tue, 6 Jun 2023 11:40:49 +0000 (13:40 +0200)]
periodic: Honor kern.localbase

Take kern.localbase into account with fallback to /usr/local and
also allow for LOCALBASE/etc/periodic.conf (similarly to what
many other utilities do).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40435

(cherry picked from commit e5d7100c09e03e66535eee69d7e454c01e4a9d28)

12 months agokern_lockf.c: fix typo
Konstantin Belousov [Tue, 4 Jul 2023 22:23:57 +0000 (01:23 +0300)]
kern_lockf.c: fix typo

(cherry picked from commit 658e7620672f8eb650695992b4a73e004c5f101b)

12 months agokillpg1(): update the herald comment
Konstantin Belousov [Fri, 16 Jun 2023 09:02:04 +0000 (12:02 +0300)]
killpg1(): update the herald comment

(cherry picked from commit 4b59d1724b765063891cb44c28079b4c503a02fd)

12 months agonfscl: Fix support for doing Null RPCs
Rick Macklem [Fri, 7 Apr 2023 19:57:26 +0000 (12:57 -0700)]
nfscl: Fix support for doing Null RPCs

Although the NFS client does not currently perform Null RPCs,
this fix is needed if/when it might do so.
Found during testing of experimental code that uses Null RPCs
to maintain/monitor TCP connections for "nconnect" mounts.

(cherry picked from commit 4adb28c0abfa3b8d076c7249f61a093c6eb9dac2)

12 months agorelease: update GCE configuration for python3
Glen Barber [Mon, 3 Jul 2023 19:28:33 +0000 (15:28 -0400)]
release: update GCE configuration for python3

Reported by: asomers
PR: 272354
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd

(cherry picked from commit 3f21d3e0babacabb9a32e0e9a8ab290025d5577c)

12 months agorelease: allow VM_EXTRA_PACKAGES to be specified in the environment
Brad Davis [Mon, 9 Aug 2021 16:31:51 +0000 (10:31 -0600)]
release: allow VM_EXTRA_PACKAGES to be specified in the environment

This is useful for adding extra packages to the build of an AMI.
For example:
env VM_EXTRA_PACKAGES="zsh" make -C release ec2ami

(cherry picked from commit 83952a5baa337cc257858feb4886d947ba1a60e3)

12 months agoctfconvert: Integer encoding types are unsigned
Mark Johnston [Tue, 6 Jun 2023 17:28:02 +0000 (13:28 -0400)]
ctfconvert: Integer encoding types are unsigned

Before this change, encodings in the user-defined range were being
sign-extended.

MFC after: 1 week
Sponsored by: Innovate UK

(cherry picked from commit 258a0d760aa8b42899a000e30f610f900a402556)

12 months agobhyve: Rename a pci_cfgrw() parameter
Mark Johnston [Wed, 28 Jun 2023 20:06:37 +0000 (16:06 -0400)]
bhyve: Rename a pci_cfgrw() parameter

pci_cfgrw() may be called via a write to the extended config space,
which is memory-mapped.  In this case, the name "eax" is misleading.
Give it a more generic name.  No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40732

(cherry picked from commit f4841d8af0cd42c16fa66529bfde7b3a8b4f16d6)

12 months agolibpthread: allocate rwlocks and spinlocks in dedicated cachelines
Greg Becker [Tue, 27 Jun 2023 01:08:29 +0000 (20:08 -0500)]
libpthread: allocate rwlocks and spinlocks in dedicated cachelines

Reduces severe performance degradation due to false-sharing. Note that this
does not account for hardware which can perform adjacent cacheline prefetch.

[mjg: massaged the commit message and the patch to use aligned_alloc
instead of malloc]

PR: 272238
MFC after: 1 week

(cherry picked from commit a6c0d801ca5934bb9b9cca6870ea7406d5db0641)

12 months agosyscalls: fix modspecific_t stack content leak
Ka Ho Ng [Tue, 27 Jun 2023 19:33:46 +0000 (15:33 -0400)]
syscalls: fix modspecific_t stack content leak

Zero-initialize the whole modspecific_t so that there would
not be kernel stack content leak in the unused part.

Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D40815

(cherry picked from commit 2cab2d43b83bddd44ecc1f267afb5e2725975ac7)

12 months agovn_lock_pair(): allow to request shared locking
Konstantin Belousov [Thu, 6 Apr 2023 04:11:08 +0000 (07:11 +0300)]
vn_lock_pair(): allow to request shared locking

(cherry picked from commit bb24eaea498268572aa140c35c02e02884cdf930)

12 months agovm_fault: move FAULT_* return codes out of range for Mach errors
Konstantin Belousov [Tue, 27 Jun 2023 11:41:14 +0000 (14:41 +0300)]
vm_fault: move FAULT_* return codes out of range for Mach errors

(cherry picked from commit ef747607ead43552cb3ebb093fadd2c39c56a36d)

12 months agoVFS: Remove VV_READLINK flag
Konstantin Belousov [Wed, 21 Jun 2023 16:37:30 +0000 (19:37 +0300)]
VFS: Remove VV_READLINK flag

(cherry picked from commit 4a402dfe0bc44770c9eac6e58a501e4805e29413)

12 months agofdescfs: improve linrdlnk mount option
Konstantin Belousov [Thu, 22 Jun 2023 13:30:59 +0000 (16:30 +0300)]
fdescfs: improve linrdlnk mount option

PR: 272127

(cherry picked from commit 3bffa2262328e4ff1737516f176107f607e7bc76)

12 months agoUpgrade to OpenPAM Ximenia.
Dag-Erling Smørgrav [Tue, 27 Jun 2023 17:03:17 +0000 (19:03 +0200)]
Upgrade to OpenPAM Ximenia.

Merge commit '5894a4142a9d5ae5f7f6bee1f46237a3d20d0b5b'

(cherry picked from commit 3ba4c8c81a28de3e00ccf6d7f92c6f8e58bef456)

12 months agom4: Support long options.
Dag-Erling Smørgrav [Wed, 21 Jun 2023 20:58:40 +0000 (20:58 +0000)]
m4: Support long options.

The option names are identical to those of the equivalent options in GNU m4, except of course for --gnu which does not exist in GNU m4.

While here, make the argument to -d / --debug optional, with the same default behavior as in GNU m4, and document it properly.

Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D40694

(cherry picked from commit 47b32f8f93b46ce2c7fe3973c331a40096b529da)

m4: Add -G option which reverses -g.

This matches GNU m4's -G / --traditional option, and although BSD m4 in non-GNU mode is not exactly identical to GNU mode in traditional mode, it's close enough.

Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D40697

(cherry picked from commit 6c9ed64c94f192eda8c8b5e9e2b92ff93da36de2)

m4: Miscellaneous man page fixes.

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

(cherry picked from commit db4c5b8a05bbd54a00dad145a91902d71c1f92a1)

Fix spelling of "behavior" to be consistent with the rest of the file

(cherry picked from commit 764464af49688e74fd6d803df0404ca4726dd460)

12 months agoasa: Error out if writing to stdout failed.
Dag-Erling Smørgrav [Thu, 15 Jun 2023 19:23:19 +0000 (19:23 +0000)]
asa: Error out if writing to stdout failed.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40562

(cherry picked from commit 9e379f9639d51442ad1d5e1800c687ef2c954901)

asa: Read from stdin if *argv is "-".

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40563

(cherry picked from commit f08f90e6987775f88d25efbd8762c361819f40ba)

asa: Add some unit tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40564

(cherry picked from commit b7412da2e122d9274341ef840c6918409bc523b3)

12 months agomount_nfs.8: Note a case where the "nconnect" option does not work
Rick Macklem [Sun, 18 Jun 2023 20:02:20 +0000 (13:02 -0700)]
mount_nfs.8: Note a case where the "nconnect" option does not work

The "nconnect" NFS mount option will not work
correctly for servers where the TCP connections
might connect to different NFS clusters that do not
share NFSv4.1/4.2 state information, such as file locks.

This patch adds a sentence to the "nconnect" section
of mount_nfs.8 noting this case.

This is a content change.

(cherry picked from commit 7e53f16baa3a02118f40c50587efde0338b5053e)

12 months agolibc.a: implement _rtld_addr_phdr()
Konstantin Belousov [Sat, 24 Jun 2023 10:59:56 +0000 (13:59 +0300)]
libc.a: implement _rtld_addr_phdr()

(cherry picked from commit 42ceab3ea1a997db93b65404be0ee4b17b5382d7)

12 months agoSYSCALL_MODULE(9): fix references to modfind(2) and modstat(2)
Ka Ho Ng [Thu, 15 Jun 2023 19:37:53 +0000 (15:37 -0400)]
SYSCALL_MODULE(9): fix references to modfind(2) and modstat(2)

Sponsored by: Juniper Networks, Inc.
Reviewed by: delphij
MFC after: 1 week

(cherry picked from commit 9f135336f5057ae5a3f54fd9b1aa517cff0f9d3b)

12 months agopf: fix some cc --analyze warnings
Mateusz Guzik [Tue, 19 Oct 2021 11:57:47 +0000 (11:57 +0000)]
pf: fix some cc --analyze warnings

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit bcd4c17ccaacf995224882dc1d05e2a51867bdf2)

12 months agolinux(4): Implement close_range over native
Dmitry Chagin [Tue, 4 Apr 2023 20:24:04 +0000 (23:24 +0300)]
linux(4): Implement close_range over native

Handling of the CLOSE_RANGE_UNSHARE flag is not implemented due to
difference in fd unsharing mechanism in the Linux and FreeBSD.

Reviewed by: mjg
Differential revision: https://reviews.freebsd.org/D39398
MFC after: 2 weeks

(cherry picked from commit 71bc17803edfaad545f0c1f1111ca892aed7a5c4)

12 months agoRevert "linux(4): The futex_wait operation should restart."
Dmitry Chagin [Sun, 11 Jun 2023 09:47:27 +0000 (12:47 +0300)]
Revert "linux(4): The futex_wait operation should restart."

This reverts commit 5eec19c8eb0e1afafd7290325c61611c9a13b621 due to its
wrong. Linux interrupts futex syscall on signal and return EINTR.

(cherry picked from commit 486459056822f080b1ae24600a4c6a7d8ff6f7d6)

12 months agolinux(4): Preserve fpu xsave state across signal delivery on amd64
Dmitry Chagin [Thu, 8 Jun 2023 22:33:26 +0000 (01:33 +0300)]
linux(4): Preserve fpu xsave state across signal delivery on amd64

PR: 270247
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D40444
MFC after: 2 weeks

(cherry picked from commit cbbac560911521c0ded3e06e713107176855fae4)

12 months agolinux(4): In preparation for xsave refactor fxsave code on amd64
Dmitry Chagin [Thu, 8 Jun 2023 22:32:46 +0000 (01:32 +0300)]
linux(4): In preparation for xsave refactor fxsave code on amd64

Due to fxsave area is os independent reimplement fxsave handmade code
using copying of a whole area.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D40443
MFC after: 2 weeks

(cherry picked from commit 920184ed6e43b19f4b71253b55fd3ba66a7f0bb2)

12 months agolinux(4) rt_sendsig: Remove the use of caddr_t
Dmitry Chagin [Tue, 6 Jun 2023 20:01:39 +0000 (23:01 +0300)]
linux(4) rt_sendsig: Remove the use of caddr_t

Replace caddr_t by more appropriate char *.

MFC after: 2 weeks

(cherry picked from commit 84617f6fccd45505f3eeebad1c8cdce1140b7f8e)

12 months agolinux(4): Fix stack unwinding across signal frame on x86_64
Dmitry Chagin [Sun, 28 May 2023 14:07:28 +0000 (17:07 +0300)]
linux(4): Fix stack unwinding across signal frame on x86_64

Get rid of using register numbers which is undefined in libunwind
on x86_64.

Differential Revision: https://reviews.freebsd.org/D40156
MFC after: 1 month

(cherry picked from commit 78c2e58fa5b0aa4518d79d8155c0513b9a04f531)

12 months agolinux(4): Preserve %rcx (return address) like a Linux do
Dmitry Chagin [Sun, 28 May 2023 14:06:47 +0000 (17:06 +0300)]
linux(4): Preserve %rcx (return address) like a Linux do

Perhaps, this does not makes much sense as destroyng %rcx declared by
the x86_64 Linux syscall ABI. However,:
a) if we get a signal while we are in the kernel, we should restore
   tf_rcx when preparing machine context for signal handlers.
b) the Linux world is strange, someone can depend on %rcx value
   after syscall, something like go.

Differential Revision: https://reviews.freebsd.org/D40155
MFC after: 1 month

(cherry picked from commit 037b60fb0fbcb2dd6b6cbb632b05a2939ff4ff29)

12 months agolinux(4): Simplify %r10 restoring on amd64
Dmitry Chagin [Sun, 28 May 2023 14:06:23 +0000 (17:06 +0300)]
linux(4): Simplify %r10 restoring on amd64

Restore %r10 at system call entry to avoid doing this multiply times.

Differential Revision: https://reviews.freebsd.org/D40154
MFC after: 1 month

(cherry picked from commit 185bd9fa3096595350ebe7bcd7e0ddcf17773030)

12 months agolinux(4): Add a comment explaining registers at syscall entry point on amd64
Dmitry Chagin [Sun, 28 May 2023 14:06:05 +0000 (17:06 +0300)]
linux(4): Add a comment explaining registers at syscall entry point on amd64

Differential Revision: https://reviews.freebsd.org/D40153
MFC after: 1 month

(cherry picked from commit a463dd810851fdae5efcb8f8205d742ebf221bc8)

12 months agolinux(4): Drop a weird comment from linux_set_syscall_retval on amd64
Dmitry Chagin [Sun, 28 May 2023 14:05:44 +0000 (17:05 +0300)]
linux(4): Drop a weird comment from linux_set_syscall_retval on amd64

I agree, it would be great to avoid PCB_FULL_IRET, however we should
follow Linux system call ABI.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40152
MFC after: 1 month

(cherry picked from commit a99b890ecd26131e0c91e5693b55f5700c40a847)

12 months agokdump: Add a facility to print numbers in decimal format always
Dmitry Chagin [Fri, 26 May 2023 16:35:08 +0000 (19:35 +0300)]
kdump: Add a facility to print numbers in decimal format always

To help grepping kdump output by pid or tid it makes sence to print
some numbers in decimal format always. Eg, process or thread identifier
at least, as they already printed in decimal format.
Switch to print pid/tid arguments of some Linux signal related syscalls
in decimal format.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D40099
MFC after: 1 week

(cherry picked from commit c2c9ac88c2bb62423ae91beeee4083b596922adc)

12 months agokdump: Decode linux_clone syscall flags
Dmitry Chagin [Fri, 26 May 2023 16:34:33 +0000 (19:34 +0300)]
kdump: Decode linux_clone syscall flags

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40151
MFC after: 1 week

(cherry picked from commit 829f3d7d2640490ea3dc4180aa96041f440fd743)

12 months agolibsysdecode: Decode linux_clone syscall flags
Dmitry Chagin [Fri, 26 May 2023 16:32:20 +0000 (19:32 +0300)]
libsysdecode: Decode linux_clone syscall flags

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40150
MFC after: 1 week

(cherry picked from commit bd35e83bcf03a3650b5574f81201e8e55af4cdd7)

12 months agolinux(4): Guard linux_fork.h by _KERNEL for use by libsysdecode
Dmitry Chagin [Fri, 26 May 2023 16:31:47 +0000 (19:31 +0300)]
linux(4): Guard linux_fork.h by _KERNEL for use by libsysdecode

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40149
MFC after: 1 month

(cherry picked from commit 3f1bfc136f8fb8c6a7c4dcccebd27962bc104670)

12 months agolinux(4): Implement ptrace_pokeusr for x86_64
Dmitry Chagin [Thu, 18 May 2023 17:02:35 +0000 (20:02 +0300)]
linux(4): Implement ptrace_pokeusr for x86_64

Differential Revision: https://reviews.freebsd.org/D40097
MFC after: 1 week

(cherry picked from commit 1d76741520c031730319ed976a6c394213991504)

12 months agolinux(4): Make ptrace_pokeusr machine dependent
Dmitry Chagin [Thu, 18 May 2023 17:01:12 +0000 (20:01 +0300)]
linux(4): Make ptrace_pokeusr machine dependent

Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week

(cherry picked from commit 3d0addcd35193461e927db6cfe4b6d9b579eed6b)

12 months agolinux(4): Make ptrace_peekusr machine dependend
Dmitry Chagin [Thu, 18 May 2023 17:00:12 +0000 (20:00 +0300)]
linux(4): Make ptrace_peekusr machine dependend

And partially implement it for x86_64.

Differential Revision: https://reviews.freebsd.org/D40095
MFC after: 1 week

(cherry picked from commit dd2a6cd701aea5a6ced59b9947e087304f7d7238)

12 months agolinux(4): Move linux_debug decalration to linux_util.h
Dmitry Chagin [Thu, 18 May 2023 16:58:23 +0000 (19:58 +0300)]
linux(4): Move linux_debug decalration to linux_util.h

To avoid inclusion of linux_mib.h with linux_util.h in cases where
we need rate limiting macro.

MFC after: 1 week

(cherry picked from commit 38a137f416203494f183cb2b309524102680105e)

12 months agolinux(4): Check fd passed to unlockpt()
Dmitry Chagin [Thu, 18 May 2023 07:55:39 +0000 (10:55 +0300)]
linux(4): Check fd passed to unlockpt()

In our implementation, grantpt() and unlockpt() don't actually have
any use, because PTY's are created on the fly and already have proper
permissions upon creation.
Atleast check that a proper fd passed to unlockpt(). For grantpt()
Glibc calls TIOCGPTN ioctl which would fail if fd is not a master.

Differential Revision: https://reviews.freebsd.org/D40100
MFC after: 1 week

(cherry picked from commit 0f62290e7f749b7a453d413dd72c406129a9aba5)

12 months agoktrace: Simplify ae6ac587, drop the sa var declaration
Dmitry Chagin [Tue, 16 May 2023 19:46:26 +0000 (22:46 +0300)]
ktrace: Simplify ae6ac587, drop the sa var declaration

Suggested by: kib
MFC after: 5 days

(cherry picked from commit 0282f87530b33ebba890794b07f75a2874357e3a)

12 months agoktrace: Fix syscall number on a child return path from fork
Dmitry Chagin [Sun, 14 May 2023 21:23:50 +0000 (00:23 +0300)]
ktrace: Fix syscall number on a child return path from fork

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

(cherry picked from commit ae6ac58745b58c0a3424b3714be1205821d93c51)

12 months agofstatat(2): restore AT_EMPTY_PATH handling
Konstantin Belousov [Tue, 2 May 2023 15:11:39 +0000 (18:11 +0300)]
fstatat(2): restore AT_EMPTY_PATH handling

Fixes: cb858340dcbf214cc4c4d78dbb741620d7b3a252
Reported by: markj
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a1d71cebc05ccfeedf95f2db3e94b17270167888)

12 months agolinux(4): Uniformly dev_t arguments translation
Dmitry Chagin [Fri, 28 Apr 2023 08:55:05 +0000 (11:55 +0300)]
linux(4): Uniformly dev_t arguments translation

The two main uses of dev_t are in struct stat and as a parameter of the
mknod system calls.
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity
with 12 bits set asaid for the major number and 20 for the minor number.
The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the
major number and m is a hex digit of the minor number.
The user-space dev_t encoded as mmmM MMmm, where M and m is the major
and minor numbers accordingly. This is downward compatible with legacy
systems where dev_t is 16 bits wide, encoded as MMmm.
In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers,
encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux
kernel and with legacy systems where dev_t is 16 bits wide.
In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers
are encoded as MMMmmmMm, therefore conversion of the device numbers between
Linux user-space and FreeBSD kernel required.

(cherry picked from commit 166e2e5a9e87d32dbfc7838903904673873f1e71)

12 months agolinux(4): Add a dedicated fstat() implementation
Dmitry Chagin [Thu, 29 Jun 2023 08:15:49 +0000 (11:15 +0300)]
linux(4): Add a dedicated fstat() implementation

In between kern_fstat() and translate_fd_major_minor(), another process
having the same filedesc could modify or close fd.

Reviewed by:            kib
Differential Revision:  https://reviews.freebsd.org/D39763

(cherry picked from commit 994ed958ae0545faa86dd43b6e64bf7b64b9220b)

12 months agolinux(4): Add a dedicated statat() implementation
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Add a dedicated statat() implementation

Get rid of calling Linux stat translation hook and specific to Linux
handling of non-vnode dirfd from kern_statat(),

Reviewed by: kib, mjg
Differential revision: https://reviews.freebsd.org/D35474

(cherry picked from commit cb858340dcbf214cc4c4d78dbb741620d7b3a252)

12 months agolinux(4): Make struct stat64 to match Linux actual one
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Make struct stat64 to match Linux actual one

(cherry picked from commit 80d8a4a0030849229cb9ebd434682ef927bc9963)

12 months agolinux(4): Regen for mknod syscall changes
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Regen for mknod syscall changes

(cherry picked from commit cd0fca82bb86e9287d7eacefead1b02766986762)

12 months agolinux(4): Use Linux dev_t type for mknod syscalls dev argument
Dmitry Chagin [Fri, 28 Apr 2023 08:55:02 +0000 (11:55 +0300)]
linux(4): Use Linux dev_t type for mknod syscalls dev argument

As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Prior the 2.6 kernel dev_t type was an unsigned short.
However, since the firs commit of the Linuxulator, mknod syscall get int dev
argument.
Also, there is some confusion here, while the kernel declares a dev_t type
as a 32-bit sized, the user-space dev_t type can be size of 64 bits, e.g.,
in the Glibc library.
To avoid confusion and to help porting of the Linuxulator to other platforms
use explicit l_dev_t for dev argument of mknod syscalls.

(cherry picked from commit ca3333dd4a3bef7b615d5df104c525f8cac51b26)

12 months agolinux(4): Move dev_t type declaration under /compat/linux
Dmitry Chagin [Fri, 28 Apr 2023 08:55:02 +0000 (11:55 +0300)]
linux(4): Move dev_t type declaration under /compat/linux

As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Move it into the MI linux.h under /compat/linux.

(cherry picked from commit 19973638bee2205be2a7eb07bc154b8afb1e44a3)

12 months agolinux(4): Make struct newstat to match actual Linux one
Dmitry Chagin [Fri, 28 Apr 2023 08:55:01 +0000 (11:55 +0300)]
linux(4): Make struct newstat to match actual Linux one

In the struct stat the st_dev, st_rdev are unsigned long.

(cherry picked from commit e0bfe0d62ca708c8c6173296cc05f6bbfb79b2ee)

12 months agolinux(4): Regen for struct l_old_stat changes
Dmitry Chagin [Fri, 28 Apr 2023 08:55:01 +0000 (11:55 +0300)]
linux(4): Regen for struct l_old_stat changes

(cherry picked from commit 023e6884967d0cb0b330eb15264d159619b0533b)

12 months agolinux(4): Update syscalls.master to reflect struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Update syscalls.master to reflect struct l_old_stat

(cherry picked from commit 2370c7321fd392cfd23059760a816e852c921cde)

12 months agolinux(4): Mark old fstat syscal as unimplemented
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Mark old fstat syscal as unimplemented

It looks like the old fstat system call never been implemented.

(cherry picked from commit 391fd1e1a1e8d360d4ebaceecf1ab7c46063b257)

12 months agolinux(4): Rename obsolete old struct l_stat to struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Rename obsolete old struct l_stat to struct l_old_stat

(cherry picked from commit a408fc097f43b80fd1477196e595edc796804520)

12 months agolinux(4): Move statx_copyout() close to linux_statx()
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Move statx_copyout() close to linux_statx()

Just for future changes of the conditional Linuxulator build. We need
a small refactoring of the MI code to help porting Linuxulator to other
platforms.

(cherry picked from commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6)

12 months agolinux(4): Move translate_vnhook_major_minor() into the Linux common module
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Move translate_vnhook_major_minor() into the Linux common module

(cherry picked from commit 6072eea0c375fc3ab0cf5bb494c75d1beac7b8ba)

12 months agolinux(4): Sort includes in the linux_stats.c
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Sort includes in the linux_stats.c

(cherry picked from commit 2a38f51c5b8a7cf38f0a29a59e7558d8aef91047)

12 months agolinux(4): Use inlined LINUX_KERNVER for tests to improve readability
Dmitry Chagin [Wed, 26 Apr 2023 13:57:30 +0000 (16:57 +0300)]
linux(4): Use inlined LINUX_KERNVER for tests to improve readability

MFC after: 1 month

(cherry picked from commit e185d83fc48ba0f28896a986104c02203005b533)

12 months agolinux(4): Don't relie on process osreldata when testing features
Dmitry Chagin [Wed, 26 Apr 2023 13:56:41 +0000 (16:56 +0300)]
linux(4): Don't relie on process osreldata when testing features

The ELF note identifyies the operating-system ABI that the executable
was created for. The note data of the Glibc executable contains the
earliest release number of the Linux kernel that supports this ABI.
As of a current 2.37 version of Glibc, it is 3.2.0 for x86, 3.7.0
for Aarch64.
Glibc does not use this release number and the current kernel's
LINUX_VERSION_CODE to detect kernel features, using fallbacks to known
previous way in case of ENOSYS or something else instead.

A dynamically linked Glibc reads the current kernel's LINUX_VERSION_CODE
from the ELF note in the vDSO or fallback to uname syscall if the vDSO
can't be located and parse the release field in struct utsname. Glibc
uses the current kernel's LINUX_VERSION_CODE for "kernel too old" check.

While here use inlined LINUX_KERNVER for tests to improve readability,
as suggested by emaste@.

MFC after: 1 month

(cherry picked from commit 76f8584e49cf7eedaa2e1312593bf46c7225d79a)

12 months agolinux(4): Fix arm64 build after b7a6bcdd, missed chunk added
Dmitry Chagin [Sat, 22 Apr 2023 22:41:12 +0000 (01:41 +0300)]
linux(4): Fix arm64 build after b7a6bcdd, missed chunk added

MFC after: 1 month

(cherry picked from commit 66e8f1f7d37b5f657086437f5411a63c9080e25c)

12 months agolinux(4): Bump osrelease to 5.15.0
Dmitry Chagin [Sat, 22 Apr 2023 19:18:08 +0000 (22:18 +0300)]
linux(4): Bump osrelease to 5.15.0

Linux kernel version 5.15 named Trick or Treat is a 22nd LTS release.

Reviewed by: trasz, emaste
Differential Revision: https://reviews.freebsd.org/D39649
MFC after: 1 month

(cherry picked from commit 0ef30b5d6b75596e087a86c3cb01a0b2c611e7e6)

12 months agolinux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:52 +0000 (22:17 +0300)]
linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata

AT_MINSIGSTKSZ has appeared in the 5.13.0 Linux kernel first time.

Differential Revision: https://reviews.freebsd.org/D39648
MFC after: 1 month

(cherry picked from commit b7a6bcdd1319b4e5da0bfc5e7790cbf26efe9892)

12 months agolinux(4): Export the AT_EXECFN depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:36 +0000 (22:17 +0300)]
linux(4): Export the AT_EXECFN depending on the process osreldata

AT_EXECFN has appeared in the 2.6.26 Linux kernel first time.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39647
MFC after: 1 month

(cherry picked from commit 70eab81d6ffecf0ba4c7f19a8b6389178eda5259)

12 months agolinux(4): Export the AT_RANDOM depending on the process osreldata
Dmitry Chagin [Sat, 22 Apr 2023 19:17:17 +0000 (22:17 +0300)]
linux(4): Export the AT_RANDOM depending on the process osreldata

AT_RANDOM has appeared in the 2.6.30 Linux kernel first time.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39646
MFC after: 1 month

(cherry picked from commit 40c36c4674eb9602709cf9d0483a4f34ad9753f6)

12 months agolinux(4): Fix LINUX_AT_COUNT comments
Dmitry Chagin [Sat, 22 Apr 2023 19:16:43 +0000 (22:16 +0300)]
linux(4): Fix LINUX_AT_COUNT comments

Differential Revision: https://reviews.freebsd.org/D39645
MFC after: 1 month

(cherry picked from commit 56c5230afdcf2b317d904009abe577e91b382542)

12 months agolinux(4): Deduplicate linux_copyout_auxargs()
Dmitry Chagin [Sat, 22 Apr 2023 19:16:02 +0000 (22:16 +0300)]
linux(4): Deduplicate linux_copyout_auxargs()

Export default MINSIGSTKSZ value for the x86 until we do not preserve AVX
registers in the signal context.

Differential Revision: https://reviews.freebsd.org/D39644
MFC after: 1 month

(cherry picked from commit 7d8c98398302b939b97310d31883ebdab8c0b938)

12 months agolinux(4): Regen for close_range syscall
Dmitry Chagin [Tue, 4 Apr 2023 20:23:37 +0000 (23:23 +0300)]
linux(4): Regen for close_range syscall

MFC after: 2 weeks

(cherry picked from commit 50111714f5a46add66264d48456c32b7d3d0036a)

12 months agolinux(4): Modify close_range syscall to match Linux
Dmitry Chagin [Tue, 4 Apr 2023 20:23:24 +0000 (23:23 +0300)]
linux(4): Modify close_range syscall to match Linux

MFC after: 2 weeks

(cherry picked from commit 1c27dce1f8979e7bbe3ca51f4f2db38b202042a0)

12 months agopseudofs: Simplify pfs_visible_proc
Dmitry Chagin [Sun, 2 Apr 2023 08:24:10 +0000 (11:24 +0300)]
pseudofs: Simplify pfs_visible_proc

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39383
MFC after: 1 month

(cherry picked from commit a32ed5ec05d9bc01b8e70b45ff510d2f972a0877)

12 months agopseudofs: Allow vis callback to be called for a named node
Dmitry Chagin [Sun, 2 Apr 2023 08:21:15 +0000 (11:21 +0300)]
pseudofs: Allow vis callback to be called for a named node

This will be used later in the linsysfs module to filter out VNETs.

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39382
MFC after: 1 month

(cherry picked from commit 405c0c04edb6143405426da6a5273f4c5998d594)

12 months agopseudofs: Microoptimize struct pfs_node
Dmitry Chagin [Sun, 2 Apr 2023 08:20:07 +0000 (11:20 +0300)]
pseudofs: Microoptimize struct pfs_node

Since 81167243b the size of struct pfs_node is 280 bytes, so the kernel
memory allocator takes memory from 384 bytes sized bucket. However, the
length of the node name is mostly short, e.g., for Linux emulation layer
it is up to 16 bytes. The size of struct pfs_node w/o pfs_name is 152
bytes, i.e., we have 104 bytes left to fit the node name into the 256
bytes-sized bucket.

Reviewed by: des
Differential revision: https://reviews.freebsd.org/D39381
MFC after: 1 month

(cherry picked from commit 7f72324346ea154a92671fc913dbe82c0287501a)

12 months agolinsysfs(4): Keep Linux compatible sysfs the same as Ubuntu
Vico Chen [Sat, 25 Mar 2023 10:41:04 +0000 (13:41 +0300)]
linsysfs(4): Keep Linux compatible sysfs the same as Ubuntu

By checking Ubuntu, there is no `/sys/subsystem' in sysfs. To compatible
with Ubuntu, delete the 'subsystem' creation in Linux compatible module.

On the other hand, the sysfs `/sys/subsystem' cause failure for some
Linux udev cases. In Linux udev source code, there is a function named
`scan_devices_all', and it will scan `/sys/subsystem' if it is existed,
but now there are nothing in /sys/subsystem `, and it returns empty
to cause some use cases failed.

Reviewed by: dchagin
Differential Revision: https://reviews.freebsd.org/D38885
MFC after: 1 month
XMFC with: ifAPI

(cherry picked from commit 1f0c8bfd650422a30aa6fcf01da860b8d43628a8)

12 months agoApply llvm fix for hanging gcc builds on 32-bit arm
Dimitry Andric [Mon, 19 Jun 2023 18:32:40 +0000 (20:32 +0200)]
Apply llvm fix for hanging gcc builds on 32-bit arm

Merge commit 962c306a11d0 from llvm-project (by Florian Hahn):

  [LV] Don't consider pointer as uniform if it is also stored.

  Update isVectorizedMemAccessUse to also check if the pointer is stored.
  This prevents LV to incorrectly consider a pointer as uniform if it is
  used as both pointer and stored by the same StoreInst.

  Fixes #61396.

PR: 271992
Reported by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

(cherry picked from commit dbbaf77801a8f30e49731395e85757f339f345bf)

12 months agonetinet: re-read IP length after PFIL hook
Kristof Provost [Fri, 2 Jun 2023 14:38:30 +0000 (16:38 +0200)]
netinet: re-read IP length after PFIL hook

The pfil hook may modify the packet, so before we check its length (to
decide if it needs to be fragmented or not) we should re-read that
length.

This is most likely to happen when pf is reassembling packets. In that
scenario we'd receive the last fragment, which is likely to be a short
packet, pf would reassemble it (likely exceeding the interface MTU) and
then we'd transmit it without fragmenting, because we're comparing the
MTU to the length of the last fragment, not the fully reassembled
packet.

See also: https://redmine.pfsense.org/issues/14396
Reviewed by: cy
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40395

(cherry picked from commit 185c1cddd7ef34db82bc3a25b3c92556416a4e55)

12 months agopcib: Allocate the memory BAR with the MSI-X table.
John Baldwin [Mon, 19 Jun 2023 16:15:48 +0000 (09:15 -0700)]
pcib: Allocate the memory BAR with the MSI-X table.

This is required for pci_alloc_msix() to work and to thus use
MSI-X interrupts for PCI-e hotplug.

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

(cherry picked from commit e6b838363fb473b5e35a8ae6a1da5e15f5b52960)