NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60783: tty: missing siginfo_t in SIGIO



>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!




Home | Main Index | Thread Index | Old Index