Commit Graph

277654 Commits

Author SHA1 Message Date
Baptiste Daroussin
83e8c23178 bintrans: replace the quoted printable encoder/decoder
Replace the quoted printable code with one that respects RFC2045
Add tests about this parsers and encoders, using examples from the
wikipedia page.

Reviewed by:	pstef
Differential Revision: https://reviews.freebsd.org/D36314
2022-08-25 09:29:18 +02:00
Doug Moore
b6ce129d24 rb_tree: optimize rb_insert
In searching for where to insert a new node, RB_INSERT discards the
address of the pointer that will have to be modified, so that it must
find it again from the values of 'parent' and 'comp'. Stop discarding
that address, and so avoid having to recompute it.

Reviewed by:	alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D36317
2022-08-25 02:26:04 -05:00
Li-Wen Hsu
9ea2716b77
Reenable basic_signal:trap_signal_test on i386
This is fixed in dc4a2d1d0e

PR:		265889
Sponsored by:	The FreeBSD Foundation
MFC with:	dc4a2d1d0e
2022-08-25 12:09:00 +08:00
Li-Wen Hsu
504b998def
ObsoleteFiles: Follow awk test files move
Fixes:	517e52b6c2
Sponsored by:	The FreeBSD Foundation
2022-08-25 11:28:57 +08:00
Aymeric Wibo
05c9a0158f libc: Add strverscmp(3) and versionsort(3)
Add a strverscmp(3) function to libc, a GNU extension I implemented by
reading its glibc manual page. It orders strings following a much more
natural ordering (e.g. "ent1 < ent2 < ent10" as opposed to
"ent1 < ent10 < ent2" with strcmp(3)'s lexicographic ordering).

Also add versionsort(3) for use as scandir(3)'s compar argument.

Update manual page for scandir(3) and add one for strverscmp(3).

Reviewed by:	pstef, gbe, kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D35807
2022-08-25 03:29:03 +03:00
Mark Johnston
465988e9fa NOTES: Update the comment for MCLSHIFT
MFC after:	1 week
2022-08-24 19:59:32 -04:00
Mark Johnston
b0b0e4ee00 NOTES: Update the default MSIZE and MCLSHIFT values
After commit 840327e5dd ("mbuf: Don't support PAGE_SIZE < 4K"), these
defaults were causing LINT kernel builds to fail.

Reported by:	Jenkins
MFC after:	1 week
2022-08-24 19:57:33 -04:00
Mark Johnston
c4d06691c0 git-arc: Respect GIT_EDITOR and GIT_PAGER 2022-08-24 16:54:41 -04:00
Mark Johnston
43d0c4d2a2 git-arc: Fix whitespace 2022-08-24 16:53:17 -04:00
Konstantin Belousov
a294e67973 Document scandirat(3)
Reviewed by:	emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36301
2022-08-24 22:26:01 +03:00
Konstantin Belousov
9fb8e8eede libc: add scandirat(3)
Reviewed by:	emaste, imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36301
2022-08-24 22:26:00 +03:00
Konstantin Belousov
cb6e97f4da libc: split scandir() into scandir_dirp() and proper scandir()
The new helper scandir_dirp() takes DIR *, i.e. a pre-opened directory,
instead of the directory name.

Reviewed by:	emaste, imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36301
2022-08-24 22:26:00 +03:00
Konstantin Belousov
ea448a0a43 Link scandir_b(3) to scandir(3)
Reviewed by:	emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36301
2022-08-24 22:26:00 +03:00
Konstantin Belousov
aa5e19a9b3 scandir.3: Use .Fo instead of .Fn for long args
Reviewed by:	emaste, gbe (man pages), imp, kevans, markj, Aymeric Wibo <obiwac@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36301
2022-08-24 22:26:00 +03:00
Konstantin Belousov
fce3b1c327 fork_exit(): style comment
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:53 +03:00
Konstantin Belousov
ff32a05554 x86: improve machdep.uprintf_signal
Print %eax/%rax.
Use better format strings, like %#x.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:45 +03:00
Konstantin Belousov
01a33b2af5 x86: print trap name in addition of trap number
for the "trap with interrupts disabled" warning.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:37 +03:00
Konstantin Belousov
0f906b30e6 i386: print all GPRs, PSL, and CR3 on double fault
Also compactify the printfs, and remove comment about 'two prints'.
Their arguments are on same page, so one fault implies another.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:30 +03:00
Konstantin Belousov
54e1546e09 i386: simplify flow control in irettraps
It is enough to have only one 'call calltrap' locally.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:22 +03:00
Konstantin Belousov
e8b2980e4a i386 doreti: stop saving/restoring %ecx around calls into C
There is no reason to do this.  Instead just calculate it later.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:12:05 +03:00
Konstantin Belousov
dc4a2d1d0e i386: do not allow userspace to set tf_trapno on sigreturn(2)
tf_trapno is checked on return from interrupt/exception to determine if
special handling is needed for switching address space.  This is due to
the possibility of NMI/MCHK/DBG to occur at arbitrary place in kernel,
where both address space and stack used could be transient.  Kernel
saves current %cr3 in tf_err for such events, to restore on return.

If user is able to set tf_trapno, it can trigger that special handling,
and since tf_err is also user-controlled by sigreturn(2), the result is
undefined.

PR:	265889
Reported by:	lwhsu
Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:11:57 +03:00
Konstantin Belousov
a03e4799e7 irettraps: i386 does not push %ss/%esp when exception does not switch rings
Which means that we must not copy top 8 bytes from the trampoline stack
for the exception frame to the regular thread kstack.  As consequence,
this stops corruption of the pcb.  The visible effect was often a broken
fork(2) on the CPU where corruption occured.

Account for the detail by substracting 8 from the copy byte count when
moving exception frames from trampoline to the regular stack.

[irettraps handles segmentation/stack/protection faults which could
occur on the doreti path, where we might already switched stack and
address space]

Reported and tested by:	pho
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:11:49 +03:00
Konstantin Belousov
95f773e594 i386 copyout_fast: improve detection of a fault on accessing userspace
Do not blindly account a page fault occuring on the trampoline area,
as the userspace access fault.  Check that it occured exactly in the
instruction that does that.

This avoids unneeded switches of address space on faults not needing the
switch, effectively converting machine resets due to tripple faults,
into regular panics.

Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36302
2022-08-24 22:11:40 +03:00
Dag-Erling Smørgrav
0a9b374ecc chown: see also chmod.
Sponsored by:	Klara, Inc.
MFC after:	1 week
2022-08-24 20:21:39 +02:00
Eric van Gyzen
3b0f105ce3 shared_shadow_inval_test: fix copy-pasto in error message
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-08-24 13:03:11 -05:00
Brooks Davis
c46697b9cb freebsd32_sendmsg: fix control message ABI
When a freebsd32 caller uses all or most allowed space for control
messages (MCLBYTES == 2K) then the message may no longer fit when
the messages are padded for 64-bit alignment.  Historically we've just
shrugged and said there is no ABI guarantee.  We ran into this on
CheriBSD where a capsicumized 64-bit nm would fail when called with more
than 64 files.

Fix this by not gratutiously capping size of mbuf data we'll allocate
to MCLBYTES and let m_get2 allocate up to MJUMPAGESIZE (4K or larger).
Instead of hard-coding a length check, let m_get2 do it and check for a
NULL return.

Reviewed by:	markj, jhb, emaste
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36322
2022-08-24 18:34:39 +01:00
Brooks Davis
9c3ad5ba93 cxgbe: don't support MJUMPAGESIZE != MCLBYTES
This could only happen on systems with PAGE_SIZE < 4K and FreeBSD
doesn't support such systems.

Reviewed by:	np, imp, jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36321
2022-08-24 18:34:25 +01:00
Brooks Davis
840327e5dd mbuf: Don't support PAGE_SIZE < 4K
The Vax supported such things, but FreeBSD does not.  This further
implies that MJUMPAGESIZE > MCLBYTES so assert this and remove code
handling them being equal.

Reviewed by:	kp, imp, jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36320
2022-08-24 18:34:07 +01:00
Brooks Davis
e9ad2964f5 pkg: Add limited --debug/-d support
Add an internal debug level global:
 - Level 1 (-d) currently does nothing.

 - Level 2 (-d -d) enables libfetch debugging (quite verbose) so it's
   possible to see what pkg is attempting to download without having
   to sniff traffic.

Reviewed by:	debdrup, bapt
Differential Revision:	https://reviews.freebsd.org/D35756
2022-08-24 18:32:09 +01:00
Alexander V. Chernikov
8036234c72 netinet6: fix SIOCSPFXFLUSH_IN6 by skipping manually-configured prefixes
Summary:
Currently netinet6/ code allocates IPv6 prefixes (nd_prefix) for
 both manually-assigned addresses and advertised prefixes. As a result,
 prefixes from manually-assigned prefixes can be seen in `ndp -p` list
 and be cleared via `ndp -P`. The latter relies on the SIOCSPFXFLUSH_IN6
 ioctl to clear to prefix list.
The original intent of the SIOCSPFXFLUSH_IN6 was to clear prefixes
 originated from the advertising routers:

```
1998-09-02  JINMEI, Tatuya  <jinmei@isl.rdc.toshiba.co.jp>
	* nd6.c (nd6_ioctl): added 2 new ioctls; SIOCSRTRFLUSH_IN6 and
	SIOCSPFXFLUSH_IN6. The former is to flush all default routers
	in the default router list, and the latter is to flush all the
	prefixes and the addresses derived from them in the prefix list.
```

Restore the intent by marking prefixes derived from the RA messages
with newly-added ndpr_flags.ra_derived flag and skip prefixes not marked
 with such flag during deletion and listing.

Differential Revision: https://reviews.freebsd.org/D36312
MFC after:	2 weeks
2022-08-24 13:59:13 +00:00
Emmanuel Vadot
6364180582 linuxkpi: unbreak linux_i2cbb
This is a joint work with manu.

- fixed conditions in do_i2c_transfer and i2c_transfer as linux_i2cbb
  does not set adapter->algo->master_xfer but does set
  adapter->algo_data;
- fixed parent bus specification for linux_i2cbb driver module;
- actually implemented iicbb_transfer method;
- added iicbb_pre_xfer and iicbb_post_xfer methods;
- removed unnecessary and harmful delays (and other extra logic) from
  iicbb methods as iicbb driver already has them;
- added setting of iicbb speed based on algo_data->udelay, so that iicbb
  uses correct delays;

PR:		265920
Fixes:		1961a14a47 linuxkpi: Add i2c support
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG (manu's work)
2022-08-24 16:23:37 +03:00
Warner Losh
211053f952 arm64: Remove unused typedef
We don't use EFI_MEMORY_DESCRIPTOR that's typedef'd here. We use the one
from sys/efi.h instead. Remove the clutter here as these two are subtly
different (though wind up with the same layout due to alignment rules).

Sponsored by:		Netflix
2022-08-24 06:35:41 -06:00
Peter Holm
4e4f49fd4a stress2: Added another sigreturn(2) fuzzer test 2022-08-24 13:21:55 +02:00
Vincenzo Maffione
9a7abd9327 pkt-gen: flip IPv4 address in ping-pong mode
MFC after:	7 days
2022-08-24 08:20:57 +00:00
Kirk McKusick
345bfec109 Provide cache coherency between getnextinode() and ginode()
The fsck_ffs(8) utility has two subsystems for reading and writing
inodes. The getnextinode() interface is used in Pass 1 (and Pass
1b if needed) to sequentially walk through all the inodes in the
filesystem. The ginode() interface is used to read and write
individual inodes. Pass 1 uses a mix of both interfaces. This
change ensures that ginode() returns a pointer to the inode in the
cache maintained by getnextinode() when that interface holds the
requested inode so that all modifications to the inode are made in
a single place and are all written to the disk together.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-23 23:48:40 -07:00
Kirk McKusick
be639cc8ee Update standard superblock when successful using an alternate superblock.
Historically fsck_ffs(8) would only use alternate superblocks when
running in manual mode. When the standard superblock fails, it now
tries to find and use a backup superblocks even when running in `preen'
mode. If an alternate superblock is found and the filesystem is
successfully cleaned up using it, write the alternate superblock
back to the standard superblock so that the filesystem can be
subsequently mounted and used.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-23 23:29:17 -07:00
Mark Johnston
4b8feb5d61 tests: Handle platforms with MAXPAGESIZES < 2
Reported by:	Jenkins
Fixes:		1dfa8b73f6 ("tests: Add more shared shadow regression tests")
2022-08-23 19:48:06 -04:00
Brooks Davis
c2e1544f59 m_get3: add an MLINK for the manpage
Reviewed by:	kp
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36319
2022-08-23 22:34:07 +01:00
Mateusz Guzik
4c9c0b640b vfs: fix vaccess prototype in the manpage
Reported by:	des
2022-08-23 21:01:55 +00:00
Mateusz Guzik
96d1fbf367 vfs: fix VOP_UNLOCK prototype in the manpage
Note the manpage is woefully outdated, taking about "simple lock".

Reported by:	des
2022-08-23 20:55:20 +00:00
John Baldwin
e663907366 Define _NPCM and the last PC_FREEn constant in terms of _NPCPV.
This applies one of the changes from
5567d6b441 to other architectures
besides arm64.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36263
2022-08-23 13:31:02 -07:00
Mateusz Guzik
9488262679 rms: add rms_assert_rlock_ok
So that callers which opportunistically elide the lock can still
assert that they can take it.

Reviewed by:
Differential Revision:
2022-08-23 19:15:48 +00:00
John Baldwin
9e4e7bcaef *DRIVER_MODULE*: Remove the compat shims to accept the devclass argument.
PR:		264969 (exp-run)
Differential Revision:	https://reviews.freebsd.org/D35168
2022-08-23 09:38:09 -07:00
John Baldwin
6ea773d49a pmu_dmc620: Remove unused devclass from DRIVER_MODULE. 2022-08-23 09:36:12 -07:00
John Baldwin
9a777495df cmn600: Remove unused devclass from DRIVER_MODULE. 2022-08-23 09:36:11 -07:00
John Baldwin
51480b486a mv88e151x: Remove unused devclass argument from DRIVER_MODULE. 2022-08-23 09:36:11 -07:00
Alexander V. Chernikov
cf145eb25f arcanist: use FreeBSD/git project repository instead of FreeBSD/svn
Current `.arcconfig` specifies explicit mapping to the FreeBSD/SVN
 project in Phabricator, which is inactive. This mapping only gets
 updated to the current "production" (FreeBSD/git) project when the
 underlying change is committed.
Update arcanist configuration to create all new diffs in the
 FreeBSD/git project.

Reviewed By: dim, emaste
Differential Revision: https://reviews.freebsd.org/D36204
2022-08-23 14:16:41 +00:00
Eric van Gyzen
3d268c19ef Fix shared_shadow_inval_test when superpages are disabled
In that case, there is only one page size.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D36265
2022-08-23 09:12:51 -05:00
Randall Stewart
62ce18fc9a tcp: Rack rwnd collapse.
Currently when the peer collapses its rwnd, we mark packets to be retransmitted
and use the must_retran flags like we do when a PMTU collapses to retransmit the
collapsed packets. However this causes a problem with some middle boxes that
play with the rwnd to control flow. As soon as the rwnd increases we start resending
which may be not even a rtt.. and in fact the peer may have gotten the packets. Which
means we gratuitously retransmit packets we should not.

The fix here is to make sure that a rack time has passed before retransmitting the packets.
This makes sure that the rwnd collapse was real and the packets do need retransmission.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D35166
2022-08-23 09:17:05 -04:00
Randall Stewart
4e0ce82b53 TCP Lro has a loss of timestamp precision and reorders packets.
A while back Hans optimized the LRO code. This is great but one
optimization he did degrades the timestamp precision so that
all flushed LRO entries end up with the same LRO timestamp
if there is not a hardware timestamp. The intent of the LRO timestamp
is to get as close to the time that the packet arrived as possible. Without
the LRO queuing this works out fine since a binuptime is taken and then
the rx_common code is called. But when you go through the queue path
you end up *not* updating the M_LRO_TSTMP fields.

Another issue in the LRO code is several places that cause packet reordering. In
general TCP can handle reordering but it can cause extra un-needed retransmission
as well as other oddities. We will fix all of the reordering problems.

Lets fix this so that we restore the precision to the timestamp.

Reviewed by: tuexen, gallatin
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36043
2022-08-23 09:12:31 -04:00