#
d0b74459 |
| 13-Jul-2024 |
Kyle Evans <kevans@FreeBSD.org> |
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.
Rev
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
show more ...
|
#
4a86b26b |
| 21-Jun-2024 |
Warner Losh <imp@FreeBSD.org> |
stdlib: Support compiling with tinyc by omitting compat qsort code
TinyC doesn't support the .symver assembler directive. Add a generic way to signal this and use that not to define __sym_() macros
stdlib: Support compiling with tinyc by omitting compat qsort code
TinyC doesn't support the .symver assembler directive. Add a generic way to signal this and use that not to define __sym_() macros that use it. Only use the __sym_* macros in headers when they are defined (which currently is only for the qsort_r compat code. Not supporting this for tcc is fine: It's an edge case for legacy binaries / code anyway which isn't relevant to tinyc.
Sponsored by: Netflix Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45651
show more ...
|
#
39c4f65c |
| 02-Jun-2024 |
Brooks Davis <brooks@FreeBSD.org> |
stddef.h/stdlib.h: Remove unused rune_t
This non-standard type is unused in the base system (__ct_rune_t or __rune_t are used instead) and ports. It has been around as long as our current source re
stddef.h/stdlib.h: Remove unused rune_t
This non-standard type is unused in the base system (__ct_rune_t or __rune_t are used instead) and ports. It has been around as long as our current source repo, but we have avoided using it. In sys/_types.h where the __*rune_t typedefs are defined, the following appears in a comment:
NOTE: rune_t is not covered by ANSI nor other standards, and should not be instantiated outside of lib/libc/locale. Use wchar_t.
The definition of this unused type meant we gratutiously differed from standards compliant stddef.h/stdlib.h.
PR: 279357 (exp-run by antoine)
Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D45426
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
d56a6f05 |
| 02-Feb-2024 |
Warner Losh <imp@FreeBSD.org> |
stdlib.h: Partially revert c27a89971805
quick_exit() can call other functions, and we don't guarantee it calls std::terminate should those other functions throw exceptions. And to make it do so has
stdlib.h: Partially revert c27a89971805
quick_exit() can call other functions, and we don't guarantee it calls std::terminate should those other functions throw exceptions. And to make it do so has ABI complications for libc. Until that's sorted out, revert this noexcept (but leave a comment behind so people will find this commit message)
Requested by: kib
Sponsored by: Netflix
show more ...
|
#
c27a8997 |
| 02-Feb-2024 |
Lexi Winter <lexi@le-Fay.ORG> |
stdlib.h: add __noexcept to prototypes
The noexcept specifier is required on these functions in C++: _Exit(), atexit(), quick_exit(), at_quick_exit(), abort().
MFC after: 2 weeks
Reviewed by: imp
stdlib.h: add __noexcept to prototypes
The noexcept specifier is required on these functions in C++: _Exit(), atexit(), quick_exit(), at_quick_exit(), abort().
MFC after: 2 weeks
Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1085
show more ...
|
#
5a1d1441 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
include: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a pe
include: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
Revision tags: release/14.0.0 |
|
#
42b38843 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
#
bb8e8e23 |
| 20-Apr-2023 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."
Some points for the future: - libc is not the right place for sorting algorithms. Probably libutil is better suited for thi
Revert "libc: Implement bsort(3) a bitonic type of sorting algorithm."
Some points for the future: - libc is not the right place for sorting algorithms. Probably libutil is better suited for this purpose or a dedicated libsort. Should move all sorting algorithms away from libc eventually. - CheriBSD uses capabilities for memory access, and could benefit from a standard memswap() function. - Do something about qsort() in FreeBSD's libc like: - Mark it deprecated on FreeBSD, as a first step, due to missing limits on CPU time. - Audit the use of qsort() in the FreeBSD base system and consider swapping to other existing sorting algorithms.
Discussed with: brooks@
Differential Revision: https://reviews.freebsd.org/D36493
This reverts commit a7469c9c0a504a5e6e9b89e148cd78df5e67ff7f. This reverts commit 7d65a450cdcc7cc743f2ecd114ba3428a21c0033. This reverts commit 8dcf3a82c54cb216df3213a013047907636a01da.
show more ...
|
#
a7469c9c |
| 19-Apr-2023 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
libc: bsort_s() requires both __BSD_VISIBLE and __EXT1_VISIBLE
Fixes build of Python: /usr/include/stdlib.h:409:1: error: unknown type name 'errno_t' errno_t bsort_s(void *, rsize_t, rsize_t,
Repo
libc: bsort_s() requires both __BSD_VISIBLE and __EXT1_VISIBLE
Fixes build of Python: /usr/include/stdlib.h:409:1: error: unknown type name 'errno_t' errno_t bsort_s(void *, rsize_t, rsize_t,
Reported by: vishwin@ MFC after: 1 week Sponsored by: NVIDIA Networking Differential Revision: https://reviews.freebsd.org/D36493
show more ...
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
8dcf3a82 |
| 08-Sep-2022 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
libc: Implement bsort(3) a bitonic type of sorting algorithm.
The bsort(3) algorithm works by swapping objects, similarly to qsort(3), and does not require any significant amount of additional memor
libc: Implement bsort(3) a bitonic type of sorting algorithm.
The bsort(3) algorithm works by swapping objects, similarly to qsort(3), and does not require any significant amount of additional memory.
The bsort(3) algorithm doesn't suffer from the processing time issues known the plague the qsort(3) family of algorithms, and is bounded by a complexity of O(log2(N) * log2(N) * N), where N is the number of elements in the sorting array. The additional complexity compared to mergesort(3) is a fair tradeoff in situations where no memory may be allocated.
The bsort(3) APIs are identical to those of qsort(3), allowing for easy drop-in and testing.
The design of the bsort(3) algorithm allows for future parallell CPU execution when sorting arrays. The current version of the bsort(3) algorithm is single threaded. This is possible because fixed areas of the sorting data is compared at a time, and can easily be divided among different CPU's to sort large arrays faster.
Reviewed by: gbe@, delphij@, pauamma_gundo.com (manpages) Sponsored by: NVIDIA Networking Differential Revision: https://reviews.freebsd.org/D36493
show more ...
|
#
a06761e3 |
| 15-Mar-2023 |
Warner Losh <imp@FreeBSD.org> |
secure_getenv: Put under __BSD_VISIBLE
Sponsored by: Netflix Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D39076
|
#
adeca214 |
| 13-Mar-2023 |
lucy <seafork@disroot.org> |
Add GNU glibc compatible secure_getenv
Add mostly glibc and msl compatible secure_getenv. Return NULL if issetugid() indicates the process is tainted, otherwise getenv(x). The rational behind this
Add GNU glibc compatible secure_getenv
Add mostly glibc and msl compatible secure_getenv. Return NULL if issetugid() indicates the process is tainted, otherwise getenv(x). The rational behind this is the fact that many Linux applications use this function instead of getenv() as it's widely consider a, "best practice".
Reviewed by: imp, mjg (feedback) Pull Request: https://github.com/freebsd/freebsd-src/pull/686 Signed-off-by: Lucy Marsh <seafork@disroot.org>
show more ...
|
#
ce7db385 |
| 22-Feb-2023 |
Elyes Haouas <ehaouas@noos.fr> |
include: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
|
#
e5dc4093 |
| 27-Jan-2023 |
John Baldwin <jhb@FreeBSD.org> |
Revert "stdlib.h: Fix qsort_r compatibility with GCC 12."
This reverts commit 43703bc489ec504b947b869045c492ed38c1a69c.
Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D38216
|
#
43703bc4 |
| 19-Jan-2023 |
John Baldwin <jhb@FreeBSD.org> |
stdlib.h: Fix qsort_r compatibility with GCC 12.
GCC 12 (unlike GCC 9) does not match a function argument passed to the old qsort_r() API (as is used in the qsort_r_compat test) to a function pointe
stdlib.h: Fix qsort_r compatibility with GCC 12.
GCC 12 (unlike GCC 9) does not match a function argument passed to the old qsort_r() API (as is used in the qsort_r_compat test) to a function pointer type via __generic. It treats the function type as a distinct type from a function pointer. As a workaround, add a second definition of qsort_r for GCC 12 which uses the bare function type.
Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37410
show more ...
|
#
af3c7888 |
| 01-Oct-2022 |
Ed Schouten <ed@FreeBSD.org> |
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
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
show more ...
|
Revision tags: release/13.1.0, release/12.3.0 |
|
#
597b0267 |
| 07-Nov-2021 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
libc: add clearenv function
The clearenv(3) function allows us to clear all environment variable in one shot. This may be useful for security programs that want to control the environment or what va
libc: add clearenv function
The clearenv(3) function allows us to clear all environment variable in one shot. This may be useful for security programs that want to control the environment or what variables are passed to new spawned programs.
Reviewed by: scf, markj (secteam), 0mp (manpages) Differential Revision: https://reviews.freebsd.org/D28223
show more ...
|
Revision tags: release/13.0.0 |
|
#
60b426f4 |
| 25-Oct-2020 |
Warner Losh <imp@FreeBSD.org> |
Remove obsolete check for GCC < 3 and support for Intel Compiler
We no longer support old versions of GCC. Remove this check by assuming it's false. That will make the entire expression false. Also
Remove obsolete check for GCC < 3 and support for Intel Compiler
We no longer support old versions of GCC. Remove this check by assuming it's false. That will make the entire expression false. Also remove support for Intel compiler, it's badly bitrotted. Technically, this removes support for C89 and K&R from compilers that don't define _Bool in those compilation environments as well. I'm unaware of any working compiler today for which that would be relevant (pcc has it and tcc sadly isn't working for other reasons), though if one pops up in ports, I'll work to resolve the issue.
show more ...
|
Revision tags: release/12.2.0 |
|
#
5011fb43 |
| 20-Oct-2020 |
Xin LI <delphij@FreeBSD.org> |
Further refinements of ptsname_r(3) interface:
- Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposin
Further refinements of ptsname_r(3) interface:
- Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposing of ptsname_r(3) from an user application from breaking ptsname(3) by making the implementation a static method and call the static function from ptsname(3) instead.
Reported by: kib Reviewed by: kib, jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26845
show more ...
|
#
3e7224df |
| 17-Oct-2020 |
Xin LI <delphij@FreeBSD.org> |
Implement ptsname_r.
MFC after: 2 weeks PR: 250062 Reviewed by: jilles, 0mp, Ray <i maskray me> Differential Revision: https://reviews.freebsd.org/D26647
|
Revision tags: release/11.4.0 |
|
#
8be7eb94 |
| 01-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r357368 through r357388.
|
#
672e1225 |
| 01-Feb-2020 |
Conrad Meyer <cem@FreeBSD.org> |
rand(3): Replace implementation with one backed by random(3) algorithm
rand(3)'s standard C API is extremely limiting, but we can do better than the historical 32-bit state Park-Miller LCG we've shi
rand(3): Replace implementation with one backed by random(3) algorithm
rand(3)'s standard C API is extremely limiting, but we can do better than the historical 32-bit state Park-Miller LCG we've shipped since 2001: r73156.
The justification provided at the time for not using random(3) was that rand_r(3) could not be made to use the same algorithm. That is still true. However, the irrelevance of rand_r(3) is increasingly obvious. Since that time, POSIX has marked the interface obsolescent. rand_r(3) never became part of the standard C library. If not for API compatibility reasons, I would just remove rand_r(3) entirely.
So, I do not believe it is a problem for rand_r(3) and rand(3) to diverge.
The 12 ABI is maintained with compatibility definitions, but this revision does subtly change the API of rand(3). The sequences of pseudorandom numbers produced in programs built against new versions of libc will differ from programs built against prior versions of libc.
Reviewed by: kevans, markm MFC after: no Relnotes: yes Differential Revision: https://reviews.freebsd.org/D23290
show more ...
|
#
53d2936c |
| 20-Jan-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r356848 through r356919.
|
#
0d2fabfc |
| 20-Jan-2020 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
Add qsort_s(3). Apart from the constraints, it also makes it easier to port software written for Linux variant of qsort_r(3).
Reviewed by: kib, arichardson MFC after: 2 weeks Relnotes: yes Sponsore
Add qsort_s(3). Apart from the constraints, it also makes it easier to port software written for Linux variant of qsort_r(3).
Reviewed by: kib, arichardson MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D23174
show more ...
|
#
482f0c02 |
| 15-Dec-2019 |
Conrad Meyer <cem@FreeBSD.org> |
Revert r355760, r355759
And remove the inline/deprecated attribute use entirely in stdlib.h, from r355747. The intent was to provide a buildable API transitionary period, but clearly that was count
Revert r355760, r355759
And remove the inline/deprecated attribute use entirely in stdlib.h, from r355747. The intent was to provide a buildable API transitionary period, but clearly that was counter-productive.
Reported by: delphij, imp, others
show more ...
|