NetBSD Problem Report #60783

From www@netbsd.org  Thu Sep 24 16:54:21 2026
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)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5833A1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 24 Sep 2026 16:54:21 +0000 (UTC)
Message-Id: <20260924165420.006BA1A923C@mollari.NetBSD.org>
Date: Thu, 24 Sep 2026 16:54:19 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: tty: missing siginfo_t in SIGIO
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60783
>Category:       kern
>Synopsis:       tty: missing siginfo_t in SIGIO
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 24 16:55:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, ...
>Organization:
Tty NetBSD Siginformation, Inc.
>Environment:
>Description:

	When a tty delivers SIGIO to a process, it's missing all the
	siginfo_t information -- si_code=SI_NOINFO and the other
	members are zeroed, because ttysigintr just uses
	pgsignal/psignal and not kpsignal/kpgsignal with a ksiginfo_t:

   3146 		switch (st) {
   3147 		case TTYSIG_PG1:
   3148 			if (pgrp != NULL)
   3149 				pgsignal(pgrp, sig, 1);
   3150 			break;
   3151 		case TTYSIG_PG2:
   3152 			if (pgrp != NULL)
   3153 				pgsignal(pgrp, sig, sess != NULL);
   3154 			break;
   3155 		case TTYSIG_LEADER:
   3156 			if (sess != NULL && sess->s_leader != NULL)
   3157 				psignal(sess->s_leader, sig);
   3158 			break;
   3159 		default:
   3160 			/* NOTREACHED */
   3161 			break;
   3162 		}

	https://nxr.netbsd.org/xref/src/sys/kern/tty.c?r=1.313#3146

	I'm also not convinced access ot tty_sigqueue is safe in
	ttysig!  That, or we should uncomment the XXXSMP assertion:

   3086 	/* XXXSMP not yet KASSERT(mutex_owned(&tty_lock)); */
   3087 
   3088 	sp = &tp->t_sigs[st];
   3089 	if (sigismember(sp, sig))
   3090 		return;
   3091 	sigaddset(sp, sig);
   3092 	if (tp->t_sigcount++ == 0)
   3093 		TAILQ_INSERT_TAIL(&tty_sigqueue, tp, t_sigqueue);
   3094 	softint_schedule(tty_sigsih);

	https://nxr.netbsd.org/xref/src/sys/kern/tty.c?r=1.313#3086

>How-To-Repeat:

	code inspection
	just try to use SIGIO with a tty

>Fix:

	Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.