Re: git: 3d12567133bf - main - Add the POSIX sig2str(3) & str2sig(3) calls

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Thu, 12 Jun 2025 02:56:21 UTC
On Wed, Jun 11, 2025 at 11:16:40PM +0000, Warner Losh wrote:
> The branch main has been updated by imp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=3d12567133bfb4082a5115f16a71a865ff2af7fb
> 
> commit 3d12567133bfb4082a5115f16a71a865ff2af7fb
> Author:     Ricardo Branco <rbranco@suse.de>
> AuthorDate: 2025-05-10 20:56:03 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2025-06-11 23:16:22 +0000
> 
>     Add the POSIX sig2str(3) & str2sig(3) calls
>     
>     Signed-off-by: Ricardo Branco <rbranco@suse.de>
>     Reviewed by: imp, kib, des, jilles
>     Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
> ---
>  include/signal.h          |   9 ++++
>  lib/libc/gen/Makefile.inc |   3 ++
>  lib/libc/gen/Symbol.map   |   2 +
>  lib/libc/gen/psignal.3    |  56 ++++++++++++++++++++++-
>  lib/libc/gen/sig2str.c    | 112 ++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 180 insertions(+), 2 deletions(-)
> 
> diff --git a/include/signal.h b/include/signal.h
> index c1d341f317f4..22fefb63568f 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -40,6 +40,10 @@
>  #include <sys/_ucontext.h>
>  #endif
>  
> +#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE
> +#define SIG2STR_MAX	32	/* size of buffer required for sig2str() */
> +#endif

Hey Warner and Ricardo,

The above breaks building world when _FORTIFY_SOURCE=2. I've committed
in HardenedBSD a fix:
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD/-/commit/0572db282c5a542fe0de52739932e91eade537ed

I suppose that the !defined gate might not actually be desired, since
doing it the way I did might cause issues if third-party code defines
the macro to a value smaller than what libc was built with. I might
remove that gate.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Signal Username:  shawn_webb.74
Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc