1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00
Commit Graph

24640 Commits

Author SHA1 Message Date
Warner Losh
e9ac41698b Remove residual blank line at start of Makefile
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
2024-07-15 16:43:39 -06:00
Ed Maste
001606523a libm: add parens to clarify expressions in fma, fmal
Obtained from:	NetBSD
2024-07-15 09:30:02 -04:00
Strahinja Stanišić
f0d1236f0f libc: Add memset test for int-to-char conversion
Test case to check if an implementation of memset correctly
handles the value passed being wider than a byte

Approved by:	emaste
Reviewed By:	fuz (GSoC mentor), emaste
Sponsored by:	Google LLC (GSoC 2024)
Differential Revision: https://reviews.freebsd.org/D45738
2024-07-13 15:07:49 +02:00
Kyle Evans
1f155d48f8 include: ssp: fortify <sys/socket.h>
The entire recv*() implementation set is ripe for opportunities to
validate, so do what we can with what we have.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45686
2024-07-13 00:16:26 -05:00
Kyle Evans
2aba0eea3f include: ssp: fortify <sys/select.h>
Notably sanity check indices passed to the FD_*() macros against the
size of the fd_set itself.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45685
2024-07-13 00:16:25 -05:00
Kyle Evans
1ace24b30c include: ssp: fortify <sys/uio.h>
Check both the buffer size of the iov object itself, as well as that
of each indidvidually io base.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45684
2024-07-13 00:16:25 -05:00
Kyle Evans
062d9380b9 include: ssp: fortify <sys/random.h>
That is to say, fortify getrandom(2).

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45683
2024-07-13 00:16:25 -05:00
Kyle Evans
b53d7aa88f include: ssp: fortify <wchar.h>
This includes all of the w*() equivalents to str*()/mem*() implemented
in more or less the same way.  For these ones, we'll just use
header-only implementations from the start to stop further cluttering
the libc symbol table.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45682
2024-07-13 00:16:25 -05:00
Kyle Evans
d0b7445904 include: ssp: fortify <stdlib.h>
The immediately obvious and attractive targets from <stdlib.h> are
arc4random_buf(3) and realpath(3) -- scraping the header didn't reveal
much else of interest.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45681
2024-07-13 00:16:24 -05:00
Kyle Evans
88276dfbf1 include: ssp: fortify poll/ppoll from <poll.h>
For poll/ppoll we just need to bounds-check the poll array that we're
about to write out to.

Reviewed by:	kib, markj (earlier version)
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45680
2024-07-13 00:16:24 -05:00
Kyle Evans
cf8e5289a1 include: ssp: round out fortification of current set of headers
ssp/ssp.h needed some improvements:
 - `len` isn't always a size_t, it may need casted
 - In some cases we may want to use a len that isn't specified as a
    parameter (e.g., L_ctermid), so __ssp_redirect() should be more
    flexible.
 - In other cases we may want additional checking, so pull all of the
    declaration bits out of __ssp_redirect_raw() so that some functions
    can implement the body themselves.

strlcat/strlcpy should be the last of the fortified functions that get
their own __*_chk symbols, and these cases are only done to be
consistent with the rest of the str*() set.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45679
2024-07-13 00:16:24 -05:00
Kyle Evans
c10d567ea0 include: de-macro __ssp_overlap(), improve semantics and checking
Switch away from pointer arithmetic to provide more obvious semantics
for checking overlap on pointer ranges.  This lets us remove some casts
that need not exist and removes some possible fragility in its use.

While we're here, check for overflow just in case; sometimes we use a
caller-supplied size if __builtin_object_size(3) can't deduce the buffer
size, and we should fail the check if the size is nonsensical for the
provided buffers.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
2024-07-13 00:16:23 -05:00
Kyle Evans
020d003c86 libc: tests: add testing infrastructure for _FORTIFY_SOURCE
The _FORTIFY_SOURCE tests will be generated by a lua script to avoid a
lot of redundancy in writing these tests.  For each function that we're
fortifying, the plan is to test at least the following three scenarios:

 - Writing up to one byte before the end of the buffer,
 - Writing up to the end of the buffer,
 - Writing one byte past the end of the buffer

The buffer is shoved into a struct on the stack to guarantee a stack
layout in which we have a valid byte after the buffer so that level 2
fortification will trip and we can have confidence that it wasn't some
other stack/memory protection instead.

The generated tests are divided roughly into which header we're
attributing them to so that we can parallelize the build -- the full set
is a bit over 9000 lines of C and takes 11s to build on the hardware
that I'm testing on if it's a single monolothic file.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45678
2024-07-13 00:16:23 -05:00
Kyle Evans
4719366192 libc: move __ssp_overlap back out into <ssp/ssp.h>
We'll be using it in some upcoming definitions in headers, so move it
back now but slap a warning on it.  Our upcoming uses will all be inside
of inline functions, so we're not overly concerned about double
evaluation immediately.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45677
2024-07-13 00:16:23 -05:00
Kyle Evans
41c233dec6 Prepare some build fixes in advance of more _FORTIFY_SOURCE
ZFS' libspl needs to be made aware that we have strlcat(3) and
strlcpy(3) to avoid some more complicated declaration duplication, so
go ahead and define these HAVE_ macros now.

libprocstat has to define `_KERNEL` and include kernel headers in order
to get what it wants, but this results in sys/cdefs.h being included too
late and we pick up the build breaking version of the __RENAME
definition.  Just explicitly include sys/cdefs.h earlier rather than
disabling _FORTIFY_SOURCE.  The zfs/ subdir only builds an object that
holds some structures and sizes, so just disable _FORTIFY_SOURCE there
entirely rather than trying to move #define _KERNEL into the file..

While we're here, make sure that we disable _FORTIFY_SOURCE in the
bootloader because we don't have the symbol renaming support today to do
it as cleanly as we'd like.  ssp/ssp.h needs to be pulled into the libsa
environment so that other bits can understand that ssp is disabled in
the consistent __SSP_FORTIFY_LEVEL way that we try to do.

Reviewed by:	allanjude (previous version), markj
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D45676
2024-07-13 00:16:23 -05:00
Andrew Turner
97dbe3e7ac libclang_rt: Simplify the arm check
We just need to check we are building for arm.

Reviewed by:	manu, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45644
2024-07-12 11:31:54 +00:00
Konstantin Belousov
3d95e9e3fe libipsec: decode SADB_X_EXT_IF_HW_OFFL
Sponsired by:	NVIDIA networking
2024-07-12 06:29:31 +03:00
Konstantin Belousov
1b1cd327d9 setkey(8): print out SA sw/hw offload counters
Sponsored by:	NVIDIA networking
2024-07-12 06:29:31 +03:00
Ka Ho Ng
8cd71a0e01 libfetch: parse IPv4address in IPv6address properly
This fix parsing problems of IPv6 addresses which contains IPv4
addresses. One example is ::192.168.0.1.

Documents are in below:
https://datatracker.ietf.org/doc/html/rfc2373#page-22

Sponsored by:	Juniper Networks, Inc.
MFC after:	1 week
Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D45896
2024-07-11 15:48:28 -04:00
Chandrakanth patil
9207f9d206 bnxt_re: User library support for RoCE driver
This patch introduces userspace library support for the bnxt_re RoCE driver.
The library can be linked with RDMA applications such as perftest and rping.
The RoCE traffic has been tested with the rping and perftest utility.

Reviewed by:            imp, kib, sumit.saxena@broadcom.com
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45729
2024-07-09 11:08:36 +00:00
Ryan Libby
f7f9a033f3 rtld: quiet gcc -Wrestrict
Reported by:	GCC -Wrestrict
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45892
2024-07-07 16:46:49 -07:00
Ryan Libby
39733922ed rtld: actually resolve memcpy plt
The call to memcpy() meant to cause plt resolution in _thr_rtld_init()
was getting optimized by the compiler.  Tell the compiler not to use its
builtins in thr_rtld.c.  We could avoid just the memcpy builtin but
disabling all will be more robust against future changes.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45891
2024-07-07 16:46:49 -07:00
Ryan Libby
07d359787f libthr: avoid gcc -Wcast-function-type
The actual types of pthread_func_t and interpos_func_t are not used.
Declare them as the generic void (*)(void) which suppresses warnings.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45830
2024-07-03 08:38:32 -07:00
Ryan Libby
7b1c770341 libthr _get_curthread i386: quiet gcc -Warray-bounds
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the gs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x8.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45829
2024-07-03 08:37:44 -07:00
Ryan Libby
657b1276ad libthr _get_curthread amd64: quiet gcc -Warray-bounds
Use a constant input operand instead of a bogus memory reference to tell
the compiler about offsetof(struct tcb, tcb_thread) in the fs segment.
Otherwise gcc complains if we tell it we are reading memory offset 0x10.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45828
2024-07-03 08:37:11 -07:00
Warner Losh
de1e91339b clock_gettime: Catch up with the CLOCK_BOOTTIME changes
When CLOCK_BOOTTIME was made an alias for CLOCK_MONOTONIC, the man page
wasn't updated. Update to include the changed semantics (it was to be
better compatible with Linux). Clarify the details of these clocks.
Provide a reference to the UTC standard, and a clarifying remark
about leap second encoding (fun fact: POSIX provides no unique
value for these, nor definitive values to use).

Sponsored by:		Netflix
2024-07-02 11:27:35 -06:00
Cormac Stephenson
172328c477 timerfd.2: Add documentation for CLOCK_UPTIME and CLOCK_BOOTTIME
Add CLOCK_UPTIME and CLOCK_BOOTTIME options and a quick pointer
to clock_gettime(2) for a better definition of these values.

Reviewed-by: imp (small tweaks and added Xr)
Pull-Request: https://github.com/freebsd/freebsd-src/pull/1302
2024-07-02 10:40:04 -06:00
Ed Maste
5654b42142 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
2024-06-28 12:18:34 -04:00
Alexander Ziaee
088cc7d221 man filesystems: fix more xrefs after move to s4
Fixes: 1a720cbec5
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1282
2024-06-27 18:32:05 -06:00
Ryan Libby
07cc7ea738 libmsun: remove duplicates after cdefs.h added inline to __always_inline
Reviewed by:	kib, olce
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45712
2024-06-25 10:40:14 -07:00
Andrew Turner
8521ea135f Revert "WIP: Switch to compiler-rt sync on armv7"
This reverts commit 940cf92c07.

This wasn't ready to be committed
2024-06-25 09:37:38 +00:00
Andrew Turner
940cf92c07 WIP: Switch to compiler-rt sync on armv7 2024-06-25 09:07:19 +00:00
Ryan Libby
012e32c665 libthr: move __always_inline to canonical position
Ahead of including inline in __always_inline, move __always_inline to
where inline goes.

Reviewed by:	imp, kib, olce
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45710
2024-06-24 10:05:58 -07:00
David E. O'Brien
5bcc33d1e0 ppoll(2) was actually added in 10.2 2024-06-23 16:13:28 -07:00
David E. O'Brien
3dd248798d procctl(2) actually appeared in 9.3 2024-06-23 16:13:28 -07:00
Gordon Bergling
16c3d7e1fa erf.3: Add a STANDARDS section
Add a STANDARDS section for the erf(3) manual page.

PR:	273413
Reviewed by:	pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44140
2024-06-23 12:50:47 +02:00
Warner Losh
fa1e8538d1 math.h: Remove support for old gcc versions
Remove support for old gcc versions by unconditionally defining
__MATH_BUILTIN_RELOPS and __MATH_BUILTIN_CONSTANTS. Per kib's request,
don't #undef those so it's easier to understand what the builtins are
doing.

Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45655
Sponsored by:		Netflix
2024-06-20 20:41:09 -06:00
Baptiste Daroussin
e402155e1a ncurses: reinstantiate bsd specific code
This fixes ncurses 6.5 badly reading termcap
2024-06-20 20:27:15 +02:00
Baptiste Daroussin
21817992b3 ncurses: vendor import version 6.5 2024-06-20 13:26:22 +02:00
Andrew Turner
6eeedf35c3 libc: Replace armv6 with armv7 in a comment
Armv6 is being removed from the treem and the comment applies to armv7.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45645
2024-06-20 09:26:22 +00:00
Brooks Davis
42c545c5f8 libsys: sort Symbol.map
Fixes:		7448408656 Make __libsys_interposing_slot libsys only
2024-06-19 23:08:05 +01:00
Brooks Davis
d511e97c54 libsysdecode: support rfork(RFSPAWN)
Match the "U" in RFSPAWN's value (1U<<31) (and "u" for completeness).
Reject kernel-only RFPPWAIT to avoid a duplicate entry.

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D45597
2024-06-19 21:38:31 +01:00
Pedro F. Giffuni
fc3907ce00 fparseln: Update license
Remove 3rd and 4th clauses in christos' license. OK christos.

Obtained from:	NetBSD
2024-06-15 18:30:27 -05:00
Pedro F. Giffuni
9a39435c0b Revert "fparseln: Update NetBSD version strings"
This reverts commit 1a968da448.

I was mistakenly looking at the version strings in the CVS attic
but the function was moved to libc/stdio where it matches the
current string.
2024-06-15 17:46:56 -05:00
Pedro F. Giffuni
1a968da448 fparseln: Update NetBSD version strings
The correponding changes (mostly ANSIfication) were done long ago locally.
No functional change.

Obtained from:	NetBSD (libutil CVS Attic)
2024-06-15 15:32:06 -05:00
Andrew Turner
b8a496dfb6 lib: Remove __ARM_ARCH checks that are always true
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45559
2024-06-12 11:49:05 +00:00
Ed Maste
e77ad954bb Revert "libm: fma: correct zero sign with small inputs"
This change introduced a test failure, so revert until that can be
addressed.

This reverts commit 888796ade2.

PR:		277783
Reported by:	rlibby
Sponsored by:	The FreeBSD Foundation
2024-06-11 21:36:12 -04:00
Ed Maste
92927b8bcf 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
2024-06-11 20:29:27 -04:00
Ryan Libby
e754909cb0 virstor: remove relation between chunk size and MAXPHYS
There's no reason why the virstor chunk size needs to relate to MAXPHYS.
Remove it.  Instead, just make sure that the chunk size is a multiple of
the sector size.

Reviewed by:	imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45518
2024-06-10 17:38:17 -07:00
Ryan Libby
a2fda816eb virstor: write large maps in chunks during label
During the initial label of a virstor device, write out the allocation
map in chunks if it is large (> 1 MB) in order to avoid large mallocs.

Even though the kernel virstor geom may still do a large malloc to
represent the allocation map, this may still be useful to avoid a
ulimit.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45517
2024-06-10 17:36:20 -07:00