Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Oct 2018 22:17:28 -0700
From:      "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, freebsd-net <freebsd-net@freebsd.org>, Jonathan Looney <jonlooney@gmail.com>
Subject:   Re: Relatively deterministic panic with sendfile(2) when running tests in the sxlock code
Message-ID:  <D5F7ABC3-89F1-48B9-94B0-067E3DE3F5B2@gmail.com>
In-Reply-To: <BA546783-C2DA-4ED9-8391-8408A8B9145B@gmail.com>
References:  <CC816726-7B79-4643-82DD-7B4CF4A25F54@gmail.com> <20181015022518.GV1044@FreeBSD.org> <1B58488D-8615-40E8-9115-E26496A6DBCE@gmail.com> <BA546783-C2DA-4ED9-8391-8408A8B9145B@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_D585D9C3-E405-4F3C-98D6-58F0052481E1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Oct 14, 2018, at 10:12 PM, Enji Cooper (yaneurabeya) =
<yaneurabeya@gmail.com> wrote:
>=20
>> On Oct 14, 2018, at 9:45 PM, Enji Cooper (yaneurabeya) =
<yaneurabeya@gmail.com <mailto:yaneurabeya@gmail.com>> wrote:
>>=20
>>=20
>>=20
>>> On Oct 14, 2018, at 7:25 PM, Gleb Smirnoff <glebius@freebsd.org =
<mailto:glebius@freebsd.org>> wrote:
>>>=20
>>>  Hi Enji,
>>>=20
>>> On Sun, Oct 14, 2018 at 06:51:42PM -0700, Enji Cooper (yaneurabeya) =
wrote:
>>> E> Hi,
>>> E> 	I=E2=80=99m seeing a semi-deterministic panic on 12.0-ALPHA9 =
related to sendfile(2) when running sendfile_test on the host: =
https://pastebin.com/raw/6Y7xg0ki <https://pastebin.com/raw/6Y7xg0ki>; =
it looks like it=E2=80=99s crashing in the sxlock code when calling =
sblock on a sockbuf. Are there any commands in gdb you would like me to =
run to display lock state?
>>> E> 	Repro:
>>> E>
>>> E> mkdir /path/to/git/checkout
>>> E> cd /path/to/git/checkout
>>> E> git clone =
https://github.com/ngie-eign/freebsd/tree/sendfile_tests =
<https://github.com/ngie-eign/freebsd/tree/sendfile_tests>; .
>>> E> git checkout sendfile_tests
>>> E> (cd lib/libc/tests/sys/; make obj; make; sudo make install)
>>> E> kyua test -k /usr/tests/lib/libc/sys/Kyuafile sendfile_test
>>>=20
>>> I'd like to reproduce it myself, but looks like URL is
>>> wrong:
>>>=20
>>> glebius@erla:/usr/src:|>git clone =
https://github.com/ngie-eign/freebsd/tree/sendfile_tests =
<https://github.com/ngie-eign/freebsd/tree/sendfile_tests>;
>>> =D0=9A=D0=BB=D0=BE=D0=BD=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=
 =D0=B2 =C2=ABsendfile_tests=C2=BB=E2=80=A6
>>> fatal: repository =
'https://github.com/ngie-eign/freebsd/tree/sendfile_tests/ =
<https://github.com/ngie-eign/freebsd/tree/sendfile_tests/>' not found
>>=20
>> Mea culpa. It should be:
>>=20
>> $ git clone https://github.com/ngie-eign/freebsd.git =
<https://github.com/ngie-eign/freebsd.git>; .
>>=20
>> Another note is that I=E2=80=99m running GENERIC-NODEBUG, not =
GENERIC-DEBUG.
>>=20
>> I suspect that it=E2=80=99s crashing on :hdtr_negative_bad_pointers =
or : s_negative_not_descriptor, because the other items don=E2=80=99t =
seem terribly plausible.
>>=20
>> The test case (source) can be found here: =
https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150=
fe124fac/lib/libc/tests/sys/sendfile_test.c =
<https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc15=
0fe124fac/lib/libc/tests/sys/sendfile_test.c>
> Aha! It was actually :s_negative_not_connected_socket.
>=20
> Updated repro: use `kyua test -k /usr/tests/lib/libc/sys/Kyuafile =
sendfile_test:s_negative_not_connected_socket` instead of the other kyua =
call I provided.

Oh yipes. I guess passing in a server socket (a bound and listening =
socket) instead of a client socket (connect=E2=80=99ed to a server =
socket) for `s` will result in a crash?

=46rom =
https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150=
fe124fac/lib/libc/tests/sys/sendfile_test.c#L479 =
<https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc15=
0fe124fac/lib/libc/tests/sys/sendfile_test.c#L479>:
ATF_TC_BODY(s_negative_not_connected_socket, tc)
{
	int client_sock, error, fd, port;

	port =3D XXX_TEST_PORT_BASE + __LINE__;
	client_sock =3D setup_tcp_server(XXX_TEST_DOMAIN, port);

	fd =3D open(SOURCE_FILE, O_CREAT|O_RDWR);
	ATF_REQUIRE_MSG(fd !=3D -1, "open failed: %s", strerror(errno));

	error =3D sendfile(fd, client_sock, 0, 0, NULL, NULL, =
SF_FLAGS(0, 0));
	ATF_REQUIRE_ERRNO(ENOTCONN, error =3D=3D -1);

	(void)close(fd);
	(void)close(client_sock);
}
Let me see if I can track this down..

Thanks!
-Enji

--Apple-Mail=_D585D9C3-E405-4F3C-98D6-58F0052481E1
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlvEIugACgkQ9YOpJmkw
hhUYFRAAlRnEdZpDGsLstcFZokAM3J4Q9DG9mgz5/bgpo4knQe0VXBm2F43WQVsk
YdvrgR7ynX3rWBcMTQayJ2WpVt+mhhLrjOBClvqC4J6IbjHCiCpTgnUqkDQ0PQDx
qIngELPRP1y36dU/MQkOl9Pu6dhDZ4l7guqiVOelVeoO2HPGQlUziF+xayihLThc
+ZQ4GvV8GzYDuIx7Kvllktfpm07HMh+kbMJw0rIF/bUIo8C8gYVFUFSRnLvx0HsH
9H90cRTP/ZvgCKqiydRcsxwzUA77K+oqCsqIbYVzIlqwcxQp6w9tRbKhdhLbgiEX
z8k+EQhXd/TXvKxNlZ0Yf4SwM1vPaCOeExPVYVb9c+KqkZ78GnVPZSoaQr31Tvrr
1JzeIQo7WAglO4+WlQGcy82t1GXXOHUaNNLvtCwFwZ33Vi0oOMpsJxPEXY4Rs5eA
6gmmKy/KjLnKQjHDHCOusRz0hXD0n44tQLDh3N9uk8+DGAm1y0APAkmcmn8fhF/y
OzpdRyKFLmqonWR7Jj4pCY/c+anAvLzTovgvjqL33cWd3klMj8JoqpFtWs782L+6
oLTfkGDA1+rYKblYHhiizwDPcnRst6dmtRIzXhhFT8QSqOOSvWOCGccpw1pUjd0W
lCVKJimpzqt5PzoTBT3uiRNiS5wtwdI7dWEF2Nh59iMtKWBrY5k=
=1+Em
-----END PGP SIGNATURE-----

--Apple-Mail=_D585D9C3-E405-4F3C-98D6-58F0052481E1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D5F7ABC3-89F1-48B9-94B0-067E3DE3F5B2>