]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agonet80211: reject mixed plaintext/encrypted fragments
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:41 +0000 (22:10 +0000)]
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

(cherry picked from commit 11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55)

2 years agoLinuxKPI: implement dma_set_coherent_mask()
Bjoern A. Zeeb [Mon, 27 Sep 2021 22:50:07 +0000 (22:50 +0000)]
LinuxKPI: implement dma_set_coherent_mask()

Coherent is lower 32bit only by default in Linux and our only default
dma mask is 64bit currently which violates expectations unless
dma_set_coherent_mask() was called explicitly with a different mask.

Implement coherent by creating a second tag, and storing the tags in the
objects and use the tag from the object wherever possible.
This currently does not update the scatterlist or pool (both could be
converted but S/G cannot be MFCed as easily).

There is a 2nd change embedded in the updated logic of
linux_dma_alloc_coherent() to always zero the allocation as
otherwise some drivers get cranky on uninialised garbage.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c39eefe715b3c835ce3d91a1c1932197c23c1f3c)
(cherry picked from commit 1269873159c7fa0db3b9dbf8dadc54eec5dc0d58)

2 years agoLinuxKPI: dma-mapping.h unify "mask" and "dma_mask"
Bjoern A. Zeeb [Mon, 27 Sep 2021 20:48:02 +0000 (20:48 +0000)]
LinuxKPI: dma-mapping.h unify "mask" and "dma_mask"

In some places we are using "mask" and others "dma_mask" for the
same thing.  Harmonize the various places to "dma_mask" as used in
linux_pci.c.  For the declaration remove the argument names to
avoid the entire problem.

This is in preparation for an upcoming change.
No functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 72c89ce97ba3f023463930578c6df7f0374cbf17)

2 years agoLinuxKPI: disable device_release_driver()
Bjoern A. Zeeb [Mon, 27 Sep 2021 17:38:41 +0000 (17:38 +0000)]
LinuxKPI: disable device_release_driver()

As reported by multiple people testing iwlwifi, device_release_driver()
can lead to a panic on secondary errors (usually during attach).
Disable device_release_driver() for the short-term to prevent the panic
but leave it in place so it can be re-worked and fixed properly for
the long-term more easily.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 93b14194acaf2c2d80df9c4900a90c6644dcd92b)

2 years agonet80211: add func/line information to IEEE80211_DISCARD* macros
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:24:51 +0000 (09:24 +0000)]
net80211: add func/line information to IEEE80211_DISCARD* macros

While debugging is very good in net80211, some log messages are
repeated in multiple places 1:1.  In order to distinguish where the
discard happened and to speed up analysis, add __func__:__LINE__
information to all these messages.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit cb5c07649aa005abb1e847c2cd5f816d762efb93)

2 years agonet80211: comments and whitespace
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:16:25 +0000 (09:16 +0000)]
net80211: comments and whitespace

Add a missing '.', fix spelling of "failed" and unwrap a closing );
No functional changes.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 49c220b021d5855652ecb2803c969dfa47bdd306)

2 years agoLinuxKPI: add fsleep()
Bjoern A. Zeeb [Tue, 27 Jul 2021 15:22:02 +0000 (15:22 +0000)]
LinuxKPI: add fsleep()

Add fsleep() function now required by rtw88.  This seems to be
making a decision depending on time to sleep on how to sleep.
Given our compat framework already is lenient on how long to sleep,
this is a cut down version.

(cherry picked from commit cc2723370b482b923b2adeac3ad359d485f0bd82)

2 years agoLinuxKPI: add read_poll_timeout()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:29:49 +0000 (13:29 +0000)]
LinuxKPI: add read_poll_timeout()

Add an implementation of read_poll_timeout() and the atomic variant
which I did at some point last year for rtw88 and now updated based
on feedback.

(cherry picked from commit fed248a6acb33cf6d51880be8d5c774d89e75110)

2 years agoLinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:33:01 +0000 (13:33 +0000)]
LinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors()

Add the two new functions needed by rtw88 to register the driver and
handle the module bits as well as a version of pci_alloc_irq_vectors()
for what is needed.

(cherry picked from commit 366d68f283793df22392f9fb992c5029dfc293bb)

2 years agoLinuxKPI: add sign_extend32()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:14:19 +0000 (13:14 +0000)]
LinuxKPI: add sign_extend32()

Add sign_extend32() replicating the 64 version.  This is needed by
the rtw88 driver.

(cherry picked from commit ea4dea83944ac6334d31e0364dd674eda250adde)

2 years agoLinuxKPI: fix bug in le32p_replace_bits()
Bjoern A. Zeeb [Thu, 29 Jul 2021 21:27:21 +0000 (21:27 +0000)]
LinuxKPI: fix bug in le32p_replace_bits()

Fix a bug that slipped in in 90707c4e44de03ea36be183ef2226601c66169cb
using the correct field in le32p_replace_bits().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 22e20d852ff400a486da24e5d1d92c841a3e39d9)

2 years agoLinuxKPI: bitfield.h cleanup
Bjoern A. Zeeb [Thu, 29 Jul 2021 21:24:35 +0000 (21:24 +0000)]
LinuxKPI: bitfield.h cleanup

Add a missing tab and remove an unnecessary return.
No functional changes.

(cherry picked from commit 4c8af633d10104c793673ee1f6e7b96f113cce5a)

2 years agoLinuxKPI: dmi.h do not rely on implicit includes
Bjoern A. Zeeb [Wed, 28 Jul 2021 13:28:48 +0000 (13:28 +0000)]
LinuxKPI: dmi.h do not rely on implicit includes

Add sys/types.h to dmi.h and do not rely on other files to include
all needed headers in Linux land.  I ran into compile problems with
rtw88 otherwise.

(cherry picked from commit ac134e762e6908dcadd0c7cb7bcb3de0ed967f59)

2 years agoLinuxKPI: add nexthdr definitions for IPv6
Bjoern A. Zeeb [Tue, 27 Jul 2021 13:39:15 +0000 (13:39 +0000)]
LinuxKPI: add nexthdr definitions for IPv6

Add the nexthdr definitions for IPv6 which are used by wireless
drivers and were previously placed in an 80211 header file by
accident.

Obtained from: bz_iwlwifi
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b9d984e2c5dcef277c49a576ccefada6519d9b53)

2 years agobsdinstall: Fix mirror selection
Mateusz Piotrowski [Wed, 10 Nov 2021 15:39:09 +0000 (16:39 +0100)]
bsdinstall: Fix mirror selection

This is a follow-up to 2697622687708bffd4c3dcfc44f0c977a78e506d,
which fixed 2 out of 3 broken uses of the mirrorselect script.

Reviewed by: emaste
Approved by: emaste (src)
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D32927

(cherry picked from commit 4042b356a00e12d6888a4e15e2373453804c5121)

2 years agostart_init: use 'p'
Konstantin Belousov [Sun, 14 Nov 2021 20:47:59 +0000 (22:47 +0200)]
start_init: use 'p'

(cherry picked from commit 8660813153d02e9e681ae083edc7f1d574cb62ca)

2 years agokasan: Disable validation of function parameters passed by value
Mark Johnston [Wed, 3 Nov 2021 16:28:48 +0000 (12:28 -0400)]
kasan: Disable validation of function parameters passed by value

It appears that the emitted code in the caller does not update shadow
state for values passed on the stack to the callee, which it seemingly
ought to do after pushing values on the stack and prior to the call
itself.  This leaves open a window where an interrupt handler can cause
regions of the stack containing these values to be poisoned, resulting
in rare false positive reports.  This happens particularly in the amd64
TLB invalidation code, where we liberally pass cpuset_t's around by
value.

LLVM has a flag to disable validation of accesses of function parameters
passed by value.  Such validation is itself a relatively new feature.
Turn it off for now.

Reported by: pho, syzkaller
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2a519c3b14c29688e42d11f916655318b13c8409)

2 years agonfscl: Fix forced dismount when "nconnect" is specified
Rick Macklem [Wed, 3 Nov 2021 20:26:38 +0000 (13:26 -0700)]
nfscl: Fix forced dismount when "nconnect" is specified

When a forced dismount is done and the "nconnect" mount
option was used, the additional connections must be closed.
This patch does that.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit ae49051c033a2468af2f1f0079ecaf069b993245)

2 years agonfscl: Fix forced dismount from looping on commit
Rick Macklem [Wed, 3 Nov 2021 21:25:44 +0000 (14:25 -0700)]
nfscl: Fix forced dismount from looping on commit

When a forced dismount is in progress, it is possible to
end up looping, retrying commits that fail.
This patch fixes the problem by pretending
that commits succeeded when a forced dismount is in prgress.

(cherry picked from commit 6b67753488cb506f05694c5f6d2e74cf53497c54)

2 years agonfscl: Fix use after free for forced dismount
Rick Macklem [Wed, 3 Nov 2021 19:15:40 +0000 (12:15 -0700)]
nfscl: Fix use after free for forced dismount

When a forced dismount is done and delegations are being
issued by the server (disabled by default for FreeBSD
servers), the delegation structure is free'd before the
loop calling vflush().  This could result in a use after
free of the delegation structure.

This patch changes the code so that the delegation
structures are not free'd until after the vflush()
loop for forced dismounts.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 441222585968517c595ef7f39e5c71a42d238acd)

2 years agonfscl: Check for a forced dismount in nfscl_getref()
Rick Macklem [Wed, 3 Nov 2021 00:28:13 +0000 (17:28 -0700)]
nfscl: Check for a forced dismount in nfscl_getref()

The nfscl_getref() function is called within nfscl_doiods() when
the NFSv4.1/4.2 pNFS client is doing I/O on a DS.  As such,
nfscl_getref() needs to check for a forced dismount.
This patch adds that check.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 331883a2f2e9ae5567085e4cd3a7ae3db2a2b022)

2 years agonfscl: Use a smaller initial delay time for NFSERR_DELAY
Rick Macklem [Tue, 2 Nov 2021 00:21:31 +0000 (17:21 -0700)]
nfscl: Use a smaller initial delay time for NFSERR_DELAY

For NFS RPCs that receive a NFSERR_DELAY reply, the delay time
is initially 1sec and then increases exponentially to NFS_TRYLATERDEL.
It was found that this delay time is excessive for some NFSv4
servers, which work well with a 1msec delay.
A 1sec delay resulted in very slow performance for Remove and
Rename when delegations and pNFS were enabled.

This patch decreases the initial delay time to 1msec.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7)

2 years agosnd_uaudio(4): Fix string index computations for iFeature.
Hans Petter Selasky [Tue, 9 Nov 2021 21:07:36 +0000 (22:07 +0100)]
snd_uaudio(4): Fix string index computations for iFeature.

This allows the iFeature strings to be properly read by the snd_uaudio(4) driver,
when parsing the audio feature unit descriptors.

Submitted by: Zhichao1.Li@dell.com
Sponsored by: NVIDIA Networking

(cherry picked from commit 11f09b17fe2cf0b5489601aee548a06486f0b749)

2 years agoamd64/ia32/ia32_signal.c: Use ANSI C functions definitions
Konstantin Belousov [Fri, 12 Nov 2021 17:11:22 +0000 (19:11 +0200)]
amd64/ia32/ia32_signal.c: Use ANSI C functions definitions

(cherry picked from commit c5658876b416c1f8206bd8d269af85239e8467aa)

2 years agobhyve: Fix the WITH_BHYVE_SNAPSHOT build
Mark Johnston [Sat, 16 Oct 2021 17:13:26 +0000 (13:13 -0400)]
bhyve: Fix the WITH_BHYVE_SNAPSHOT build

Note, this breaks compatibility with snapshots generated by older builds
of bhyve(8).

Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: grehan, bz
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 77bc75c7abd29de69d3ef35b66c23c7baba95094)

2 years agobhyve: Map the MSI-X table unconditionally for passthrough
Mark Johnston [Sat, 9 Oct 2021 15:36:19 +0000 (11:36 -0400)]
bhyve: Map the MSI-X table unconditionally for passthrough

It is possible for the PBA to reside in the same page as the MSI-X
table.  And, while devices are not supposed to do this, at least some
Intel wifi devices place registers in a page shared with the MSI-X
table.  To handle the first case we currently map the PBA page using
/dev/mem, and the second case is not handled.

Kill two birds with one stone: map the MSI-X table BAR using the
PCIOCBARMMAP ioctl instead of /dev/mem, and map the entire table so that
accesses beyond the bounds of the table can be emulated.  Regions of the
BAR not containing the table are left unmapped.

PR: 251046
Reviewed by: bz, grehan, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7fa2335347362378322a4d27cb40f6e6cd5dd0fb)

2 years agopci: Implement pci_bar_enabled() for SR-IOV VFs
Mark Johnston [Tue, 9 Nov 2021 18:07:57 +0000 (13:07 -0500)]
pci: Implement pci_bar_enabled() for SR-IOV VFs

In a VF's configuration space, "memory space enable" is hard-wired to 0,
so the existing implementation always returns false.  We need to read
the SR-IOV control register from the PF device to get the value of the
MSE bit.

Fix pci_bar_enabled() to read this register instead for VFs.  I don't
see any way to access the PF's config space without a backpointer in the
pci device ivars, so I added one.

This fixes a regression where bhyve(8) fails to map the MSI-X table
after commit 7fa233534736 ("bhyve: Map the MSI-X table unconditionally
for passthrough") when a VF is passed through, since with that commit we
use PCIOCBARMMAP to map the table and that ioctl always fails for VFs
without this change.  As a bonus, pciconf(8) now correctly reports the
enablement of BARs for VFs.

Reported and tested by: Raúl Muñoz <raul.munoz@custos.es>
Reviewed by: rstone, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1f960e646b7280795766fdaa183e3b9bd4cea345)

2 years agohwpmc: initialize arm64 counter/interrupt state
Mitchell Horne [Mon, 8 Nov 2021 19:33:25 +0000 (15:33 -0400)]
hwpmc: initialize arm64 counter/interrupt state

Performance counters and overflow interrupts are assumed to be disabled
by default, but this is not guaranteed. Ensure we disable both during
per-cpu initialization, before enabling the PMU. Otherwise, some systems
(such as the Ampere eMAG) would experience an interrupt storm upon
loading the hwpmc module.

Reviewed by: br
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32854

(cherry picked from commit b826cc3caf6abc6a5d1926bd478b464938d45697)

2 years agouma: Fix handling of reserves in zone_import()
Mark Johnston [Mon, 1 Nov 2021 13:27:52 +0000 (09:27 -0400)]
uma: Fix handling of reserves in zone_import()

Kegs with no items reserved have uk_reserve = 0.  So the check
keg->uk_reserve >= dom->ud_free_items will be true once all slabs are
depleted.  Then, rather than go and allocate a fresh slab, we return to
the cache layer.

The intent was to do this only when the keg actually has a reserve, so
modify the check to verify this first.  Another approach would be to
make uk_reserve signed and set it to -1 until uma_zone_reserve() is
called, but this requires a few casts elsewhere.

Fixes: 1b2dcc8c54a8 ("uma: Avoid depleting keg reserves when filling a bucket")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7585c5db25b700d19baebd7afd7a1b2e03c29cda)

2 years agouma: Improve M_USE_RESERVE handling in keg_fetch_slab()
Mark Johnston [Mon, 1 Nov 2021 13:27:35 +0000 (09:27 -0400)]
uma: Improve M_USE_RESERVE handling in keg_fetch_slab()

M_USE_RESERVE is used in a couple of places in the VM to avoid unbounded
recursion when the direct map is not available, as is the case on 32-bit
platforms or when certain kernel sanitizers (KASAN and KMSAN) are
enabled.  For example, to allocate KVA, the kernel might allocate a
kernel map entry, which might require a new slab, which requires KVA.

For these zones, we use uma_prealloc() to populate a reserve of items,
and then in certain serialized contexts M_USE_RESERVE can be used to
guarantee a successful allocation.  uma_prealloc() allocates the
requested number of items, distributing them evenly among NUMA domains.
Thus, in a first-touch zone, to satisfy an M_USE_RESERVE allocation we
might have to check the slab lists of other domains than the current one
to provide the semantics expected by consumers.

So, try harder to find an item if M_USE_RESERVE is specified and the keg
doesn't have anything for current (first-touch) domain.  Specifically,
fall back to a round-robin slab allocation.  This change fixes boot-time
panics on NUMA systems with KASAN or KMSAN enabled.[1]

Alternately we could have uma_prealloc() allocate the requested number
of items for each domain, but for some existing consumers this would be
quite wasteful.  In general I think keg_fetch_slab() should try harder
to find free slabs in other domains before trying to allocate fresh
ones, but let's limit this to M_USE_RESERVE for now.

Also fix a separate problem that I noticed: in a non-round-robin slab
allocation with M_WAITOK, rather than sleeping after a failed slab
allocation we simply try again.  Call vm_wait_domain() before retrying.

Reported by: mjg, tuexen [1]
Reviewed by: alc
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fab343a7168a2f033073bb5f65b5af17d9092c6f)

2 years agomodule(9): Document that evhand can be NULL
Felix Johnson [Thu, 11 Nov 2021 06:28:45 +0000 (01:28 -0500)]
module(9): Document that evhand can be NULL

PR: 192250
Reported by: ngie

(cherry picked from commit c5e0492ae81e4b0d7946ccfbedb434a9c4071256)

2 years agonfscl: Use NFSMNTP_DELEGISSUED in two more functions
Rick Macklem [Sat, 30 Oct 2021 03:35:02 +0000 (20:35 -0700)]
nfscl: Use NFSMNTP_DELEGISSUED in two more functions

Commit 5e5ca4c8fc53 added a NFSMNTP_DELEGISSUED flag to indicate when
a delegation has been issued to the mount.  For the common case
where an NFSv4 server is not issuing delegations, this flag
can be checked to avoid acquisition of the NFSCLSTATEMUTEX.

This patch adds checks for NFSMNTP_DELEGISSUED being set
to two more functions.

This change appears to be performance neutral for a small number
of opens, but should reduce lock contention for a large number of opens
for the common case where server is not issuing delegations.

(cherry picked from commit dc6dd769de63c4eceb8899205a5d780d9f278fd2)

2 years agonfscl: Fix race between Lookup and Setattr of size
Rick Macklem [Sat, 30 Oct 2021 23:35:02 +0000 (16:35 -0700)]
nfscl: Fix race between Lookup and Setattr of size

PR#259071 provides a test program that fails for the NFS client.
Testing with it, there appears to be a race between Lookup
and VOPs like Setattr-of-size, where Lookup ends up loading
stale attributes (including what might be the wrong file size)
into the NFS vnode's attribute cache.

The race occurs when the modifying VOP (which holds a lock
on the vnode), blocks the acquisition of the vnode in Lookup,
after the RPC (with now potentially stale attributes).

Here's what seems to happen:
Child                                Parent

does stat(), which does
VOP_LOOKUP(), doing the Lookup
RPC with the directory vnode
locked, acquiring file attributes
valid at this point in time

blocks waiting for locked file       does ftruncate(), which
vnode                                does VOP_SETATTR() of Size,
                                     changing the file's size
                                     while holding an exclusive
                                     lock on the file's vnode
                                     releases the vnode lock
acquires file vnode and fills in
now stale attributes including
the old wrong Size
                                     does a read() which returns
                                     wrong data size

This patch fixes the problem by saving a timestamp in the NFS vnode
in the VOPs that modify the file (Setattr-of-size, Allocate).
Then lookup/readdirplus compares that timestamp with the time just
before starting the RPC after it has acquired the file's vnode.
If the modifying RPC occurred during the Lookup, the attributes
in the RPC reply are discarded, since they might be stale.

With this patch the test program works as expected.

Note that the test program does not fail on a July stable/12,
although this race is in the NFS client code.  I suspect a
fairly recent change to the name caching code exposed this
bug.

PR: 259071

(cherry picked from commit 2be417843a04f25e631e99d5188eb2652b13d80d)

2 years agonfscl: Add setting n_localmodtime to the Write RPC code
Rick Macklem [Sun, 31 Oct 2021 00:08:28 +0000 (17:08 -0700)]
nfscl: Add setting n_localmodtime to the Write RPC code

Similar to commit 2be417843a, I believe there could be a race between
the NFS client VOP_LOOKUP() and file Writing that could result in stale
file attributes being loaded into the NFS vnode by VOP_LOOKUP().

I have not been able to reproduce a failure due to this race, but
I believe that there are two possibilities:

The Lookup RPC happens while VOP_WRITE() is being executed and loads
stale file attributes after VOP_WRITE() returns when it has already
completed the Write/Commit RPC(s).
--> For this case, setting the local modify timestamp at the end of
  VOP_WRITE() should ensure that stale file attributes are not loaded.

The Lookup RPC occurs after VOP_WRITE() has returned, while
asynchronous Write/Commit RPCs are in progress and then is
blocked by the vnode held by VOP_OPEN/VOP_CLOSE/VOP_FSYNC which
will flush writes via ncl_flush() or ncl_vinvalbuf(), clearing the
NMODIFIED flag (which indicates Writes-in-progress). The VOP_LOOKUP()
then acquires the NFS vnode lock and fills in stale file attributes.
 --> Setting the local modify timestamp in ncl_flsuh() and ncl_vinvalbuf()
   when they clear NMODIFIED should ensure that stale file attributes
   are not loaded.

This patch does the above.

PR: 259071

(cherry picked from commit 50dcff0816e5e4aa94f51ce27da5121e49902996)

2 years agonfscl: Do pNFS layout return_on_close synchronously
Rick Macklem [Sun, 31 Oct 2021 23:31:31 +0000 (16:31 -0700)]
nfscl: Do pNFS layout return_on_close synchronously

For pNFS servers that specify that Layouts are to be returned
upon close, they may expect that LayoutReturn to happen before
the associated Close.

This patch modifies the NFSv4.1/4.2 pNFS client so that this
is done.  This only affects a pNFS mount against a non-FreeBSD
NFSv4.1/4.2 server that specifies return_on_close in LayoutGet
replies.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit d5d2ce1c8550a41e7374893ccd864c172461221f)

2 years agopf tests: test NAT-ed ICMP errors
Kristof Provost [Tue, 19 Oct 2021 11:52:21 +0000 (13:52 +0200)]
pf tests: test NAT-ed ICMP errors

Ensure that the ICMP error is returned with the correct
source and destination addresses.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32572

(cherry picked from commit 30276ef12cbb47cdd302741096262041be30ec11)

2 years agopf: ensure we have the correct source/destination IP address in ICMP errors
Luiz Otavio O Souza [Tue, 19 Oct 2021 11:37:54 +0000 (13:37 +0200)]
pf: ensure we have the correct source/destination IP address in ICMP errors

When we route-to a packet that later turns out to not fit in the
outbound interface MTU we generate an ICMP error.
However, if we've already changed those (i.e. we've passed through a NAT
rule) we have to undo the transformation first.

Obtained from: pfSense
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32571

(cherry picked from commit ab238f14544b2415561c4fed674ee360aa8b5860)

2 years agoRevert "files.arm64: fix sort order for aw_i2s.c"
Andriy Gapon [Sat, 13 Nov 2021 09:15:11 +0000 (11:15 +0200)]
Revert "files.arm64: fix sort order for aw_i2s.c"

This reverts commit 25fb4fb2518f53b9c986367932d7fa6b7b6697ec.

This MFC was done prematurely as aw_i2s is not stable/13 yet.

Strangely, git cherry-pick did not complain when applying the diff,
although the line to be removed was not in the patched file.

2 years agofiles.arm64: fix sort order for aw_i2s.c
Andriy Gapon [Fri, 24 Sep 2021 17:26:07 +0000 (20:26 +0300)]
files.arm64: fix sort order for aw_i2s.c

(cherry picked from commit 24f567bb0e5060adb21bed24b00effec4f37f034)

2 years agogpioled: allow the driver to be disabled via fdt
Andriy Gapon [Fri, 25 Sep 2020 07:32:47 +0000 (10:32 +0300)]
gpioled: allow the driver to be disabled via fdt

(cherry picked from commit 832503063e32a449f8ed6ecf865d01e575559971)

2 years agodriver for MAX44009 I2C illuminance sensor
Andriy Gapon [Thu, 20 Aug 2020 08:11:31 +0000 (11:11 +0300)]
driver for MAX44009 I2C illuminance sensor

(cherry picked from commit ff6fe2983550aeab0852e982e7fe5ac4c672c205)

2 years agopcf8591: driver for adc/dac with i2c interface
Andriy Gapon [Mon, 17 Aug 2020 10:05:11 +0000 (13:05 +0300)]
pcf8591: driver for adc/dac with i2c interface

(cherry picked from commit a60b30469741392e66ec6fd21a8d5c4810a2d407)

2 years agohtu21: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:56:12 +0000 (13:56 +0200)]
htu21: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit a75159eabc90dc35af68c92f7d5eb72e087f6131)

2 years agohtu21: don't needlessly bother hardware when measurements are not needed
Andriy Gapon [Sat, 6 Nov 2021 16:47:32 +0000 (18:47 +0200)]
htu21: don't needlessly bother hardware when measurements are not needed

sysctl(8) first queries a sysctl to get a size of its value even if the
sysctl is of a fixed size, e.g. it has an integer type.
Only after that sysctl(8) queries an actual value of the sysctl.

Previosuly the driver would needlessly read a sensor in the first step.

(cherry picked from commit 43b031a371eb90c15c390c26202f5f58d09300ef)

2 years agosockstat(1): Update Synopsis section
Felix Johnson [Wed, 10 Nov 2021 20:22:06 +0000 (15:22 -0500)]
sockstat(1): Update Synopsis section

Update sockstat(1) manpage so the Synopsis section includes q (silent
mode) and the -j argument name is consistent.

PR: 256795
Reported by: Nick Reilly <nreilly@blackberry.com>

(cherry picked from commit 5504d8394289853e8c065e88a83fb464cb50d934)

2 years agoAdd some of Intel Alder Lake device IDs.
Alexander Motin [Sat, 6 Nov 2021 03:05:15 +0000 (23:05 -0400)]
Add some of Intel Alder Lake device IDs.

MFC after: 1 week

(cherry picked from commit dc238358f9f48ee4c983e2131656edb15636ab9e)

2 years agoigc: Use hardware routine for PHY reset
Peter Grehan [Mon, 1 Nov 2021 13:35:43 +0000 (23:35 +1000)]
igc: Use hardware routine for PHY reset

Summary:
The previously used software reset routine wasn't sufficient
to reset the PHY if the bootloader hadn't left the device in
an initialized state. This was seen with the onboard igc port
on an 11th-gen Intel NUC.

The software reset isn't used in the Linux driver so all related
code has been removed.

Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card,
and an 11th-gen Intel NUC.

Reported by: woodsb02
Tested by: woodsb02 (NUC)
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 561cd74b1704ab76a3286733fb43da53b6892ea4)

2 years agoigc: correctly update RCTL when changing multicast filters.
Peter Grehan [Mon, 11 Oct 2021 17:49:01 +0000 (03:49 +1000)]
igc: correctly update RCTL when changing multicast filters.

Fix clearing of bits in RCTL for the non-bpf/non-allmulti case.
Update RCTL after modifying the multicast filter registers as per
the Linux driver.

This fixes LACP on igc interfaces, where incoming LACP multicasti
control packets were being dropped.

Obtained from: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e)

2 years agoFactor out flags preserved during mbuf demote into a separate define.
Hans Petter Selasky [Thu, 4 Nov 2021 17:48:23 +0000 (18:48 +0100)]
Factor out flags preserved during mbuf demote into a separate define.

This define will later on be used by coming TLS RX hardware offload patches.

No functional change intended.

Reviewed by: jhb@
Sponsored by: NVIDIA Networking

(cherry picked from commit dd31400c3c2aa941d057e78296c193959a6d9ed3)

2 years agobeep(1): Initial version of utility to create terminal beep via soundcard.
Hans Petter Selasky [Tue, 26 Oct 2021 17:13:00 +0000 (19:13 +0200)]
beep(1): Initial version of utility to create terminal beep via soundcard.

Reviewed by: imp@, emaste@ and pstef@
Differential Revision: https://reviews.freebsd.org/D32672
Sponsored by: NVIDIA Networking

(cherry picked from commit 8abfbe5a79b19bb95430f574d970843607f5809c)

2 years agoLinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.
Hans Petter Selasky [Tue, 2 Nov 2021 15:52:46 +0000 (16:52 +0100)]
LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.

The purpose of this change is to reduce the amount of dmesg(8) noise when
VT switching after a panic.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D30174
Sponsored by: NVIDIA Networking

(cherry picked from commit 2390a1441effaba0e3d0f2f447f448aaf20428f1)

2 years agoip_divert: calculate delayed checksum for IPv6 adress family
Andrey V. Elsukov [Tue, 2 Nov 2021 16:59:06 +0000 (19:59 +0300)]
ip_divert: calculate delayed checksum for IPv6 adress family

Before passing an IPv6 packet to application apply delayed checksum
calculation. Mbuf flags will be lost when divert listener will return a
packet back, so we will not be able to do delayed checksum calculation
later. Also an application will get a packet with correct checksum.

Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D32807

(cherry picked from commit 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8)

2 years agoe1000: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:12:23 +0000 (14:12 +0100)]
e1000: Fix a typo in a source code comment

- s/overwritting/overwriting/

(cherry picked from commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62)

2 years agoefi(8): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:07:24 +0000 (14:07 +0100)]
efi(8): Fix a typo in a source code comment

- s/writting/writing/

(cherry picked from commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa)

2 years agousb_audio: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:04:26 +0000 (14:04 +0100)]
usb_audio: Fix a typo in a source code comment

- s/maxium/maximum/

(cherry picked from commit 3d6ed119e3fe123b7e18adf8672c45ab81068527)

2 years agofind(1): Update date format reference and remove cvs(1) references
Felix Johnson [Mon, 8 Nov 2021 06:14:58 +0000 (01:14 -0500)]
find(1): Update date format reference and remove cvs(1) references

cvs(1) is not installed by default. Change the date format reference to
note that find(1) understands ISO8601 and RFC822 date formats. Also
remove references to cvs(1).

PR: 254894
Reported by: danielsh@apache.org

(cherry picked from commit 52dbe1a0f419b8d45b4beed56b90ff48bc12e14c)

2 years agortld: style adjustments
Konstantin Belousov [Sat, 6 Nov 2021 03:20:39 +0000 (05:20 +0200)]
rtld: style adjustments

(cherry picked from commit 74aec9618fd709513ef2d319598dd82801c29726)

2 years agortld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag
Konstantin Belousov [Sat, 6 Nov 2021 03:06:34 +0000 (05:06 +0200)]
rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag

(cherry picked from commit c5637b8be8a5b6aaf663a58b0027f7f924d78b04)

2 years agoImplementations of cexpl()
Steve Kargl [Fri, 5 Nov 2021 02:04:01 +0000 (04:04 +0200)]
Implementations of cexpl()

PR: 216862

(cherry picked from commit 046e2d5db1e8afd2d09ea28e5d2a7550535d4b77)

2 years agopowerd(8): Add rc.conf(5) to see also
Felix Johnson [Sun, 7 Nov 2021 02:39:23 +0000 (22:39 -0400)]
powerd(8): Add rc.conf(5) to see also

powerd_flags is mentioned in rc.conf(5) and can be set there and pass to
powerd.

PR: 258320
Reported by: Michael <michael.hmich@gmail.com>

(cherry picked from commit ec071430a7822997619fe6d99853d8f49ea10b20)

2 years agoscsi_cd: Improve TOC access validation
Mark Johnston [Wed, 3 Nov 2021 19:09:17 +0000 (15:09 -0400)]
scsi_cd: Improve TOC access validation

1. During CD probing, we read the TOC header to find the number of
   entries, then read the TOC itself.  The header determines the number
   of entries, which determines the amount of data to read from the
   device into the softc in the CD_STATE_MEDIA_TOC_FULL state.  We
   hard-code a limit of 99 tracks (plus one for the lead-out) in the
   softc, but were not validating that the size reported by the media
   would fit in this hard-coded limit.  Kernel memory corruption could
   occur if not.[1]  Add validation to check this, and refuse to cache
   the TOC if it would not fit.

2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index
   into the TOC, but we only validate the starting index.  Add
   validation of the ending index.

Also, raise the hard-coded limit from 100 tracks to 170, per a
suggestion from Ken.

Reported by: C Turt <ecturt@gmail.com> [1]
Reviewed by: ken, avg
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6afabf00920fb8d41b8f013090f282c17c117efc)

2 years agonfscl: Add a missing delegation lock release
Rick Macklem [Tue, 26 Oct 2021 02:09:14 +0000 (19:09 -0700)]
nfscl: Add a missing delegation lock release

There was a case in nfscl_doiods() where the function would return
without releasing the delegation shared lock, if it was aquired by
the call to nfscl_getstateid().  This patch adds that release.

I have never observed a failure due to this missing release, so I
do not know if it ever happens in practice.  However, since the pNFS
client is not yet heavily used, it might be the case.

Found by code inspection during a recent NFSv4 IETF working group
testing event.

(cherry picked from commit 23024f004a4c5659bfcb0b08fac2211ae925ee58)

2 years agoarm: fix a typo in nvidia/drm2/tegra_bo.c
Mateusz Guzik [Mon, 25 Oct 2021 18:42:10 +0000 (18:42 +0000)]
arm: fix a typo in nvidia/drm2/tegra_bo.c

Unbreaks building TEGRA124

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

(cherry picked from commit e2493f4912cabd1d04be88fd17139a64bf2a2622)

2 years agortld: fix dangerous_ld_env calculation for ld_dynamic_weak
Konstantin Belousov [Sat, 6 Nov 2021 03:00:52 +0000 (05:00 +0200)]
rtld: fix dangerous_ld_env calculation for ld_dynamic_weak

(cherry picked from commit 8363963a8f3fc8226b1e3aa627e2fdd09688704e)

2 years agossh: move common Makefile boilerplate to a new ssh.mk
Ed Maste [Tue, 2 Nov 2021 18:48:33 +0000 (14:48 -0400)]
ssh: move common Makefile boilerplate to a new ssh.mk

This moves SSHDIR and ssh_namespace.h handling to a common location,
and will simplify future work such as adding U2F support (D32509).

Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32808

(cherry picked from commit 9d63429fa16352f58037ac2aa6ddc734b25e8331)

2 years agoopenssh: remove unnecessary $FreeBSD$ tags
Ed Maste [Wed, 8 Sep 2021 01:48:15 +0000 (21:48 -0400)]
openssh: remove unnecessary $FreeBSD$ tags

Diff reduction against upstream: remove $FreeBSD$ tags from files where
the tag itself is the only difference from upstream.

(cherry picked from commit 0e642632e64a8b8ca740ce3307abe116c990e0b6)

2 years agoopenssh: restore local change to gssapi include logic
Ed Maste [Thu, 2 Sep 2021 20:43:59 +0000 (16:43 -0400)]
openssh: restore local change to gssapi include logic

/usr/include/gssapi.h claims that it is deprecated, and gssapi/gssapi.h
should be used instead.  So, test HAVE_GSSAPI_GSSAPI_H first falling
back to HAVE_GSSAPI_H.

This will be submitted upstream.

Fixes: 6eac665c8126 ("openssh: diff reduction against...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31810

(cherry picked from commit 258f5f79bb36e3e6955e7fb149cd2f50265a9ea5)

2 years agoopenssh: diff reduction against upstream 7.9p1
Ed Maste [Thu, 2 Sep 2021 17:38:30 +0000 (13:38 -0400)]
openssh: diff reduction against upstream 7.9p1

Clean up whitespace and nonfunctional differences, and unused functions.

(cherry picked from commit 6eac665c8126af387a457ee8a08303c6607a6769)

2 years agoPartially revert ac76bc1145dd because it is no longer necessary
Dimitry Andric [Fri, 5 Nov 2021 21:26:16 +0000 (22:26 +0100)]
Partially revert ac76bc1145dd because it is no longer necessary

In ac76bc1145dd, I added a few volatiles to work around ctrig_test
failures with {inf,inf}. This is not necessary anymore now, since in
3b00222f156d we added -fp-exception-behavior=maytrap for clang >= 10 in
libm's Makefile. (The flag tells clang to use stricter floating point
semantics, which libm depends on.)

PR: 244732, 254911
Fixes: ac76bc1145dd

(cherry picked from commit e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb)

2 years agostrip/objcopy: handle empty file as unknown
Ed Maste [Mon, 25 Oct 2021 21:25:26 +0000 (17:25 -0400)]
strip/objcopy: handle empty file as unknown

Previously strip reported a somewhat cryptic error for empty files:

    strip: elf_begin() failed: Invalid argument

Add a special case to treat empty files as with an unknown file format.
This is consistent with llvm-strip.  GNU strip produces no output which
does not seem like useful behaviour (but it does exit with status 1).

Reported by: andrew
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32648

(cherry picked from commit 179219ea046f46927d6478d43431e8b541703539)

2 years agoelftoolchain: stop leaving tempfiles on error
Chris Rees [Mon, 15 Feb 2021 11:37:06 +0000 (11:37 +0000)]
elftoolchain: stop leaving tempfiles on error

Temporary files were not cleaned up, resulting in $TMPDIR or even
the current directory becoming littered with ecp.* files.

This happened with error and even sometimes on success!

Approved by: dim
MFC after: 4 weeks
Accepted upstream: https://sourceforge.net/p/elftoolchain/code/3918/
Differential Revision: https://reviews.freebsd.org/D28651

(cherry picked from commit 5ac70383c8b32eeec80426e837960977971c7c2b)

2 years agofuser: restore functionality by fixing fsid type
Andriy Gapon [Mon, 1 Nov 2021 06:40:17 +0000 (08:40 +0200)]
fuser: restore functionality by fixing fsid type

Use types from sys/stat.h for the filesystem and inode numbers for extra
safety.

PR: 259504
Reported by: Markus Wild <freebsd-bugs@virtualtec.ch>
MFC after: 1 week

(cherry picked from commit e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a)

2 years agocosl(): fix polynomial approximation coefficients for ld128 version
Steve Kargl [Tue, 2 Nov 2021 08:54:10 +0000 (10:54 +0200)]
cosl(): fix polynomial approximation coefficients for ld128 version

PR: 218514

(cherry picked from commit 6d04e1422e70ca0a77552782c01c291f90716773)

2 years agovmci: Avoid relying on macro expansion to provide correct syntax
Mark Johnston [Wed, 3 Nov 2021 15:19:53 +0000 (11:19 -0400)]
vmci: Avoid relying on macro expansion to provide correct syntax

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c75c1d2df9b3839319f6b5e2fad0b757eebd9c55)

2 years agodate: Capitalize seconds string in synopses
Mateusz Piotrowski [Wed, 3 Nov 2021 11:59:49 +0000 (12:59 +0100)]
date: Capitalize seconds string in synopses

This makes it consistent with other date(1) implementations. Also, it
feels more consistent since hours and minutes are already represented as
HH and MM respectively.

MFC after: 3 days

(cherry picked from commit c537bf9d5903d0689321f83691341c93b5919172)

2 years agodate.1: Fix some style issues and examples
Mateusz Piotrowski [Wed, 3 Nov 2021 10:26:46 +0000 (11:26 +0100)]
date.1: Fix some style issues and examples

- Use Cm instead of Ar or Sq for command modifiers of the -v flag.
- Remove unnecessary "Ar ..." from the synopsis. It's not clear what it
  was referring to.
- Add missing arguments to the -f and -v flags.
- Stylize the dot before "ss" with Cm in the default format in the -f
  flag description.
- Set LC_ALL=C in the last example so that the output format of
  date(1) always matches the specified format of the -f flag not matter
  the locale.
- List the -f flag as optional in all usage lines in the synopsis.

MFC after: 3 days

(cherry picked from commit 00133d5c5e6aae01663eca40993abd5e6137425b)

2 years agodate: Clean up synopses
Mateusz Piotrowski [Wed, 3 Nov 2021 11:58:09 +0000 (12:58 +0100)]
date: Clean up synopses

MFC after: 3 days

(cherry picked from commit a12b16f48f747339ccae6dd80cc0c0c4ad5b7846)

2 years agodpv: Fix synopsis formatting & sort options
Mateusz Piotrowski [Tue, 2 Nov 2021 07:05:48 +0000 (08:05 +0100)]
dpv: Fix synopsis formatting & sort options

MFC after: 3 days

(cherry picked from commit a85aa7f9d3bfd26f5dc07f70cb7ba281bfc69f20)

2 years agodpv.1: Do not use mdoc macros for Bl width
Mateusz Piotrowski [Tue, 2 Nov 2021 07:17:19 +0000 (08:17 +0100)]
dpv.1: Do not use mdoc macros for Bl width

Macros do not expand there.

MFC after: 3 days

(cherry picked from commit 3693250e8a746053291849d8442f912336f0bf1b)

2 years agodpv.1: Fix an example
Mateusz Piotrowski [Tue, 2 Nov 2021 07:11:50 +0000 (08:11 +0100)]
dpv.1: Fix an example

dpv(1) requires a label to be specified.

MFC after: 3 days

(cherry picked from commit f7c7a6ac00f13e2d47d50844dd92071933c33a56)

2 years agortld: Do not install libmap.conf when installing the COMPAT32 version
Emmanuel Vadot [Wed, 13 Oct 2021 12:40:26 +0000 (14:40 +0200)]
rtld: Do not install libmap.conf when installing the COMPAT32 version

This has the effect of installing the same file twice at the same location
and confuse pkgbase as we add this file twice in the package config part.

MFC after:  1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit d0f0e0bd741af867582ceede8ac1b0aec90eae2d)

2 years agoFix a common typo in syctl descriptions
Gordon Bergling [Wed, 3 Nov 2021 19:49:24 +0000 (20:49 +0100)]
Fix a common typo in syctl descriptions

- s/maxiumum/maximum/

(cherry picked from commit c28e39c3d6d10a72800b7f49c23453fcc1bca8cc)

2 years agonetinet: Fix a common typo in source code comments
Gordon Bergling [Wed, 3 Nov 2021 15:21:49 +0000 (16:21 +0100)]
netinet: Fix a common typo in source code comments

- s/writting/writing/

(cherry picked from commit bb91496a85176cfc005cf141fe1262c9ad5507d4)

2 years agoocs_fs: Fix two typos in source code comments
Gordon Bergling [Wed, 3 Nov 2021 16:17:51 +0000 (17:17 +0100)]
ocs_fs: Fix two typos in source code comments

- s/maxium/maximum/
- s/maxiumum/maximum/

(cherry picked from commit 7b56cb0462c39cb190fc23e0e1190bdc89c163c8)

2 years agogjournal(8): Fix a typo in a source code comment
Gordon Bergling [Wed, 3 Nov 2021 16:14:00 +0000 (17:14 +0100)]
gjournal(8): Fix a typo in a source code comment

- s/writting/writing/

(cherry picked from commit 9d2e51884ef286bab94d48d062cf71f6a74a3f99)

2 years agong_pptpgre(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 3 Nov 2021 16:15:59 +0000 (17:15 +0100)]
ng_pptpgre(4): Fix a typo in a source code comment

- s/mimimum/minimum/

(cherry picked from commit 40a57b00f9a76f32a271d258acec4075966eec32)

2 years agoixgbe(4): Fix a few typos in source code comments
Gordon Bergling [Wed, 3 Nov 2021 15:16:20 +0000 (16:16 +0100)]
ixgbe(4): Fix a few typos in source code comments

- s/Manageblility/Managebility/
- s/alows/allows/

Obtained from: NetBSD

(cherry picked from commit 8da5034954911ecad0ce1e55acd3b50797bc338a)

2 years agofexecve(2): allow O_PATH file descriptors opened without O_EXEC
Konstantin Belousov [Wed, 3 Nov 2021 12:51:06 +0000 (14:51 +0200)]
fexecve(2): allow O_PATH file descriptors opened without O_EXEC

(cherry picked from commit be10c0a910155709dc4e521db3349d50e0440018)

2 years agoprocfs_doprocfile(): simplify
Konstantin Belousov [Thu, 4 Nov 2021 03:58:06 +0000 (05:58 +0200)]
procfs_doprocfile(): simplify

(cherry picked from commit 15bd9fa3bea794054b4a5bd2f4bb71b0ba3aa3ba)

2 years agoproc_get_binpath(): provide syntaxically correct value for unused NDINIT arg
Konstantin Belousov [Thu, 4 Nov 2021 00:53:21 +0000 (02:53 +0200)]
proc_get_binpath(): provide syntaxically correct value for unused NDINIT arg

(cherry picked from commit 7ac82c96fe79a6a9dcf595ef4860ed75d3511414)

2 years agoproc_get_binpath(): return empty string instead of NULL
Konstantin Belousov [Wed, 3 Nov 2021 15:11:33 +0000 (17:11 +0200)]
proc_get_binpath(): return empty string instead of NULL

(cherry picked from commit 02de91d740235f186321d7d3e11d09737daba43e)

2 years agofexecve(2): restore the attempts to calculate the executable path
Konstantin Belousov [Wed, 3 Nov 2021 12:58:03 +0000 (14:58 +0200)]
fexecve(2): restore the attempts to calculate the executable path

(cherry picked from commit e4ce23b238a162f5d36afe8ef49dcd66901138a1)

2 years agoprocfs: return right hardlink from /proc/curproc/file
Konstantin Belousov [Fri, 29 Oct 2021 01:43:32 +0000 (04:43 +0300)]
procfs: return right hardlink from /proc/curproc/file

PR: 248184

(cherry picked from commit e5248548f95ff1c89667847e0d945dea38adeca7)

2 years agoExtract proc_get_binpath() from sysctl_kern_proc_pathname()
Konstantin Belousov [Fri, 29 Oct 2021 01:42:59 +0000 (04:42 +0300)]
Extract proc_get_binpath() from sysctl_kern_proc_pathname()

(cherry picked from commit f34fc6ba06a10e0f2a505ec0dd2f2fab2a79e53d)

2 years agosys/proc.h: put proc_add_orphan() into proper place
Konstantin Belousov [Fri, 29 Oct 2021 22:02:32 +0000 (01:02 +0300)]
sys/proc.h: put proc_add_orphan() into proper place

(cherry picked from commit b4c7d45c849071b31936fec6ec43f3d4df3ef3d8)

2 years agosysctl kern.proc.procname: report right hardlink name
Konstantin Belousov [Sat, 23 Oct 2021 19:01:37 +0000 (22:01 +0300)]
sysctl kern.proc.procname: report right hardlink name

PR: 248184

(cherry picked from commit ee92c8a842d61ffda8d111e1b0e398085c5bfb3a)

2 years agoexec: store parent directory and hardlink name of the binary in struct proc
Konstantin Belousov [Sat, 23 Oct 2021 18:44:22 +0000 (21:44 +0300)]
exec: store parent directory and hardlink name of the binary in struct proc

(cherry picked from commit 351d5f7fc5161ededeaa226ee3f21a438ee4a632)

2 years agoexec: provide right hardlink name in AT_EXECPATH
Konstantin Belousov [Sat, 23 Oct 2021 00:24:08 +0000 (03:24 +0300)]
exec: provide right hardlink name in AT_EXECPATH

PR: 248184

(cherry picked from commit 0c10648fbb758bb76fd29330b7fe1bc519252325)

2 years agoMake vn_fullpath_hardlink() externally callable
Konstantin Belousov [Sat, 23 Oct 2021 00:23:17 +0000 (03:23 +0300)]
Make vn_fullpath_hardlink() externally callable

(cherry picked from commit 9a0bee9f6a77a85e4dfb27c9a33d4e210d05b469)

2 years agostruct image_params: use bool type for boolean members
Konstantin Belousov [Sat, 23 Oct 2021 15:05:56 +0000 (18:05 +0300)]
struct image_params: use bool type for boolean members

(cherry picked from commit 15bf81f354a428723d7e9ea61ea215d4195aa050)