Commit graph

24354 commits

Author SHA1 Message Date
Konstantin Belousov
b90d68c9b2 jemalloc: set LG_VADDR to 64 on amd64
(cherry picked from commit eade2001aa)
2024-10-15 18:06:44 +03:00
Cy Schubert
9a9a2165af unbound: Vendor import 1.21.1
Release notes at
	https://nlnetlabs.nl/news/2024/Oct/03/unbound-1.21.1-released/

Security:       CVE-2024-8508

Merge commit '9b8db746ac608ff7cdad3c9ac7ac395319e4ea0f'

(cherry picked from commit 5a5c227981)
2024-10-10 12:52:30 -07:00
Konstantin Belousov
27af5dad16 getrlimitusage.2: add the man page
(cherry picked from commit 3670421e21)
2024-10-10 12:10:33 +03:00
Konstantin Belousov
d19c86f203 sysctl.3: document missing oids from kern.proc. node
(cherry picked from commit cdd9629921)
2024-10-10 12:10:33 +03:00
Konstantin Belousov
387094ca8a sysctl.3: document missing fixed oids from the kern. node
(cherry picked from commit 4e2803878f)
2024-10-10 12:10:32 +03:00
Konstantin Belousov
90f2414a00 sysctl.3: Remove KERN_QUANTUM
(cherry picked from commit 2918dbc1cc)
2024-10-10 12:10:32 +03:00
Dimitry Andric
342240c6e0 Bump lld LINKER_FREEBSD_VERSION for reproducibility fix
The upstream fix to make lld output for our EFI loaders reproducible
again was committed in 54521a2ff9. Bump lld's LINKER_FREEBSD_VERSION
to be able to check this in the EFI loader Makefile.

MFC after:	3 days

(cherry picked from commit f97c7fdc59)
2024-10-08 10:37:14 +02:00
Joseph Mingrone
26f21a6494
libpcap: Update to 1.10.5
Changes:	https://git.tcpdump.org/libpcap/blob/bbcbc9174df3298a854daee2b3e666a4b6e5383a:/CHANGES
Reviewed by:	emaste
Obtained from:	https://www.tcpdump.org/release/libpcap-1.10.5.tar.gz
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit afdbf109c6)
(cherry picked from commit ecb75be376)
(cherry picked from commit f0bcebe67e)
(cherry picked from commit 34aa6f2c2d)
2024-10-07 14:27:04 -03:00
Dag-Erling Smørgrav
2403e6d5aa printf(): Save errno earlier.
The manual page says %m is replaced with “the string representation of
the error code stored in the errno variable at the beginning of the
call”.  However, we don't actually save `errno` until fairly late in
`__vfprintf()`.  Make sure it is saved before we do anything that
might perturb `errno`.

MFC after:	1 week
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D46718

(cherry picked from commit 74f1007fcc)
2024-10-06 09:12:49 +00:00
Konstantin Belousov
1611738d4c libprocstat: add procstat_getrlimitusage()
(cherry picked from commit 6126f4ea64)
2024-10-05 10:08:56 +03:00
Konstantin Belousov
dac3b7e394 Userspace enablement for getrlimitusage(2)
(cherry picked from commit 9b29fc89ae)
2024-10-05 10:08:55 +03:00
Konstantin Belousov
a03f7c040c libutil: support RLIMIT_PIPEBUF
(cherry picked from commit a4c04958f5)
2024-10-05 10:08:54 +03:00
Konstantin Belousov
d20f0dae2f getrlimit(2): document RLIMIT_PIPEBUF
(cherry picked from commit 54a8d1fbbf)
2024-10-05 10:08:54 +03:00
Kristof Provost
e3a9f4123f libpfctl: ensure we return useful error codes
Return errno rather than -1 on error. This allows pfctl to report much
more useful errors.

Reported by:	Alexander Leidinger <Alexander@Leidinger.net>
MFC after:	1 week

(cherry picked from commit 93e96359c9)
2024-09-29 20:29:50 +02:00
Bjoern A. Zeeb
ff26fd77ee libc/getnameinfo: stop adding NI_NUMERICHOST where inappropriate
Checking the first nibble of the IPv6 address to be 0 and then
excluding two well known cases (v4-mapped, loopback) leaves us with
more cases where the first nibble could be 0, e.g., the RFC 6052,
2.1 Well-Known Prefix 64:ff9b::/96.
It is not practical to track them all and it is not clear what lead
to this special casing originally, so remove them.

While here also remove the IN6_IS_ADDR_LINKLOCAL() + NI_NUMERICHOST
case as link-local address resolution does exist.

We do leave the IN6_IS_ADDR_MULTICAST() case for now as I could
not find any references to any official reverse lookups for these.

Adding comments for more case (and some historic behaviour) in order
to make it easier to follow the logic.

PR:		279618
Fixes:		6cb9418289
Reviewed by:	hrs
Differential Revision: https://reviews.freebsd.org/D45547

(cherry picked from commit c179937b98)
2024-09-28 10:35:11 +00:00
Enji Cooper
c931eed5bc lib/libcrypt: another trivial style change
Normalize on hard tabs.

I didn't catch this before pushing the previous commit.

No functional changes intended.

MFC after:	2 weeks
MFC with:	8ef8da882f

(cherry picked from commit 61b15e6dfc)
2024-09-27 20:58:19 -07:00
Enji Cooper
c6961c90fd lib/libcrypt: remove trailing whitespace
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit 8ef8da882f)
2024-09-27 20:57:45 -07:00
Enji Cooper
c2dca1b560 radlib: fix a memory leak in is_valid_request
Call `HMAC_CTX_free` if returning early from `is_valid_request` when
processing `Message-Authenticator` tags.

Reported by:	Coverity
MFC after:	1 week
Fixes: 8d5c781306 ("libradius: Fix input validation bugs")
Differential Revision:	https://reviews.freebsd.org/D45488

(cherry picked from commit 77c04f3eb1)
2024-09-27 20:54:48 -07:00
Fernando Apesteguía
ddbbc129ae faccessat(2): Honor AT_SYMLINK_NOFOLLOW
Make the system call honor `AT_SYMLINK_NOFOLLOW`.

Also enable this from `linux_faccessat2` where the issue arised the first time.
Update manual pages accordingly.

PR:			275295
Reported by:		kenrap@kennethraplee.com
Approved by:		kib@
Differential Revision:	https://reviews.freebsd.org/D46267

(cherry picked from commit 5ab6ed93cd)
2024-09-26 09:13:50 -04:00
Bill Sommerfeld
4f4860c9b0 regex: mixed sets are misidentified as singletons
Fix "singleton" function used by regcomp() to turn character set matches
into exact character matches if a character set has exactly one
element.

The underlying cset representation is complex; most critically it
records"small" characters (codepoint less than either 128
or 256 depending on locale) in a bit vector, and "wide" characters in
a secondary array.

Unfortunately the "singleton" function uses to identify singleton sets
treated a cset as a singleton if either the "small" or the "wide" sets
had exactly one element (it would then ignore the other set).

The easiest way to demonstrate this bug:

	$ export LANG=C.UTF-8
	$ echo 'a' | grep '[abà]'

It should match (and print "a") but instead it doesn't match because the
single accented character in the set is misinterpreted as a singleton.

PR:		281710
Reviewed by:	kevans, yuripv
Obtained from:	illumos

(cherry picked from commit 8f7ed58a15)
2024-09-25 15:42:25 -05:00
Konstantin Belousov
ba08efe3f2 getrlimit(2): document RLIMIT_UMTXP
(cherry picked from commit 3a2a5d6060)
2024-09-22 00:19:49 +03:00
John Baldwin
1dfb2690cc libcbor: Ignore errors for unknown #pragmas
libcbor embeds clang-specific #pragmas that GCC then warns about.

Reviewed by:	emaste

(cherry picked from commit 6ca0468a2f)
2024-09-08 14:03:17 +02:00
Steve Kargl
33c82f11c2 Improve accuracy of asinf(3) and acosf(3)
This uses a better rational approximation to improve the accuracy of
both functions. For exhaustive testing of asinf(3) in the interval, the
current libm gives:

    % ./tlibm asin -fPED -x 0x1p-12f -X 1
    Interval tested for asinf: [0.000244141,1]
           ulp <= 0.5:  97.916% 98564994 |  97.916% 98564994
    0.5 <  ulp <  0.6:  2.038% 2051023 |  99.953% 100616017
    0.6 <  ulp <  0.7:  0.047%   47254 | 100.000% 100663271
    0.7 <  ulp <  0.8:  0.000%      25 | 100.000% 100663296
    Max ulp: 0.729891 at 5.00732839e-01

which isn't too bad given that much of the computation is actually done
in double floating point.

With the new rational approximation, exhaustive testing yields:

    % ./tlibm asin -fPED -x 0x1p-12f -X 1
    Interval tested for asinf: [0.000244141,1]
           ulp <= 0.5:  99.711% 100372643 |  99.711% 100372643
    0.5 <  ulp <  0.6:  0.288%  290357 | 100.000% 100663000
    0.6 <  ulp <  0.7:  0.000%     296 | 100.000% 100663296
    Max ulp: 0.636344 at 5.09706438e-01

Similarly, for exhaustive testing of asinf(3) in the interval, the
current libm gives:

    % ./tlibm acos -fPED -x -1 -X -0x1p-12f
    Interval tested for acosf: [-1,-0.000244141]
           ulp <= 0.5:  97.008% 97651921 |  97.008% 97651921
    0.5 <  ulp <  0.6:   2.441%  2457242 |  99.450% 100109163
    0.6 <  ulp <  0.7:   0.472%   475503 |  99.922% 100584666
    0.7 <  ulp <  0.8:   0.071%    71309 |  99.993% 100655975
    0.8 <  ulp <  0.9:   0.007%     7319 | 100.000% 100663294
    0.9 <  ulp <  1.0:   0.000%        2 | 100.000% 100663296
    Max ulp: 0.914007 at -5.01484931e-01

    % ./tlibm acos -fPED -x 0x1p-12f -X 1
    Interval tested for acosf: [0.000244141,1]
           ulp <= 0.5:  97.317% 97962530 |  97.317% 97962530
    0.5 <  ulp <  0.6:   2.340%  2355182 |  99.657% 100317712
    0.6 <  ulp <  0.7:   0.314%   316134 |  99.971% 100633846
    0.7 <  ulp <  0.8:   0.029%    29450 | 100.000% 100663296
    Max ulp: 0.796035 at 4.99814630e-01

With the new rational approximation, exhaustive testing yields:

    % ./tlibm acos -fPED -x -1 -X -0x1p-12f
    Interval tested for acosf: [-1,-0.000244141]
           ulp <= 0.5:  97.010% 97653245 |  97.010% 97653245
    0.5 <  ulp <  0.6:   2.442%  2458373 |  99.452% 100111618
    0.6 <  ulp <  0.7:   0.473%   476012 |  99.925% 100587630
    0.7 <  ulp <  0.8:   0.068%    68603 |  99.993% 100656233
    0.8 <  ulp <  0.9:   0.007%     7063 | 100.000% 100663296
    Max ulp: 0.896189 at -5.04511118e-01

    % ./tlibm acos -fPED -x 0x1p-12f -X 1
    Interval tested for acosf: [0.000244141,1]
           ulp <= 0.5:  97.650% 98298175 |  97.650% 98298175
    0.5 <  ulp <  0.6:   2.028%  2041709 |  99.679% 100339884
    0.6 <  ulp <  0.7:   0.292%   293555 |  99.970% 100633439
    0.7 <  ulp <  0.8:   0.030%    29857 | 100.000% 100663296
    Max ulp: 0.775875 at 4.91849005e-01

PR:		281001
MFC after:	1 week

(cherry picked from commit 41e016289f)
2024-09-08 09:37:52 +02:00
Pietro Cerutti
ab7a79806e libfetch: don't include fragments in HTTP requests
Fragments are reserved for client-side processing, see
https://www.rfc-editor.org/rfc/rfc9110.html#section-7.1

Also, some servers don't like to receive HTTP requests with fragments.

```
$ fetch 'https://dropbox.com/a/b'
fetch: https://dropbox.com/a/b: Not Found

$ fetch 'https://dropbox.com/a/b#'
fetch: https://dropbox.com/a/b#: Bad Request
```

This is a real-world scenario, where some download link from dropbox
(eventually) redirects to an URL with a fragment:

```
$ fetch -v 'https://www.dropbox.com/sh/<some>/<thing>?dl=1' 2>&1 | grep requesting
requesting https://www.dropbox.com/sh/<some>/<thing>?dl=1
requesting https://www.dropbox.com/scl/fo/<foo>/<bar>?rlkey=<baz>&dl=1
requesting https://<boo>.dl.dropboxusercontent.com/zip_download_get/<some-long-strig>#
```

See how the last redirect ends with a `#`.

Currently, libfetch includes the ending fragment and makes it impossible
to download the file.

Differential Revision:	https://reviews.freebsd.org/D46318
MFC after:		2 weeks

(cherry picked from commit 1af7d5f389)
2024-09-05 14:05:15 +00:00
Mark Johnston
1e8b00a1cb libgeom: Avoid fixed remappings of the devstat device
libgeom maintains a quasi-private mapping of /dev/devstat, which might
grow over time if new devices appear.  When the mapping needs to be
expanded, the old mapping is passed as a hint, but this appears to be
unnecessary.

Simplify and improve things a bit:
- stop passing a hint when remapping,
- don't creat a mapping in geom_stats_open(), as geom_stats_resync() will
  create it for us,
- check for errors from munmap().

Reviewed by:	imp, asomers
Tested by:	asomers
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46294

(cherry picked from commit d06fe346ec)
2024-09-03 14:54:42 +00:00
Olivier Certner
9e8d504bb5
pam_xdg: Fix user xdg runtime directory's descriptor leak
Approved by:    emaste (mentor)
Fixes:          6e69612d5d ("pam: Add pam_xdg module")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 06986e8999)

Approved by:    emaste (mentor)
2024-09-03 15:28:58 +02:00
Andrew Turner
ca84f1ed4d libc/aarch64: Remove an unneeded weak symbol
The index symbol doesn't belong in memcpy.S as it is already in
strchr.S where it belongs.

Sponsored by:	Arm Ltd

(cherry picked from commit 024248c933)
2024-09-02 08:49:39 +00:00
Andrew Turner
519141de7e libc/aarch64: Add a non-trivial getcontextx
Add support for extra registers to the arm64 getcontextx. As no
registers are defined this just adds the extra register list and an end
context.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44255

(cherry picked from commit 5202ca77aa)
2024-09-02 08:44:40 +00:00
Andrew Turner
fd443b71fa libc/aarch64: Copy the trivial getcontextx
This will be used as the base of a non-trivial implementation.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44254

(cherry picked from commit fd6b1cc34e)
2024-09-02 08:44:29 +00:00
Vincenzo Maffione
20a2a59f39 libnetmap: remove interface name validation
When trying to use a VLAN device (e.g. "em0.123") with a dot
the library fails to parse the interface correctly. The former
pattern is much too restrictive given that almost all characters
can be coerced into a device name via ifconfig.

Remove the particularly restrictive validation.  Some characters
still cannot be used as an interface name as they are used as
delimiters in the syntax, but this allows to be able to use most
of them without an issue.

Submitted by:	franco@opnsense.org
Differential Revision:	https://reviews.freebsd.org/D42485
Reviewed by:	vmaffione
2024-09-01 17:56:17 +00:00
Jose Luis Duran
f7eb6b134d open(2): Extend EINVAL's description
PR:	281033

(cherry picked from commit 02c23c3b5a)
2024-09-01 03:53:36 +03:00
Jose Luis Duran
97ccb41979 rename(2): Extend EINVAL's description
PR:	281033

(cherry picked from commit 33f58ac079)
2024-09-01 03:53:36 +03:00
Jose Luis Duran
f968e0819d open(2): mandoc -T lint
(cherry picked from commit f5a37f8dd3)
2024-09-01 03:53:36 +03:00
Maxim Konovalov
2545829e1c pam_xdg.8: the module option name corrected
PR:	280994
(cherry picked from commit 6aee1dc480)
2024-08-25 04:12:44 +00:00
Cy Schubert
78c66b88cc unbound: Vendor import 1.21.0
Release notes at
	https://nlnetlabs.nl/news/2024/Aug/15/unbound-1.21.0-released/

Merge commit '96ef46e5cff01648c80c09c4364d10bc6f58119d'

(cherry picked from commit 5685098846)
2024-08-23 12:29:42 -07:00
Konstantin Belousov
2a1e8d7c30 exit(3): clarify how to obtain full exit status of the exited process
(cherry picked from commit c4269e63ec)
2024-08-21 13:32:49 +03:00
Konstantin Belousov
8d801641a3 exit(3): make it thread-safe
(cherry picked from commit 3f3ec4b99f)
2024-08-21 13:32:49 +03:00
Konstantin Belousov
023b97a699 msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local
(cherry picked from commit 0c00dbfeb0)
2024-08-14 06:25:55 +03:00
Konstantin Belousov
ac4866f142 msun/ld80/e_powl.c: add const qualifiers to the static immutable values
(cherry picked from commit 10ac6c48a3)
2024-08-14 06:25:55 +03:00
Christos Margiolis
db238c7c52 mixer.3: Fix mixer_get_mode() description
Improve wording and also fix the constants' names.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46220

(cherry picked from commit 6e744de1a3)
2024-08-08 16:49:10 +03:00
Robert Clausecker
644d814471 lib/libc/amd64/string: fix overread condition in memccpy
An overread condition in memccpy(dst, src, c, len) would occur if
src does not cross a 16 byte boundary and there is no instance of
c between *src and the next 16 byte boundary.  This could cause a
read fault if src is just before the end of a page and the next page
is unmapped or unreadable.

The bug is a consequence of basing memccpy() on the strlcpy() code:
whereas strlcpy() assumes that src is a nul-terminated string and
hence a terminator is always present, c may not be present at all in
the source string.  It was not caught earlier due to insufficient
unit test design.

As a part of the fix, the function is refactored such that the runt
case (buffer length from last alignment boundary between 1 and 32 B)
is handled separately.  This reduces the number of conditional
branches on all code paths and simplifies the handling of early
matches in the non-runt case.  Performance is improved slightly.

os: FreeBSD
arch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        │ memccpy.unfixed.out │        memccpy.fixed.out           │
        │       sec/op        │   sec/op     vs base               │
Short             66.76µ ± 0%   62.45µ ± 1%  -6.44% (p=0.000 n=20)
Mid               7.938µ ± 0%   7.967µ ± 0%  +0.36% (p=0.001 n=20)
Long              3.577µ ± 0%   3.577µ ± 0%       ~ (p=0.429 n=20)
geomean           12.38µ        12.12µ       -2.08%

        │ memccpy.unfixed.out │         memccpy.fixed.out           │
        │         B/s         │     B/s       vs base               │
Short            1.744Gi ± 0%   1.864Gi ± 1%  +6.89% (p=0.000 n=20)
Mid              14.67Gi ± 0%   14.61Gi ± 0%  -0.36% (p=0.001 n=20)
Long             32.55Gi ± 0%   32.55Gi ± 0%       ~ (p=0.429 n=20)
geomean          9.407Gi        9.606Gi       +2.12%

Reported by:	getz
Reviewed by:	getz
Approved by:	mjg (blanket, via IRC)
See also:	D46051
MFC:		stable/14
Event:		GSoC 2024
Differential Revision:	https://reviews.freebsd.org/D46052
2024-08-07 16:18:40 +02:00
Ed Maste
5bd6e6c1dd libusb: claim to be version 1.0.16
We are not 100% compatible with 1.0.16, but implement some
functionality from that version that is required by certain ports.

PR:		277799
PR:		279555 (exp-run)
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45514

(cherry picked from commit 5654b42142)
2024-08-06 17:25:21 -04:00
Steve Kargl
dc39004bc6 libm: fma: correct zero sign with small inputs
This is a fixed version of 888796ade2.

PR:		277783
Reported by:	Victor Stinner
Reviewed by:	emaste
MFC after:	1 week

(cherry picked from commit 888796ade2)
(cherry picked from commit e77ad954bb)
(cherry picked from commit 34f746cc7f)
2024-08-06 17:25:10 -04:00
Ed Maste
f06d322e9d Remove "All Rights Reserved" from FreeBSD Foundation copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5c2bc3db20)
2024-08-06 15:39:53 -04:00
Ed Maste
d1d8c91147 libm: add parens to clarify expressions in fma, fmal
Obtained from:	NetBSD

(cherry picked from commit 001606523a)
2024-08-06 15:39:52 -04:00
Ed Maste
6cd4450c6c msun: update Clang bug reference in fma test
LLVM bugzilla bug 8100 became issue #8472 with the migration to GitHub.

https://github.com/llvm/llvm-project/issues/8472
(cherry picked from commit 92927b8bcf)
2024-08-06 15:39:52 -04:00
Konstantin Belousov
15ee14d0f7 rtld: avoid division in __thr_map_stacks_exec()
(cherry picked from commit 31f688a26d)
2024-08-05 03:32:11 +03:00
Michael Tuexen
37c9f79561 sctp: document sctp_recvmsg as implemented
PR:		275990

(cherry picked from commit eee88ef45f)
2024-08-04 00:19:33 +02:00
Ed Maste
128bace510 libfido2: update to 1.14.0
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 60a517b66a)
2024-08-01 11:11:45 -04:00
Michal Meloun
fb084dd01e Fix mismerge in lib/libthr/arch/riscv/include/pthread_md.h
Fixes:	bd774d7aa1
2024-07-31 20:27:05 +02:00