NetBSD Problem Report #59009

From www@netbsd.org  Sun Jan 19 10:36:05 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 30CA91A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 Jan 2025 10:36:05 +0000 (UTC)
Message-Id: <20250119103603.AA7001A923B@mollari.NetBSD.org>
Date: Sun, 19 Jan 2025 10:36:03 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: pbulk-build SIGSEGV on null pointer dereference
X-Send-Pr-Version: www-1.0

>Number:         59009
>Category:       pkg
>Synopsis:       pbulk-build SIGSEGV on null pointer dereference
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    joerg
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 19 10:40:00 +0000 2025
>Last-Modified:  Tue Jun 23 15:00:02 +0000 2026
>Originator:     Taylor R Campbell
>Release:        2024Q4
>Organization:
The NetBulkbuilD Foundacrash
>Environment:
>Description:
Resolving...
Building...
Initialisation complete.
[1245/28443] Starting build of  cwrappers-20220403
pbulk-build: Premature end of stream while reading path from socket
[1]   Segmentation fault (core dumped) ${pbuild} -r ${loc}/pbuild -I ${pbuild_start_s...

$ gdb /pbulk/2024Q4/pkg/bin/pbulk-build ./pbulk-build.core
...
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000001d60389c in send_build_info (arg=0x7b40d8c92270) at master.c:128
128     master.c: No such file or directory.
(gdb) info locals
peer = 0x7b40d8c92270
(gdb) print peer->job
$1 = (struct build_job *) 0x0
(gdb) print *peer
$2 = {peer_link = {le_next = 0x0, le_prev = 0x1d80f328 <inactive_peers>}, job = 0x0, fd = 9, tmp_buf = "\000\000\021h", buf = 0x0}
(gdb) print active_peers
$3 = {lh_first = 0x7b40d8c92270}
(gdb) print *active_peers->lh_first
$4 = {peer_link = {le_next = 0x0, le_prev = 0x1d80f328 <inactive_peers>}, job = 0x0, fd = 9, tmp_buf = "\000\000\021h", buf = 0x0}
(gdb) print inactive_peers
$5 = {lh_first = 0x7b40d8c92270}
(gdb) print active_peers.lh_first == inactive_peers.lh_first
$6 = 1
(gdb) print unassigned_peers 
$7 = {lh_first = 0x0}
(gdb) print clients_started
$8 = 1
(gdb) print child_event
$9 = {sig_link = {le_next = 0x0, le_prev = 0x1d80f3c8 <all_signals>}, sig_id = 20, sig_received = 0, sig_handler = 0x1d603be1 <child_handler>}
(gdb) print child_pid
$10 = 278

master.c:

   128          deferred_write(peer->fd, peer->job->begin, peer->job->end - peer->job->begin, peer, recv_status,
   129              kill_peer);

It is curious that both active_peers and inactive_peers point to the same peer.  This seems suboptimal.

Have a core dump and pbulk-build program with debug data, can print more info on request.
>How-To-Repeat:
run pbulk a lot
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Sun, 19 Jan 2025 10:44:39 +0000
Responsible-Changed-Why:
Can you please take a look?


From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/59009: pbulk-build SIGSEGV on null pointer dereference
Date: Sun, 19 Jan 2025 10:44:02 +0000

 I guess I should add a stack trace too:

 (gdb) bt
 #0  0x000000001d60389c in send_build_info (arg=3D0x7b40d8c92270) at master.=
 c:128
 #1  0x000000001d604b57 in deferred_write_handler (fd=3D<optimized out>, arg=
 =3D0x7b40cdd0e060) at event.c:134
 #2  0x000000001d604e77 in event_dispatch () at event.c:360
 #3  0x000000001d603ef5 in master_mode (master_port=3D0x7f7fff84d052 "127.0.=
 0.1:2002", start_script=3D0x7f7fff84d01c "/pbulk/2024Q4/pkg/libexec/pbulk/b=
 uild-client-start") at master.c:322
 #4  0x000000001d602327 in main (argc=3D3, argv=3D0x7f7fff84ca88) at pbuild.=
 c:166

 And this is the version of pbulk (unmodified from 2024Q4):

 $ /pbulk/2024Q4/pkg/sbin/pkg_info -I pbulk-base pbulk
 pbulk-base-0.57     Core components of the modular bulk build framework
 pbulk-0.73          Modular bulk build framework

From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/59009: pbulk-build SIGSEGV on null pointer dereference
Date: Tue, 23 Jun 2026 14:56:45 +0000

 Hit this again today.

 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x000000007720389c in send_build_info (arg=3D0x7ada366f7400) at master.=
 c:128
 128     master.c: No such file or directory.
 (gdb) bt
 #0  0x000000007720389c in send_build_info (arg=3D0x7ada366f7400) at master.=
 c:128
 #1  0x0000000077204b57 in deferred_write_handler (fd=3D<optimized out>,=20
     arg=3D0x7ada2b083060) at event.c:134
 #2  0x0000000077204e77 in event_dispatch () at event.c:360
 #3  0x0000000077203ef5 in master_mode (
     master_port=3D0x7f7fff474522 "127.0.0.1:2002",=20
     start_script=3D0x7f7fff4744ec "/pbulk/2026Q2/pkg/libexec/pbulk/build-cl=
 ient-start") at master.c:322
 #4  0x0000000077202327 in main (argc=3D3, argv=3D0x7f7fff473f58) at pbuild.=
 c:164
 (gdb) info locals
 peer =3D 0x7ada366f7400
 (gdb) print *peer
 $1 =3D {peer_link =3D {le_next =3D 0x0, le_prev =3D 0x7740f320 <unassigned_=
 peers>},
   job =3D 0x0, fd =3D 9, tmp_buf =3D "G\000\021&", buf =3D 0x0}
 (gdb) print active_peers
  $2 =3D {lh_first =3D 0x7ada366f7400}
 (gdb) print *active_peers->lh_first
 $3 =3D {peer_link =3D {le_next =3D 0x0, le_prev =3D 0x7740f320 <unassigned_=
 peers>},
   job =3D 0x0, fd =3D 9, tmp_buf =3D "G\000\021&", buf =3D 0x0}
 (gdb) print inactive_peers
 $4 =3D {lh_first =3D 0x0}
 (gdb) print clients_started
 $5 =3D 1
 (gdb) print child_event
 $6 =3D {sig_link =3D {le_next =3D 0x0, le_prev =3D 0x7740f3c8 <all_signals>=
 },
   sig_id =3D 20, sig_received =3D 0, sig_handler =3D 0x77203be1 <child_hand=
 ler>}
 (gdb) print child_pid
 $7 =3D 28726

 So in this case, it looks like=20

>Unformatted:

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.