Re: Seg Faults on Pi-3 after upgrading to 15.1

Bakul Shah <[email protected]> Tue, 23 Jun 2026 15:07:33 -0700
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
--Apple-Mail=_F9A8FE40-8A89-426D-8864-3A29E4D8C64D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

On Jun 19, 2026, at 9:59=E2=80=AFPM, Hal Murray <[email protected]> =
wrote:
>=20
>=20
> Our code that calls inet_ntop is passed a pointer to a union =
sockaddr_in=20
> and socaddr_in6.  It does a switch on the AF.  The stack shows the =
call=20
> from the AF_INET6 branch.  inet_ntop soes a similar switch to get to=20=

> inet_ntop6.  So that 28 in af@entry is bogus.  But the storage for the=20=

> parameter that was passed in now has a 28.  Maybe gdb is reaching back=20=

> that far.
>=20
> Has anybody seen troubles on a Pi-3?  What can I do to help?  ...
>=20
> No troubles yet with 15.1 on a couple of amd64 systems.
>=20
> I can reproduce this in 5 or 10 minutes.
>=20
> This is not a busy system.  It's only running ntpd and ntpmon.  ntpd =
has=20
> 10 servers so that's a pair of packets every 6 seconds.   ntpmon will =
add=20
> a burst of a few packets every 32 seconds.
>=20
> There is also a monitoring program that writes a line to a log file =
every=20
> minute with temperature, drift, and load average.

I worked with Hal via email and collected some data.
After ruling out voltage & temperature issues etc. &
converting a python program Hal sent me to C and enhancing
it (attached) this is what we discovered:

The test program works fine on 15.0 & 15.1 on pi4.
It works fine on amd64 (on 15-stable). It work fine
on 15.0 but fails fairly quickly on 15.1 on pi3.

When modified to call inet_ntop() on IPv4 addresses
works fine on 15.1 on pi3.

The test program fails after random number of cycles. I suspect
some threading related bug but I have forgotten how to do source
level debugging (in lldb) in library code. Not sure that will
help it if is a concurrency bug....

The test was run on the same 2 pi3 boards for both 15.0 and 15.1
install images.

The first optional arg is for N (default 0) =C2=B5seconds sleep between
inet_ntop calls. The second arg is to advance to next line after=20
every N (default 10000) cycles.



--Apple-Mail=_F9A8FE40-8A89-426D-8864-3A29E4D8C64D
Content-Disposition: attachment;
	filename=ntoptest.c
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ntoptest.c"
Content-Transfer-Encoding: 7bit

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>

char buf[INET6_ADDRSTRLEN];
int main(int c, char**v) {
	int count = 0;
	int silent = 0;
	char addr_txt[] = "2600:1700:a460:4b60::1:2";
	struct in6_addr addr_bin;
	unsigned usec = 0;
	unsigned step = 10000;
	inet_pton(AF_INET6, addr_txt, &addr_bin);
	if (c > 1) usec = atoi(v[1]);
	if (c > 2) step = atoi(v[2]);
	if (usec < 0) { silent = 1; usec = -usec; }
	for (;;) {
		if (!inet_ntop(AF_INET6, &addr_bin, buf, sizeof(buf))) {
			perror("inet_ntop");
			return 1;
		}
		if (strcmp(addr_txt, buf)) {
			fprintf(stderr, "%s=>%s\n", addr_txt, buf);
			break;
		}
		count++;
		if (!silent)
			printf("%d%c", count, count%step? '\r' : '\n');
		else if ((count%step)==0)
			fprintf(stderr, "%d\n", count);
		if (usec) usleep(usec);
	}
}

--Apple-Mail=_F9A8FE40-8A89-426D-8864-3A29E4D8C64D--