Commit Graph

23293 Commits

Author SHA1 Message Date
Ed Maste
9515313b26 libc: Fix size range check in setvbuf
From enh at google.com via openbsd-tech mailing list via pfg@:

The existing test is wrong for LP64, where size_t has twice as many
relevant bits as int, not just one. (Found by inspection by
rprichard.)
2022-10-04 12:03:56 -04:00
Hans Petter Selasky
1024bb2633 qdivrem: Predict division by zero as false.
Division by zero triggers an arithmetic exception and should not be very
common. Predict this.

No functional change intended.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-04 13:51:06 +02:00
John Baldwin
ab9293239c qsort_b_test: Only build on clang.
GCC doesn't support -fblocks.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D36809
2022-10-03 16:14:39 -07:00
John Baldwin
d30a1689f5 libefivar: Fix a buffer overread.
DevPathToTextUsbWWID allocates a separate copy of the SerialNumber
string to append a null terminator if the original string is not
null terminated.  However, by using AllocateCopyPool, it tries to
copy 'Length + 1' words from the existing string containing 'Length'
characters into the target string.  Split the copy out to only
copy 'Length' characters instead.

Reviewed by:	imp, emaste
Reported by:	GCC 12 -Wstringop-overread
Differential Revision:	https://reviews.freebsd.org/D36826
2022-10-03 16:10:44 -07:00
John Baldwin
611cf39267 libfetch: Use memcpy in place of an odd strncpy.
The length passed to strncpy is the length of the source string, not
the destination buffer.  This triggers a non-fatal warning in GCC 12.
Hoewver, the code is also odd.  It is really just a memcpy of the
string without its nul terminator.  For that use case, memcpy is
clearer.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36824
2022-10-03 16:10:43 -07:00
John Baldwin
8f27c9d14a libiconv VIQR: Fix a use after free.
Use TAILQ_FOREACH_SAFE to walk to list of children mnemonics to free
them instead of TAILQ_FOREACH.

Reviewed by:	emaste
Reported by:	GCC 12 -Wuse-after-free
Differential Revision:	https://reviews.freebsd.org/D36821
2022-10-03 16:10:43 -07:00
John Baldwin
7973f26ad6 libedit: Disable -Wuse-after-free for chartype.c.
GCC 12 thinks ct_visual_string can reuse a pointer after it has been
reallocated, but in this case the warning appears false.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36820
2022-10-03 16:10:43 -07:00
John Baldwin
996ee96597 libbegemot: Disable -Wuse-after-free.
The _xrealloc() function prints pointer values for internal assertion
failures and in one case does so after it has freed the pointer.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36819
2022-10-03 16:10:43 -07:00
John Baldwin
c3a3d1fd6c libirdma: Drop clang-specific -ferror-limit.
This could use -fmax-errors on GCC, but tweaking the error limit is
unusual in the tree anyway.  Just remove it.

Reviewed by:	erj, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36808
2022-10-03 16:10:42 -07:00
Hans Petter Selasky
aa87aa5232 libusb(3): Implement libusb_interrupt_event_handler() by exposing existing function.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-02 17:32:59 +02:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Ed Schouten
af3c78886f Alter the prototype of qsort_r(3) to match POSIX, which adopted the
glibc-based interface.

Unfortunately, the glibc maintainers, despite knowing the existence
of the FreeBSD qsort_r(3) interface in 2004 and refused to add the
same interface to glibc based on grounds of the lack of standardization
and portability concerns, has decided it was a good idea to introduce
their own qsort_r(3) interface in 2007 as a GNU extension with a
slightly different and incompatible interface.

With the adoption of their interface as POSIX standard, let's switch
to the same prototype, there is no need to remain incompatible.

C++ and C applications written for the historical FreeBSD interface
get source level compatibility when building in C++ mode, or when
building with a C compiler with C11 generics support, provided that
the caller passes a fifth parameter of qsort_r() that exactly matches
the historical FreeBSD comparator function pointer type and does not
redefine the historical qsort_r(3) prototype in their source code.

Symbol versioning is used to keep old binaries working.

MFC:			never
Relnotes:		yes
Reviewed by:		cem, imp, hps, pauamma
Differential revision:	https://reviews.freebsd.org/D17083
2022-09-30 15:26:30 -07:00
Mariusz Zaborski
26573e2c7f cap_netdb: Fix description style
MFC after:	1 week
2022-09-29 19:51:42 +02:00
Mariusz Zaborski
facd6b58d5 libcapser: Add reference to cap_netdb
MFC after:	1 week
2022-09-29 19:51:04 +02:00
John Baldwin
5ceec6c105 pam_unix: Fix mismatch in array bounds for make_salt().
Reviewed by:	imp, emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36759
2022-09-28 14:04:48 -07:00
John Baldwin
5d27845e5a ldns: Disable -Warray-parameter warnings from GCC 12 on sha2.c.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36758
2022-09-28 14:02:30 -07:00
John Baldwin
a2e41a585b libc rpc: Fix mismatches in prototypes for array bounds.
Various RPC functions used a bare pointer in function prototypes to
describe fixed-length buffer arguments but used a fixed-length array
in the function definition.  The manual page for these functions
describes the parameters as being fixed-length buffers, so update
the prototypes to match the definitions.

Reviewed by:	imp, emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36757
2022-09-28 14:01:36 -07:00
Brooks Davis
0eea46fb1f Remove telnetd
The telnetd codebase is unmaintained and has a number of quality
issues. Telnet has been largely supplanted by ssh. If needed, a port is
available (net/freebsd-telnetd), but a more maintained implementation
should be prefered.

While the telnet client suffers from the same issues, it is deemed
to be of lower risk and is required to connect to legacy devices, so
it remains.

Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D36620
2022-09-28 19:53:49 +01:00
Xin LI
45ff071ddc scandir(3): Rename alphasort_thunk to scandir_thunk_cmp to
reflect that it is not alphasort-specific.

Reported by:	emaste
Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D36708
2022-09-25 19:01:46 -07:00
Alfonso S. Siciliano
84823cc708
contrib/bsddialog: Import version 0.4
Improvements and changes to integrate bsddialog(1) with scripts in BASE.
Overview:

 * New options. --and-widget, --keep-tite, --calendar.
 * Change output format. Menus and --print-maxsize.
 * Redefine sizing. Fixed rows, cols and menurows became at the most.
 * Add DIAGNOSTICS. Error messages for bad arguments and options.
 * Add keys. Space for --menu, fast keys for --msgbox and --yesno.
 * Text. Change default text modification, add --cr-wrap.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-09-24 Version 0.4'
for more detailed information.

Merge commit '9f24fda5a8e7ab8243e71473c7e2dc98b4877e64'
2022-09-25 15:09:16 +02:00
Alfonso S. Siciliano
9f24fda5a8
contrib/bsddialog: Import version 0.4
Improvements and changes to integrate bsddialog(1) with scripts in BASE.
Overview:

 * New options. --and-widget, --keep-tite, --calendar.
 * Change output format. Menus and --print-maxsize.
 * Redefine sizing. Fixed rows, cols and menurows became at the most.
 * Add DIAGNOSTICS. Error messages for bad arguments and options.
 * Add keys. Space for --menu, fast keys for --msgbox and --yesno.
 * Text. Change default text modification, add --cr-wrap.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-09-24 Version 0.4'
for more detailed information.
2022-09-25 15:04:33 +02:00
Xin LI
a2dfb7224e file: upgrade to 5.43.
MFC after:	3 days
2022-09-24 19:16:39 -07:00
Xin LI
71f0c44a04 MFV 66082b6c88: libbsdxml (expat) 2.4.9 2022-09-21 00:02:38 -07:00
Xin LI
66082b6c88 Vendor import of expat 2.4.9. 2022-09-20 23:53:08 -07:00
Steve Kargl
620d855fac msun: correct comment
The comment in msun/src/e_jn.c lacks proper grammar, and is incorrect on
the choice of normalization entity.

PR:	266503
MFC after:	3 days
2022-09-19 21:40:07 +03:00
Jens Schweikhardt
ed5e7fb16c There's no PEM(3) anywhere around; delete reference. 2022-09-17 13:14:01 +02:00
Jens Schweikhardt
25c54b848e Reference correct section for free(3). 2022-09-17 13:12:44 +02:00
Brooks Davis
bb23932803 ktrace: make ktr_tid a long not intptr_t (NFC)
Long ago, ktr_tid was ktr_buffer which pointed to the buffer following
the header and was used internally in the kernel.  Use was removed in
efbbbf570d and it was repurposed as ktr_kid in c6854c347f.  For
ABI reasons, it stayed an intptr_t rather than becoming an lwpid_t at
the time.  Since it doesn't hold a pointer any more (unless you have
a ktrace.out from 2005), change the type to long which is alwasy the
same size on all supported architectures.  Add a suggestion to change
the type to lwpid_t (__int32_t) on a future ABI break.

Remove most remaining references to ktr_buffer, retaing a comment in
kdump.c explaining why negative values are treated as 0.  While here,
accept that pid_t and lwpid_t are of type int and simplify casts in
printf.

This changed was motivated by CheriBSD where intptr_t is 16-bytes
in the pure-capability ABI.

Reviewed by:	kib, markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36599
2022-09-17 09:21:59 +01:00
Jens Schweikhardt
714300faec Change sysctl section to 3 as suggested by Benjamin Kaduk. 2022-09-17 09:35:49 +02:00
Jens Schweikhardt
a09bb0ed18 Correct a typo in man page references: rpcset_gss -> rpcsec_gss. 2022-09-16 22:38:42 +02:00
Konstantin Belousov
e03c7f5005 libthr: extract code to get main stack base and size into helpers
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:24:12 +03:00
Konstantin Belousov
e2879ece43 libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rlimit(RLIMIT_STACK)
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:24:06 +03:00
Konstantin Belousov
ebf7a01594 libthr: use nitems() for mib length
Suggested by:	imp
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:23:59 +03:00
Konstantin Belousov
62b4fb22df auxv.3: Document AT_USRSTACKBASE and AT_USRSTACKLIM
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:23:46 +03:00
Konstantin Belousov
8f2668b060 _elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:23:32 +03:00
Jens Schweikhardt
e9e615c88a Fix dead references (wrong section) to sysctl(8). 2022-09-16 20:00:49 +02:00
Jens Schweikhardt
e6044abdbe More precise language: what is called data pointer, C calls object pointer.
Also delete reference to non-existing lint(1).
2022-09-16 19:40:11 +02:00
Jens Schweikhardt
59a1db5be6 Fix dead refs to pam(8) with pam(3) as well as some other PAM functions. 2022-09-16 19:33:30 +02:00
Jens Schweikhardt
cf13e67730 Fix dead reference to boot0(8) to point to boot0cfg(8). 2022-09-16 19:08:22 +02:00
Dag-Erling Smørgrav
1e8a0a3053 Add deprecation notices for OPIE.
Differential Revision: https://reviews.freebsd.org/D36593
2022-09-15 16:29:00 +02:00
Gordon Bergling
0090d18235 Update SEE ALSO sections for resolver.{3,5} and hosts.5
The mentioned document "Name Server Operations Guide for BIND" is
outdated, so remove it from the SEE ALSO section of hosts.5
and resolver.{3,5}.

PR:		266360
Reported by:	Graham Perrin <grahamperrin at FreeBSD dot org>
Reviewed by:	karels
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36557
2022-09-15 15:24:28 +02:00
Gordon Bergling
f2411b9257 flua: Fix a typo in a source code comment
- s/paramter/parameter/

MFC after:	3 days
2022-09-15 10:25:54 +02:00
Maxim Konovalov
acc3f0689a getaddrinfo(3): A typo fixed
PR:	266403
2022-09-14 05:08:45 +00:00
Kristof Provost
6049ee60e0 libpfctl: improve syncookie watermark calculation
Ensure that we always pass sane limits for the high and low watermark
values.
This is especially important if users do something silly, like set the
state limit to 1. In that case we wound up calculating 0/0 as a limit,
which gets rejected by the kernel.

While here also shift the calculation to use uint64_t, so we don't end
up with overflows (and subsequently higher low than high values) with
very large state limits.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36497
2022-09-12 09:32:02 +02:00
Gordon Bergling
82007616d0 msun: Remove a double word in a source code comment
- s/to to/to/

MFC after:	3 days
2022-09-10 12:59:10 +02:00
Gleb Popov
c44ca4c227 msun/Makefile: Fix conditional and unbreak the build.
Approved by:	imp
Fixes:	20adba8bc1
2022-09-09 11:07:33 +03:00
Gleb Popov
20adba8bc1 src.conf: Introduce WITHOUT_MACHDEP knob.
Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

Differential Revision: https://reviews.freebsd.org/D36076

MFC after:	3 days
2022-09-09 09:54:28 +03:00
Xin LI
c65e42dbde libc: add test case for qsort_b(3)
Reviewed by: 	markj
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D36463
2022-09-06 23:11:46 -07:00
Felix Palmen
6f4d99c654 pam_unix: Remove bogus __unused attribute
Approved by:		cy, des, tcberner (mentor)
Differential Revision:	https://reviews.freebsd.org/D34320
2022-09-05 20:53:22 +02:00
Toomas Soome
1f5679569d libpmc: pmc_init() should avoid overflowing pmc_class_table
Use calloc().

Walk the class list we get from kernel, so we will not add something
the kernel does not know about.

Avoid picking headers from /usr/include.

Differential Revision:	https://reviews.freebsd.org/D36401
2022-09-05 15:23:20 +03:00