Log

Author Commit Date CI Message
Guillem Jover 7aed0edf 2021-12-02T00:35:05 man: Add missing comma in .Dd for tree(3) Reported-by: Thorsten Glaser <tg@mirbsd.de>
Guillem Jover fafcc397 2021-11-30T04:00:54 man: Update tree(3) man page from OpenBSD This man page has a BSD-3-clause-author license instead of the old BSD-4-clause license.
Guillem Jover 48107fc8 2021-11-28T23:19:16 build: Clarify link-time warnings Mention the involved function instead of stating an implicit "this function". Mention libbsd when proposing using an alternative libmd to make the context clear.
Guillem Jover e7cf8c57 2021-11-28T22:44:08 Switch md5 compatibility logic back to direct linking When using the recent dlsym() based wrapper, we are not requiring any symbol from libmd, as we resolve those dynamically at run-time. We were ending up linking against libmd because in another part of the code we require (depending on the architecture) the SHA512 functions for the getentropy() local implementation. But that function might be provided by the system libc on some systems, which means we end up not linking against libmd at all. To solve this we go back to the previous simpler solution of linking directly, which had the main drawback of then making programs fail to link when not specifying -lmd (on platforms that need it). And then switch the .so link point from a symlink to a linker script, so that we can inject the -lmd library as-needed. This is similar to what glibc is doing. Fixes: commit 31f034e3862debda8615a449b1c11c4d6920dcc7
Guillem Jover 25d35625 2021-11-28T22:40:58 build: Split libmd dependency due to MD5 functions from SHA requirements To be able to rework the md5 deprecation logic, we need to detangle when we depend on libmd due to requiring MD5 functions, which might be otherwise provided by libc, or when we require SHA functions for the internal getentropy() implementation.
Guillem Jover 500b3080 2021-11-28T22:34:59 build: Add new libbsd_symver_weak() macro We will use it for the reworked md5 deprecation logic.
Guillem Jover 8ad7570c 2021-11-27T21:07:00 getentropy: Add missing prototype for BSD variant Warned-by: gcc
Guillem Jover 1eba4060 2021-11-27T21:09:18 test: Check that strdup() does not fail Warned-by: gcc
Guillem Jover 43a82703 2021-11-27T20:26:05 nlist: Remove condition which is always true The nlist() function is limited to handle ELF binaries of the same class as size as the size_t of the architecture built. In addition the SIZE_T_MAX macro is BSD specific, and was falling back to the wrong constant on most 64-bit non-BSD systems. Warned-by: gcc
Guillem Jover 6a71b24b 2021-11-27T22:52:28 build: Append __ after __attribute and __typeof keywords Be consistent with other usages in the code base.
Guillem Jover 7389fe8d 2021-11-27T06:54:49 build: Ignore backup files
Victor Westerhuis 2716dfd0 2021-11-26T20:24:20 test: Explicitly mark symbols as used Because some of the symbols are not otherwise referenced, GCC would like to remove them. Closes: !14 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Victor Westerhuis 54f87456 2021-11-26T20:01:18 build: Enable .init_array support when building with LTO Because these symbols are not otherwise referenced, GCC would like to remove them. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 1808d64b 2021-03-01T05:14:10 test: Fix pipe_feed() to allow checking fprintf format strings Warned-by: gcc -W
Guillem Jover beafad26 2021-03-07T00:22:59 build: Add missing proctitle unit test program
Guillem Jover 6145b561 2021-08-17T03:14:57 test: Do not pass NULL as the first funopen() argument Warned-by: gcc -W
Guillem Jover 731b0a77 2021-08-17T02:59:59 build: Detect sed at configure time Check whether sed is available and use the implementation matching the requirements via the SED variable.
Guillem Jover 50b50a43 2021-03-02T05:18:04 vis: Add prototypes for strnvis() and strnunvis() variants Warned-by: gcc
Guillem Jover 25e88f64 2021-03-02T00:48:31 test: Cast literal strings to (char *) on n_name assignment The member is declared as n_name so we cannot directly assign a literal string constant. Warned-by: gcc
Guillem Jover 04a8fb24 2021-03-02T00:48:02 Add missing prototypes to functions Warned-by: gcc
Guillem Jover 4f68a88f 2021-02-19T06:55:17 build: Add compiler warnings support Detect as many warnings as possible during configure and enable them if the user did not supply any, so that any such problem can be spotted and fixed.
Guillem Jover 428be9e0 2021-10-07T23:08:42 man: Fix .Nx macro usage Its arguments are used as version numbers, so we need continue the content on the next line.
Alexander Miller c7a5d780 2021-09-30T03:39:57 build: Allow building with -flto on gcc-10 and newer Global asm statements (like .symver directives) do not work reliably in gcc with link time optimization. Use the symver attribute introduced with gcc-10 to set symbol versions instead, if available. [guillem@hadrons.org: - Simplify by using __has_attribute fallback from <sys/cdefs.h>. - Coding style changes. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 8f59221c 2021-02-19T06:51:18 nlist: Remove repeated shadowing variable declaration Warned-by: gcc
Guillem Jover 72a82ee2 2021-02-20T22:22:54 getentropy: Fix function cast for getauxval() Warned-by: gcc
Guillem Jover 3c305f28 2021-02-19T06:49:53 test: Add proper prototypes for main() function Warned-by: gcc
Guillem Jover 25278891 2021-02-19T06:49:24 Mark local functions as static Warned-by: gcc
Guillem Jover e35d9141 2021-02-11T04:41:46 Add link-time warnings to MD5 wrapper functions Let's get the word out that these functions are deprecated and should be switched away from.
Guillem Jover 4feda870 2021-02-11T04:40:48 Require a semicolon for libbsd_link_warning() macro Remove the semicolon in the macro definition to force adding one on the call sites, to make the code look like an actual function.
Guillem Jover d563a174 2021-02-18T23:38:30 man: Call the libbsd-ctor library by its name instead of bsd-ctor
Guillem Jover 785cf9d1 2021-02-18T23:38:30 man: Fix pkg-config(1) references in libbsd(7) man page
Guillem Jover 15bd284b 2021-02-28T05:16:01 build: Add code coverage support in the GitLab CI
Guillem Jover a9fc2859 2021-02-28T05:14:54 build: Use apt-get instead of apt in the GitLab CI The former is to be used programmatically, while the latter is intended for interactive use.
Guillem Jover c0d86a64 2021-02-09T08:35:36 build: Add a Libs.private field to overlay pkg-config file We need to list all internal libraries there so that we can statically link. Fixes: commit 2374f409defb380d0c5c07f28b9c166ef8bdc742
Guillem Jover 1fb25b7d 2021-02-09T06:14:25 Release libbsd 0.11.3
Guillem Jover 31f034e3 2021-02-09T05:57:37 Switch libmd wrapper to use dlsym() Switch from the previous versioned symbol implementation which required users to also link against the message digest provider explicitly, or they would fail to find the symbols, to an implementation that loads the symbols from the linked library providing the functions using dlsym(), thus preserving backwards compatibility.
Guillem Jover 2374f409 2021-02-09T05:56:49 build: Add a Libs.private field to pkg-config file We need to list all internal libraries there so that we can statically link.
Guillem Jover a4e0db2b 2021-02-09T06:04:38 build: Use a single variable to track libraries to link against Using various variables means we have to keep these in sync in various places. Just use a single variable that we can use anywhere where this is needed.
Guillem Jover 43d34c9d 2021-02-09T06:02:46 build: Fix message digest library checks They were not failing when not finding the SHA-2 functions and were hardcoding -lmd regardless of what library had been found.
Guillem Jover 1c3ff616 2021-02-09T02:46:49 Use uintptr_t and size_t instead of __-prefixed types in <sys/cdefs.h> The __-prefixed types cannot be assumed to be defined. Use the standard types instead. Closes: #6
Guillem Jover edea268c 2021-02-08T03:59:56 Release libbsd 0.11.2
Guillem Jover e832b768 2021-02-08T03:45:06 closefrom: Use close_range() on Linux when available Closes: !11 Based-on-patch-by: cptpcrd <cptpcrd.git@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
cptpcrd c4fca5bb 2021-02-07T14:22:21 closefrom: Handle lowfd < 0 properly More important if close_range() is going to be used, since casting negative values to 'unsigned int' might hide the errors. [guillem@hadrons.org: Minor coding style fix. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover a1f79978 2021-02-08T02:52:50 closefrom: Import some changes from sudo Take most of the changes done in sudo, but preserve the existing local changes and refactoring. In addition, refactor pstat implementation into closefrom_pstat(), so that the code is easier to read, and requires no conditional declarations.
Faidon Liambotis 46760262 2021-02-07T20:47:00 Update <sys/queue.h> from FreeBSD This brings <sys/queue.h> to the most up-to-date version from FreeBSD, incorporating 18 commits from the past 5 years (2015-02-24 - 2021-01-25): $ git log --oneline 9090a24aed70..8d55837dc133 sys/sys/queue.h share/man/man3/queue.3 Only minimal changes compared to the FreeBSD version have been applied (queue.3 -> queue.3bsd, _LIBBSD_ prefix). [guillem@hadrons.org: Remove reference to kernel mode in man page. ] Closes: !12 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 25f9b306 2021-02-07T23:24:51 test: Improve code coverage for strnstr(3) unit tests
Guillem Jover 18ebabf2 2021-02-07T10:56:51 man: Update libbsd(7) man page with updates in 0.11.0
Guillem Jover 4ab11c7f 2021-02-07T10:37:18 build: Install libmd-dev in the gitlab CI
Guillem Jover 766c883e 2021-02-07T10:35:57 build: Switch gitlab CI to use a Debian buster
Guillem Jover a4de4d95 2021-02-07T02:03:59 Release libbsd 0.11.1
Guillem Jover 233cab9d 2021-02-06T23:28:42 Add support for new LIBBSD_VIS_OPENBSD selection macro This will make it possible to explicitly select the OpenBSD vis implementation (the current default) for code of OpenBSD origins.
Guillem Jover 2462cd88 2021-02-07T00:23:43 Release libbsd 0.11.0
Guillem Jover d54ceb37 2021-02-07T00:09:45 Update copyright claims
Guillem Jover 847e682f 2021-02-07T00:09:30 Use libmd hashing function implementations instead of embedding our own This splits the implementation responsibilities, and reduces embedded code copies, which was one of the driving points with this project to start with, so it's nice to give a good example.
Aaron Dierking 68f980c9 2018-07-05T14:47:47 Provide a default progname on Windows [guillem@hadrons.org: - Remove .exe extension from default program name. - Call reallocarray() once by switching to a «do {} while» loop. - Minor coding style fixes. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 37a9b56c 2021-02-06T23:43:12 Import pwcache module from OpenBSD
Guillem Jover 45dd5229 2021-02-07T01:27:51 man: Remove empty line in reallocarray(3bsd) Warned-by: lintian Fixes: commit 01f0d1ea1e71f1018a009ebd9203dd48e6d90c45
Faidon Liambotis 01f0d1ea 2020-12-31T12:46:03 Add recallocarray() and freezero() from OpenBSD Add recallocarray(), introduced in OpenBSD 6.1, and freezero(), introduced in OpenBSD 6.2. The former is imported as-is from OpenBSD, while the latter is the non-malloc-internal branch of the same code (and also the OpenSSH portable variant). Both of these originated in OpenBSD, but have also been implemented by IllumOS, cf. https://www.illumos.org/issues/8546 Documentation for these functions is in malloc(3) upstream, the relevant parts of which were previously imported in reallocarray(3bsd). Update reallocarray(3bsd) with the changes that were introduced since, and add the relevant bits for recallocarray() and freezero(), plus aliases. [guillem@hadrons.org: Update copyright in COPYING. ] Closes: !10 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Seth R Johnson 9c85d828 2019-11-14T07:26:41 Fix ELF detection on Intel compilers The Intel compiler does not define __amd64__ on x86_64 platforms; instead, like other compilers, it defines __x86_64__ . Closes: !8 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover eac4ce0c 2020-09-20T03:30:20 man: Add a timespec(3bsd) alias to timeval(3bsd) Even though man-pages project now includes man pages for system data types, we still include these for any other system that does not have them, to provide a self-contained project with code and documentation.
Guillem Jover cfeafeab 2020-08-16T21:58:04 funopen: Fix memory leak in funopen_close() when closefn is NULL We need to free the cookiewrap even when the closefn method is NULL. Warned-by: gcc ASAN
Guillem Jover 5ecff0c9 2020-09-16T23:41:28 man: Add missing LIBRARY section
Guillem Jover 8c5a83d6 2020-09-20T03:32:57 Fix coding style
Guillem Jover d5b04ab1 2020-08-16T22:01:42 test: Fix short lived memory leaks These are non-issues, but having a clean ASAN test suite makes it possible to detect actual problems in the tested code. Warned-by: gcc ASAN
Guillem Jover 3d6b6ead 2019-11-16T00:04:18 build: Detect support for --version-script in ld
Guillem Jover eb445425 2019-08-12T23:52:10 Do not define SIZE_T_MAX if already defined
Guillem Jover 59f6a956 2019-08-12T23:25:20 man: Add missing doc-operating-system-NetBSD string variable Fixes: commit 99320b9168ffb0112def1a712e8d59441d1b46d9.
Guillem Jover 3548c5f6 2019-08-26T05:39:17 Add missing strnvisx() to the symbols script Fixes: commit 2d7de186e9cb19a756c0630ee85cb3f2d29b3484.
Guillem Jover a11c98a6 2019-08-07T18:34:09 Release libbsd 0.10.0
Guillem Jover 5745ca03 2019-08-06T15:49:41 err: Add err(), warn(), errx() and warnx() familiy of functions Some systems such as Windows or musl-libc based ones do not have these BSD extensions. In addition libbsd itself is making use of the warnx() functions, so we better provide these interfaces in case they are missing.
Guillem Jover 9628798d 2019-08-06T15:37:43 err: Rewrite warnc() and errc() family functions to be standalone Do not depend on the system vwarn() and verr() functions to implement the *c() variants, as the system might actually lack any of the <err.h> BSD extensions.
Guillem Jover f34a5f71 2019-08-06T15:29:54 err: Mark error functions as non-returning with __dead2
Michael Shigorin 72c68868 2019-08-07T00:02:09 Add e2k support for nlist() This is a Russian 64-bit LE VLIW architecture named Elbrus (formerly Elbrus 2000). [guillem@hadrons.org: - Place the entry in alphabetical order. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Frank Schaefer a4323f2b 2019-05-28T16:04:54 Add AArch64 ILP32 support to nlist() Closes: !7 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Rosen Penev 4997efa5 2019-05-17T01:44:56 Add ARC support to nlist() Closes: !6 Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 96202c6c 2019-08-07T00:00:15 Add a comment to note the ELF entries are sorted alphabetically This should help people wanting to add new entries.
James Clarke 61d378f5 2019-02-03T00:11:15 Re-allow direct use of nlist.n_name in <nlist.h> Commit e8d340de ("Remove a.out support from nlist()") introduced a copy of the definition of nlist from a.out.h. However, as well as having n_name inside n_un, on the various BSDs n_name could also be accessed as a direct member of nlist, and this is made use of by FreeBSD's usr.bin/netstat/main.c. Thus we should also add the same enclosing anonymous union. [guillem@hadrons.org: - Add a minimal unit test. ] Closes: !4 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 9d917aad 2019-08-07T22:58:30 nlist: Fix out-of-bounds read on strtab When doing a string comparison for a symbol name from the string table, we should make sure we do a bounded comparison, otherwise a non-NUL terminated string might make the code read out-of-bounds. Warned-by: coverity
Guillem Jover 18662cad 2019-06-15T14:33:32 nlist: Fix unbounded malloc() calls There are a couple of malloc() calls with unbounded size arguments, coming from the parsed file. We need to make sure the size is not larger than the file being parsed, otherwise we might end up with out of memory conditions. Reported-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover ce53f7c2 2019-06-15T14:33:32 nlist: Fix pread() return value check We should check for partial reads, and not continue in those cases, as we are not retrying them, otherwise we might end up operating on uninitialized data. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 24d1f4dd 2019-06-15T14:33:32 nlist: Check whether sh_link is within bounds The sh_link members should be >= e_shnum, otherwise we might do out of bounds read accesses on the shdr array. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e9529d9b 2019-06-15T14:33:32 nlist: Check that e_shnum and e_shentsize are within bounds The e_shnum must not be 0, otherwise we will do a zero sized allocation and further processing of the executable will lead to out of bounds read/write accesses. The e_shentsize must be equal to sizeof(Elf_Shdr), otherwise we will perform out of bounds read accesses on the shdr array. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 3aaedb12 2019-06-15T14:33:32 nlist: Check whether the nl argument is not NULL This prevents programming errors. Reported-by: Daniel Hodson <daniel@elttam.com.au> Based-on-patch-by: Daniel Hodson <daniel@elttam.com.au> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 2c754f43 2019-07-31T03:49:43 man: Add man page sections to function references Signed-off-by: Guillem Jover <guillem@hadrons.org>
Sebastian ee4d2497 2019-03-10T10:03:12 man: Fix typo Closes: !5 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 8d2afa3a 2019-07-31T03:49:24 man: Fix typos Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e9f6faf3 2019-07-31T03:02:38 man: Replace references to a.out(5) with elf(5) The a.out(5) support in nlist(3) got removed some time ago, and there is now only elf(5) support. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 99320b91 2019-06-13T23:43:57 man: Define doc-operating-system-NetBSD string variables This way we do not depend on the installed groff being new enough. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 71c710e9 2019-06-13T23:42:49 man: Use major.minor version for .Nx macros The macro only recognizes this version form, and not just major alone. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 21f4052c 2019-06-13T23:36:09 man: Add doc-str-Lb-libbsd aliases for str-Lb-libbsd groff(1) has changed the internal layout for the .Lb doc strings, but to preserve backwards compatibility we cannot simply rename them, we need to create new aliases so that these will work with old and new macros. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 1899e2c5 2019-07-31T02:58:01 Update TODO Signed-off-by: Guillem Jover <guillem@hadrons.org>
Aaron Dierking 48033408 2018-06-14T11:38:32 Provide a <sys/param.h> with MIN() and MAX() Windows doesn't provide <sys/param.h>. Several libbsd sources require it for MIN(), and these are useful non-system-specific macros anyway. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Aaron Dierking f99b8ea5 2018-06-14T11:38:33 build: Disable CRT warnings on Windows These warnings are not helpful for libbsd. [guillem@hadrons.org: - Rename WINDOWS conditional to OS_WINDOWS. - Add a nil terminator to the AM_CPPFLAGS. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Aaron Dierking 4bed4839 2018-06-14T11:38:32 build: Detect Windows/MinGW at configure time Extend the host OS checks to define an OS_WINDOWS automake conditional if the host is MinGW-like. This will be useful for future Windows-specific build tweaks. [guillem@hadrons.org: - Rename WINDOWS conditional to OS_WINDOWS. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 2e071c3c 2019-08-06T19:14:29 build: Support platforms without symbol versioning The .symver directive is ELF-specific. On non-ELF platforms, work around this with __attribute__((__alias__)) for the default symbol, and ignore the variant versioned symbols. Based-on-patch-by: Aaron Dierking <aarond@fb.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 890699a7 2019-08-06T18:51:45 build: Abstract symbol versioning via new libbsd_symver_* macros This makes it more obvious what they are doing. It will make it easier to make these directives more portable, as they are really ELF specific.
Guillem Jover b0ebb0d4 2019-08-06T23:16:42 build: Use __register_atfork() only if really available This is a glibc-specific symbol that has no public declaration. But is being used by the OpenBSD and this implementation as a hack to avoid having to link against the pthread library. This interface is at least included in LSB 5.0 [L], and using pthread_atfork() is otherwise problematic anyway [P]. [L] <https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---register-atfork.html> [P] <http://austingroupbugs.net/view.php?id=851> One problem is that we were using it whenever __GLIBC__ is defined, which is supposed to be defined only on an actual glibc, but uClibc defines that macro, but it does not provide the symbol on its noMMU variant. We add a new configure check that will try to link a program that uses that symbol to make sure it is present. Closes: !2 Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Guillem Jover 73aea4f8 2019-08-06T23:11:50 build: Fix check for clock_gettime() within librt The check was always setting the libraries to link to include -lrt, as the success case includes the builtin one. Handle the various values.
Aaron Dierking 7cfa2d45 2018-06-14T11:38:31 Correct Clang feature detection Clang's __GNUC__ and __GNUC_MINOR__ definitions are not reliable and may not be defined at all when targeting the MSVC ABI. Use feature-checking macros when possible or check for __clang__. [guillem@hadrons.org: Update for __ protected keyword change. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 574c7a13 2018-06-18T00:36:44 Protect C language extensions with two leading and trailing underscores This should make their usage safer against user macros.