Commit Graph

23354 Commits

Author SHA1 Message Date
Konstantin Belousov
ae507c25de amd64 libc: add missed GNU-stack annotation to memmove/memcpy
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-11-18 15:31:38 +02:00
Xin LI
dc58b3fca5 MFV: expat 2.5.0
MFC after:	2 weeks
2022-11-17 22:15:00 -08:00
Xin LI
9fc8132eca Vendor import of expat 2.5.0 2022-11-17 22:08:44 -08:00
Dag-Erling Smørgrav
f1ad5e3931 libarchive: Add missing MLINK.
Differential Revision: https://reviews.freebsd.org/D37398
2022-11-17 17:12:24 +01:00
Xin LI
9e6bbe47a5 MFV: Merge xz 5.2.8
Relnotes:	yes
MFC after:      2 weeks
2022-11-16 20:37:07 -08:00
John Baldwin
57fbafb8de libfetch: Pass a zeroed digest to DigestCalcResponse.
GCC 12 warns that passing "" (a constant of char[1]) to a parameter of
type char[33] could potentially overread.  It is not clear from the
context that c->qops can never be "auth-int" (and if it can't, then
the "auth-int" handling in DigestCalcResponse is dead code that should
be removed since this is the only place the function is called).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36825
2022-11-15 19:18:58 -08:00
Rick Macklem
032b04626b rpcb_clnt.c: Do not force use of UDP
Without this patch, the code in the rpcbind client forces
the use of UDP.  A comment notes that some rpcbind servers
only support UDP.  This makes NFSv3 mounts to Azure servers
impossible, since they require use of TCP for rpcbind.
Since the comment is very old (imported from NetBSD in 2001)
and I do not believe any UDP only rpcbind servers will
still exist, this patch comments out the code that forces
use of UDP, so that NFSv3 mounts to Azure servers can work.

For an NFSv3 mount, the "udp" mount option will still
make mount_nfs use UDP for rpcbind so that can be used
as a workaround for any old NFSv3 server that only
supports rpcbind over UDP (if any such server still exists).

I asked if doing this change is appropriate on freebsd-fs@
and I only got one reply (off list) that supported doing
the change.

PR:	267301
MFC after:	1 month
2022-11-13 12:16:06 -08:00
Kirk McKusick
5c7ba6bdf8 Fix for tunefs(8) unable to add a UFS/FFS soft update journal.
The reported bug is UFS: bad file descriptor: soft update journaling
can not be enabled on some FreeBSD-provided disk images – failed
to write updated cg.

The UFS library (libufs(3)) failed to reopen its disk descriptor
when first attempting to update a cylinder group. The error only
occurred when trying to add journaling to a filesystem whose first
cylinder group was too full to hold the journal.

PR:           259090
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2022-11-12 15:37:27 -08:00
Elyes HAOUAS
cb25444c05 lib/libsecureboot: Fix some typos
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/544
2022-11-11 10:38:39 -05:00
Dag-Erling Smørgrav
817f1f3064 libc: Don't warn about RRSIG replies.
PR:		213178
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D37303
2022-11-09 17:41:47 +01:00
Mark Johnston
d0f8e31761 getsockopt.2: Clarify the SO_REUSEPORT_LB text a bit
Refer to sockets rather than processes, since one can have multiple
sockets in a load-balancing group within the same process.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
2022-11-02 13:46:24 -04:00
Mark Johnston
34c8598eb1 libsysdecode: Match socket option names containing underscores
MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
2022-11-02 13:46:24 -04:00
John Baldwin
c9c9057c77 ktrace.2: Document KTRFAC_STRUCT_ARRAY.
Sponsored by:	DARPA
2022-11-02 10:35:26 -07:00
Mike Karels
631b82aca0 fetch: support EAI_ADDRFAMILY error, correct two error messages
With the change to return EAI_ADDRFAMILY from getaddrinfo(), fetch
would print "Unknown resolver error" for that error.  Add that error
and its string to libfetch's table, using an #ifdef just in case.
Correct error strings for EAI_NODATA (although it is currently unused)
and EAI_NONAME.  Should maybe rework the code to use gai_strerror(3),
but that doesn't map directly, and the current strings are shortened.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz
MFC after:      1 month
2022-11-02 11:03:31 -05:00
Mike Karels
1443613866 getaddrinfo: distinguish missing addrs from unresolvable names
Rework getaddrinfo(3) to return different error values for unresolvable
names (same as before, EAI_NONAME) and those without a requested addr
(EAI_ADDRFAMILY) when using DNS.  This is implemented via an added
error in the nsswitch layer, NS_ADDRFAMILY, which is used only by
getaddrinfo().  The error is passed through nsdispatch(3), but that
routine has no changes to handle this error.  The error originates in
the getaddrinfo DNS layer called via nsdispatch(), and is processed
by the search layer that calls nsdispatch().

While here, add a little style to returns near those that were
modified.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz
MFC after:      1 month
2022-11-02 11:03:31 -05:00
Mike Karels
e34adc71d3 gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA
gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA,
but not the man page.  Re-add to the man page, and update comments
in the source.  Document the errors that are not in RFC 3493 or
POSIX.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz, pauamma
MFC after:      1 month
2022-11-02 11:03:31 -05:00
Kristof Provost
8a8af94240 pf: bridge-to
Allow pf (l2) to be used to redirect ethernet packets to a different
interface.

The intended use case is to send 802.1x challenges out to a side
interface, to enable AT&T links to function with pfSense as a gateway,
rather than the AT&T provided hardware.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37193
2022-11-02 15:45:23 +01:00
Kristof Provost
9f8f3a8e9a ipsec: add support for CHACHA20POLY1305
Based on a patch by ae@.

Reviewed by:	gbe (man page), pauamma (man page)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37180
2022-11-02 14:19:04 +01:00
Doug Rabson
c7631f9153 libc_nonshared: Move to clibs package
Its needed by libc.a which lives in clibs.

PR:	254173
2022-11-01 10:17:07 +00:00
Kristof Provost
444a77ca85 pf: expose syncookie active/inactive status
When syncookies are in adaptive mode they may be active or inactive.
Expose this status to users.

Suggested by:	Guido van Rooij
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-31 18:14:09 +01:00
Jose Luis Duran
f0a15aafcb strfmon: Remove XXX marks
phantom@'s HDD crashed with the final version of strfmon.c, as explained
in 9d430a5991.

Now there are tests in place that cover these code paths.

Reviewed by:	kib
PR:	267410
Github PR:	#620
MFC after:	1 week
2022-10-30 00:09:32 +03:00
Jose Luis Duran
621bf91893 strfmon_l: Use specified locale for number formatting
strfmon_l does not take fully into consideration the explicitly passed
locale to perform the formatting.

Parallel universe bug report:	https://sourceware.org/bugzilla/show_bug.cgi?id=19633

Obtained from:	Darwin
Reviewed by:	kib
PR:	267410
Github PR:	#620
MFC after:	1 week
2022-10-30 00:09:11 +03:00
Jose Luis Duran
29972f06f9 strfmon_test: Add a test for strfmon_l
Attempt to test the correctness of strfmon_l(3).

Items marked with XXX represent an invalid output.

Obtained from:	e7eba0044f

Reviewed by:	kib
PR:	267410
Github PR:	#620
MFC after:	1 week
2022-10-30 00:08:54 +03:00
Jose Luis Duran
edcee003e5 strfmon_test: Reserve space for the null terminator
Otherwise strfmon(3) could overflow the buffer.

Here is mostly done for correctness and illustrative purposes, as there
is no chance it could actually happen.

Reviewed by:	kib
PR:	267410
Github PR:	#620
MFC after:	1 week
2022-10-30 00:08:33 +03:00
Jose Luis Duran
d96088b3ab strfmon_l(3): Add name to the man page
Reviewed by:	kib
PR:	267410
Github PR:	#620
MFC after:	1 week
2022-10-30 00:08:19 +03:00
Emmanuel Vadot
e7a5a60ed5 pkgbase: Put devmatch in its own package
devmatch is useful on standalone machine but not on jails.
Put devinfo(8) and libdevinfo there too.

Differential Revision:	https://reviews.freebsd.org/D36229
2022-10-26 19:46:38 +02:00
Emmanuel Vadot
a7ffc94849 pkgbase: Put ufs related tools and lib in their own package
It's not really useful in a jail or in a mdroot or even if a users
wants to do a full zfs machine.

Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D36227
2022-10-26 19:46:34 +02:00
Emmanuel Vadot
a099694ecd pkgbase: Put libwrap in FreeBSD-tcpd package
It belongs there with the tcp wrapper utilities

Differential Revision:	https://reviews.freebsd.org/D36226
2022-10-26 19:46:32 +02:00
Emmanuel Vadot
a71ea7bea0 pkgbase: Put zfs utilities and lib in their own package
It is useful to have zfs utilities and lib in a separate package as
it allow users to create image that can support ZFS (i.e. not with
WITHOUT_ZFS in src.conf set) without bloating the default image with
all zfs tools (for example for jails).

Differential Revision:	https://reviews.freebsd.org/D36225
2022-10-26 19:46:30 +02:00
Emmanuel Vadot
0bf688786f pkgbase: Put geom utilities in their own package
For most users it's not needed to boot and they are also
available in the FreeBSD-rescue package in case an update
break and FreeBSD-geom package isn't updated correctly.

Differential Revision:	https://reviews.freebsd.org/D36224
2022-10-26 19:46:28 +02:00
Jose Luis Duran
7cfd67ce96 strfmon(3): Fix # explanation
There's only one value that specifies the number of digits after the
decimal point (oh, sorry, the "radix character") the other specifies the
number before...

While here, add a little more info on the effects of using the #n value.

Obtained from:	d1dd1a0864
Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:48:20 +03:00
Jose Luis Duran
0efec50e9e strfmon(3): Remove repeated words
Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
34f88528ed strfmon: Fix formatting of a second fixed-width value
There is a bug when formatting two consecutive values using fixed-widths
and the values need padding.  This was because the value of pad_size
was zeroed only every other time.

Format           Before                         After
[%8n] [%8n]      [ $123.45] [       $123.45]    [ $123.45] [ $123.45]

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
750fe3e6a4 strfmon: Fix an edge case when sep_by_space is 2
Fix an edge case by printing the required space when, the currency
symbol succeeds the value, a space separates the sign from the value and
the sign position precedes the quantity and the currency symbol.

In other words:

    n_cs_precedes = 0
    n_sep_by_space = 2
    n_sign_posn = 1

From The Open Group's localeconv[1]:

> When {p,n,int_p,int_n}_sep_by_space is 2:
> If the currency symbol and sign string are adjacent, a space separates
> them; otherwise, a space separates the sign string from the value.

    Format    Before        After
    [%n]      [-123.45¤]    [- 123.45¤]

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html

Obtained from:	Darwin
Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
947efadc3d strfmon: Fix alignment when enclosed by parentheses
Take into consideration the possibility of quantities enclosed by
parentheses when aligning.

Matches the examples from The Open Group's:

Format  Before          After
%(#5n   [$   123.45]    [ $   123.45 ]  Use an alternative pos/neg style
        [($   123.45)]  [($   123.45)]
        [$ 3,456.78]    [ $ 3,456.78 ]

%!(#5n  [   123.45]     [    123.45 ]   Disable the currency symbol
        [(   123.45)]   [(   123.45)]
        [ 3,456.78]     [  3,456.78 ]

https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

SD5-XSH-ERN-29 is applied, updating the examples for %(#5n and %!(#5n.

Obtained from:	Darwin
Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
6da51e19e3 strfmon: Trim the SPACE from international currency symbol
The international currency symbol (int_curr_symbol) has a mandatory
SPACE character as the last character.

Trim this space after reading it, otherwise this extra space will always
be printed when displaying the int_curr_symbol.

Fixes the output when the international currency format is selected
(%i).

    Locale         Format    Before           After
    en_US.UTF-8    [%i]      [USD 123.45]     [USD123.45]
    fr_FR.UTF-8    [%i]      [123,45 EUR ]    [123,45 EUR]

Note that the en_US.UTF-8 locale states that no space should be printed
between the currency symbol and the value (sep_by_space = 0).

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
9e03b903e3 strfmon: Avoid an out-of-bounds access
Avoid an out-of-bounds access when trying to set the space_char using an
international currency format (%i) and the C/POSIX locale.

The current code tries to read the SPACE from int_curr_symbol[3]:

    currency_symbol = strdup(lc->int_curr_symbol);
    space_char = *(currency_symbol+3);

But on C/POSIX locales, int_curr_symbol is empty.

Three implementations have been examined: NetBSD[1], Darwin[2], and
Illumos[3].  Only NetBSD has fixed it[4].

Darwin and NetBSD also trim the mandatory final SPACE character after
reading it.

    Locale         Format    Darwin/NetBSD    FreeBSD/Illumos
    en_US.UTF-8    [%i]      [USD123.45]      [USD 123.45]
    fr_FR.UTF-8    [%i]      [123,45 EUR]     [123,45 EUR ]

This commit only fixes the out-of-bounds access.

[1]: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/strfmon.c
[2]: https://opensource.apple.com/source/Libc/Libc-1439.141.1/stdlib/NetBSD/strfmon.c.auto.html
[3]: https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/strfmon.c
[4]: 3d7b5d498a

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:17 +03:00
Jose Luis Duran
0afd11d50f strfmon: Fix typos in source code comments
s/defult/default
s/internaltion/international

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:16 +03:00
Jose Luis Duran
d5980dff6b strfmon: Fix typo in constant
s/SUPRESS_CURR_SYMBOL/SUPPRESS_CURR_SYMBOL

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:16 +03:00
Jose Luis Duran
f81dfea291 strfmon: Code cleanup
No functional change intended.
Not claiming full style(9) compliance.

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:40:16 +03:00
Jose Luis Duran
3f97d37ac5 strfmon_test: Add some tests
Attempt to test the correctness of strfmon(3).

Some of them were inspired from the examples section at:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

Items marked with XXX represent an invalid output.

Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:29:26 +03:00
Jose Luis Duran
f91301cc79 strfmon_test: Fix typo and remove extra space
Reviewed by:	kib
PR:	267282
Github PR:	#619
MFC after:	1 week
2022-10-26 00:28:33 +03:00
Warner Losh
aec9453fec times: Use modern function definitions
Use the modern ANSI function defition syntax rather than the old K&R
syntax for times.

Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
Mark Johnston
3e9b4532d1 libvmmapi: Provide an interface for limiting rights on the device fd
Currently libvmmapi provides a way to get a list of the allowed ioctls
on the vmm device file, so that bhyve can limit rights on the device
file fd.  The interface is rather strange: it allocates a copy of the
list but returns a const pointer, so the caller has to cast away the
const in order to free it without aggravating the compiler.

As far as I can see, there's no reason to make a copy of the array, but
changing vm_get_ioctls() to not do that would break compatibility.  So
this change just introduces a better interface: move all rights-limiting
logic into libvmmapi.

Any new operations on the fd should be wrapped by libvmmapi, so also
discourage use of vm_get_device_fd().  Currently bhyve uses it only when
limiting rights on the device fd.

No functional change intended.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37098
2022-10-24 17:33:13 -04:00
Mark Johnston
a4ee0edc4a libc: Make elf_aux_info() return an error if AT_USRSTACK* is undefined
Otherwise we do not fall back to sysctls if the auxv entries are not
defined by the kernel.  Arguably this is not a bug since we do not
support newer libc running on an older kernel, but we can be a bit more
gentle for the benefit of Valgrind or any other software which
synthesizes the auxv for virtualization purposes.

Reported by:	Paul Floyd <paulf2718@gmail.com>
MFC after:	1 week
Reviewed by:	brooks, kib
Differential Revision:	https://reviews.freebsd.org/D37036
2022-10-18 18:11:26 -04:00
Ed Maste
101ba46bb6 libproc: retire now-unused MIPS support
Discussed with:	imp
2022-10-17 14:17:25 -04:00
Mitchell Horne
4a9b1a1463 getpagesize(3): cross-reference getpagesizes(3)
MFC after:	3 days
2022-10-17 15:16:12 -03:00
Cy Schubert
865f46b255 unbound: Reapply Vendor import 1.17.0
Reapply 643f9a0581. 64d318ea98 was a
mismerge during fake rebase. Let's reapply it.

Changes include: Added ACL per interface, proxy protocol and bug fixes.

Announcement:   https://nlnetlabs.nl/news/2022/Oct/13/unbound-1.17.0-released/

Merge commit '643f9a0581e8aac7eb790ced1164748939829826' into main
2022-10-16 14:08:33 -07:00
Cy Schubert
8cee2ebac5 Revert "unbound: Vendor import 1.17.0"
This reverts commit 64d318ea98, reversing
changes made to 8063dc0320.

Revert a mismerge which reversed 8063dc0320.
2022-10-16 13:42:15 -07:00
Cy Schubert
64d318ea98 unbound: Vendor import 1.17.0
Added ACL per interface, proxy protocol and bug fixes.

Announcement:   https://nlnetlabs.nl/news/2022/Oct/13/unbound-1.17.0-released/

Merge commit '643f9a0581e8aac7eb790ced1164748939829826' into new_merge
2022-10-16 13:32:55 -07:00