Date: Tue, 4 Feb 2020 04:29:55 +0000 (UTC) From: Kristof Provost <kp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357490 - stable/12/tests/sys/net Message-ID: <202002040429.0144TtIQ099143@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kp Date: Tue Feb 4 04:29:54 2020 New Revision: 357490 URL: https://svnweb.freebsd.org/changeset/base/357490 Log: MFC r357234, r357365, r357375: tests: Test for an epair panic if_epair abused the ifr_data field to insert its second interface in IFC_IFLIST. If userspace provides a value for ifr_data it would get dereferenced by the kernel leading to a panic. Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Added: stable/12/tests/sys/net/if_epair.c - copied, changed from r357234, head/tests/sys/net/if_epair.c Modified: stable/12/tests/sys/net/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/net/Makefile ============================================================================== --- stable/12/tests/sys/net/Makefile Tue Feb 4 04:29:53 2020 (r357489) +++ stable/12/tests/sys/net/Makefile Tue Feb 4 04:29:54 2020 (r357490) @@ -8,6 +8,7 @@ BINDIR= ${TESTSDIR} ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_tun_test +ATF_TESTS_C+= if_epair # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly @@ -15,7 +16,7 @@ ATF_TESTS_SH+= if_tun_test TEST_METADATA+= is_exclusive=true MAN= -PROG= randsleep +PROGS+= randsleep WARNS?= 6 Copied and modified: stable/12/tests/sys/net/if_epair.c (from r357234, head/tests/sys/net/if_epair.c) ============================================================================== --- head/tests/sys/net/if_epair.c Tue Jan 28 22:46:51 2020 (r357234, copy source) +++ stable/12/tests/sys/net/if_epair.c Tue Feb 4 04:29:54 2020 (r357490) @@ -25,17 +25,19 @@ * $FreeBSD$ */ +#include <sys/param.h> #include <sys/ioctl.h> #include <sys/linker.h> #include <sys/module.h> -#include <sys/param.h> #include <sys/socket.h> #include <sys/types.h> #include <net/if.h> +#include <errno.h> #include <fcntl.h> #include <stdio.h> +#include <strings.h> #include <atf-c.h> @@ -51,7 +53,7 @@ ATF_TC_BODY(params, tc) int s; s = kldload("if_epair"); - if (s != 0) + if (s == -1 && errno != EEXIST) atf_tc_fail("Failed to load if_epair"); s = socket(AF_INET, SOCK_DGRAM, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002040429.0144TtIQ099143>