NetBSD Problem Report #59357

From www@netbsd.org  Sat Apr 26 12:13:13 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 B02011A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Apr 2025 12:13:13 +0000 (UTC)
Message-Id: <20250426121312.660FA1A923E@mollari.NetBSD.org>
Date: Sat, 26 Apr 2025 12:13:12 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: t_semtimedop tests fail on kernels without SYSVSEM
X-Send-Pr-Version: www-1.0

>Number:         59357
>Category:       misc
>Synopsis:       t_semtimedop tests fail on kernels without SYSVSEM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 26 12:15:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The SemtimedopBSD Unimplementation
>Environment:
>Description:
kernel/t_semtimedop (103/985): 4 test cases
    semtimedop_basic: [4.947583s] Failed: Test program received signal 12 (core dumped)
    semtimedop_invalid: [3.325334s] Failed: Test program received signal 12 (core dumped)
    semtimedop_semundo: [0.030665s] Passed.
    semtimedop_timeout: [0.030409s] Failed: /usr/src/current/tests/kernel/t_semtimedop.c:151: WIFEXITED(status) not met
[8.349200s]
>How-To-Repeat:
cd /usr/tests/kernel
atf-run t_semtimedop | atf-report
>Fix:
Install a SIGSYS handler like t_sysv does to handle this case gracefully as atf_tc_skip rather than failure on signal.

    132 void
    133 sigsys_handler(int signo)
    134 {
    135 
    136 	did_sigsys = 1;
    137 }

https://nxr.netbsd.org/xref/src/tests/kernel/t_sysv.c?r=1.6#132

    413 	/*
    414 	 * Install a SIGSYS handler so that we can exit gracefully if
    415 	 * System V Semaphore support isn't in the kernel.
    416 	 */
    417 	did_sigsys = 0;
    418 	sa.sa_handler = sigsys_handler;
    419 	sigemptyset(&sa.sa_mask);
    420 	sa.sa_flags = 0;
    421 	ATF_REQUIRE_MSG(sigaction(SIGSYS, &sa, NULL) != -1,
    422 	    "sigaction SIGSYS: %d", errno);
    423 
    424 	semkey = get_ftok(4160);
    425 	ATF_REQUIRE_MSG(semkey != (key_t)-1, "get_ftok failed");
    426 
    427 	sender_semid = semget(semkey, 1, IPC_CREAT | 0640);
    428 	ATF_REQUIRE_MSG(sender_semid != -1, "semget: %d", errno);
    429 	write_int("sender_semid", sender_semid);
    430 
    431 	if (did_sigsys) {
    432 		atf_tc_skip("SYSV Semaphore not supported");
    433 		return;
    434 	}

https://nxr.netbsd.org/xref/src/tests/kernel/t_sysv.c?r=1.6#413

(There are probably other ways to do it like querying sysctl kern.ipc.sysvsem; this is just the mechanism that's already.)

And, while here, maybe just move the tests into t_sysv -- not sure why semtimedop is so different it requires being in a different test program from the semop tests; having them together strikes me as likely to be better for future maintenance to make it more obvious where all the applicable tests are.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 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.