Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2016 11:40:38 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        freebsd-arm <freebsd-arm@freebsd.org>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   stable/11 -r307797 on BPi-M3 (cortex-a7): truss gets segmentation fault for handling unknown system call
Message-ID:  <0699F744-DEB3-4ED5-91A9-B77EA2ACED37@dsl-only.net>

next in thread | raw e-mail | index | archive | help
[The following has been reported in: =
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D213778 .]

In trying to build lang/gcc6 xgcc's cc1 got some SIGSYS examples. In =
trying to track things down I ran into truss getting a SIGSEGV when it =
tries to handle the situation. . .

In truss's enter_syscall there is (from a live gdb on truss, after the =
segmentation fault):

380		t->cs.name =3D sysdecode_syscallname(t->proc->abi->abi, =
t->cs.number);
381		if (t->cs.name =3D=3D NULL)
(gdb)=20
382			fprintf(info->outfile, "-- UNKNOWN %s SYSCALL %d =
--\n",
383			    t->proc->abi->type, t->cs.number);
384=09
385		sc =3D get_syscall(t->cs.name, narg);
386		t->cs.nargs =3D sc->nargs;
387		assert(sc->nargs <=3D nitems(t->cs.s_args));
388=09
389		t->cs.sc =3D sc;

(gdb) print *t
$2 =3D {entries =3D {le_next =3D 0x0, le_prev =3D 0x20617070}, proc =3D =
0x20617060, tid =3D 100150, in_syscall =3D 1, cs =3D {sc =3D 0x0, name =3D=
 0x0, number =3D 580828064, args =3D 0x2061b0c0, nargs =3D 0,=20
    s_args =3D 0x2061b0ec}, before =3D {tv_sec =3D 1477418265, tv_nsec =3D=
 492342263}, after =3D {tv_sec =3D 1477418265, tv_nsec =3D 492496630}}

(gdb) print sc
$3 =3D (struct syscall *) 0x0

So line 386 listed above gets a segmentation fault for sc->nargs when =
t->cs.name is a NULL pointer: sc ends up NULL.

Looking at the two things that the fprintf on lines 382 and 383 would =
report:

(gdb) print t->proc->abi->type
$4 =3D 0x10166 "FreeBSD ELF32"

(gdb) print t->cs.number
$5 =3D 580828064

(gdb) print narg
$6 =3D 0

(that last is for context for the get_syscall arguments).

FYI: 580828064 =3D 0x229EBBA0


Context:

root@bananapi-m3:/usr/ports # uname -apKU
FreeBSD bananapi-m3 11.0-STABLE FreeBSD 11.0-STABLE #0 r307797M: Mon Oct =
24 00:41:16 PDT 2016     =
markmi@FreeBSDx64:/usr/local/src/crochet/work/obj/arm.armv6/usr/src/sys/AL=
LWINNER  arm armv6 1100505 1100505



=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0699F744-DEB3-4ED5-91A9-B77EA2ACED37>