NetBSD Problem Report #59225
From www@netbsd.org Thu Mar 27 00:43:52 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 40C641A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 27 Mar 2025 00:43:52 +0000 (UTC)
Message-Id: <20250327004351.12D0B1A923D@mollari.NetBSD.org>
Date: Thu, 27 Mar 2025 00:43:51 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: sysconf(3) is not async-signal-safe for some inputs
X-Send-Pr-Version: www-1.0
>Number: 59225
>Category: lib
>Synopsis: sysconf(3) is not async-signal-safe for some inputs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 27 00:45:00 +0000 2025
>Originator: Taylor R Campbell
>Release: current, 10, 9, ...
>Organization:
The SignalBSD Sysconfiguration
>Environment:
>Description:
For certain inputs, such as _SC_AIO_LISTIO_MAX, sysconf(3) internally calls sysctlgetmibinfo(3), which is not async-signal-safe (see PR lib/59147: sysctl: bounded-memory lookups by name <https://gnats.NetBSD.org/59147>).
>How-To-Repeat:
1. code inspection
2. call sysconf(3) from a signal handler that interrupts malloc(3)
>Fix:
Either:
1. Assign static numbers to all the sysctl nodes that sysconf(3) might query.
2. Fix PR 59147, either making sysctlgetmibinfo(3) async-signal-safe or adding an alternative that is async-signal-safe at the cost of lookup cache performance.
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.