NetBSD Problem Report #58389

From www@netbsd.org  Mon Jul  1 22:42:46 2024
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 9B4571A923A
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Jul 2024 22:42:46 +0000 (UTC)
Message-Id: <20240701224245.46A6D1A923C@mollari.NetBSD.org>
Date: Mon,  1 Jul 2024 22:42:45 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: syslog_r should be async-signal-safe
X-Send-Pr-Version: www-1.0

>Number:         58389
>Category:       lib
>Synopsis:       syslog_r should be async-signal-safe
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 22:45:00 +0000 2024
>Last-Modified:  Tue Jul 02 04:40:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The NetBSD_r Foundation
>Environment:
>Description:
openlog_r and closelog_r may clobber errno, even though they don't report errors to the caller through errno.  They should save and restore it instead.

syslog_r uses tzset, and strftime which also calls tzset.  This requires taking global locks and modifying global state.  syslog_r should avoid both of those.  Maybe it should just format timestamps in UTC, unconditionally.

syslog_r may also use certain vsnprintf format directives, like positional argument references, that trigger memory allocation.
>How-To-Repeat:
find a remote code execution flaw in openssh (CVE-2024-6387)
>Fix:
Yes, please!

>Audit-Trail:
From: SODA Noriyuki <soda@sra.co.jp>
To: gnats-bugs@netbsd.org, campbell+netbsd@mumble.net
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/58389: syslog_r should be async-signal-safe
Date: Tue, 2 Jul 2024 13:38:39 +0900

 There was some discussion about this in 2006:
 http://mail-index.netbsd.org/tech-userlevel/2006/10/oindex.html

 How about just using syslog_ss() which is already async-signal-safe?
 Please look at lib/58391 too.
 -- 
 soda

NetBSD Home
NetBSD PR Database Search

(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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.