Re: Relatively deterministic panic with sendfile(2) when running tests in the sxlock code

From: Enji Cooper (yaneurabeya) <"Enji>
Date: Sun, 14 Oct 2018 22:17:28 -0700
> On Oct 14, 2018, at 10:12 PM, Enji Cooper (yaneurabeya) <yaneurabeya_at_gmail.com> wrote:
> 
>> On Oct 14, 2018, at 9:45 PM, Enji Cooper (yaneurabeya) <yaneurabeya_at_gmail.com <mailto:yaneurabeya_at_gmail.com>> wrote:
>> 
>> 
>> 
>>> On Oct 14, 2018, at 7:25 PM, Gleb Smirnoff <glebius_at_freebsd.org <mailto:glebius_at_freebsd.org>> wrote:
>>> 
>>>  Hi Enji,
>>> 
>>> On Sun, Oct 14, 2018 at 06:51:42PM -0700, Enji Cooper (yaneurabeya) wrote:
>>> E> Hi,
>>> E> 	I’m 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’s 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
>>> 
>>> I'd like to reproduce it myself, but looks like URL is
>>> wrong:
>>> 
>>> glebius_at_erla:/usr/src:|>git clone https://github.com/ngie-eign/freebsd/tree/sendfile_tests <https://github.com/ngie-eign/freebsd/tree/sendfile_tests>
>>> Клонирование в «sendfile_tests»…
>>> fatal: repository 'https://github.com/ngie-eign/freebsd/tree/sendfile_tests/ <https://github.com/ngie-eign/freebsd/tree/sendfile_tests/>' not found
>> 
>> Mea culpa. It should be:
>> 
>> $ git clone https://github.com/ngie-eign/freebsd.git <https://github.com/ngie-eign/freebsd.git> .
>> 
>> Another note is that I’m running GENERIC-NODEBUG, not GENERIC-DEBUG.
>> 
>> I suspect that it’s crashing on :hdtr_negative_bad_pointers or : s_negative_not_descriptor, because the other items don’t seem terribly plausible.
>> 
>> The test case (source) can be found here: https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150fe124fac/lib/libc/tests/sys/sendfile_test.c <https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150fe124fac/lib/libc/tests/sys/sendfile_test.c>
> Aha! It was actually :s_negative_not_connected_socket.
> 
> 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’ed to a server socket) for `s` will result in a crash?

From https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150fe124fac/lib/libc/tests/sys/sendfile_test.c#L479 <https://github.com/ngie-eign/freebsd/blob/95b96470a3a0270c36c4e7fb5eedc150fe124fac/lib/libc/tests/sys/sendfile_test.c#L479>:
ATF_TC_BODY(s_negative_not_connected_socket, tc)
{
	int client_sock, error, fd, port;

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

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

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

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

Thanks!
-Enji

Received on Mon Oct 15 2018 - 03:17:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC