From owner-freebsd-testing@freebsd.org Sun Apr 12 18:09:35 2020 Return-Path: Delivered-To: freebsd-testing@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B25452C4B34 for ; Sun, 12 Apr 2020 18:09:35 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500p.mail.yandex.net (forward500p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 490fsT6cQNz4Rtr; Sun, 12 Apr 2020 18:09:33 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from mxback5q.mail.yandex.net (mxback5q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:b716:ad89]) by forward500p.mail.yandex.net (Yandex) with ESMTP id 7547B940579; Sun, 12 Apr 2020 21:09:29 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback5q.mail.yandex.net (mxback/Yandex) with ESMTP id GI6H6DKzNu-9SlSUBOK; Sun, 12 Apr 2020 21:09:28 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1586714968; bh=/Gds0gssrjC/rda92OqXdHDw7NpaVtOFBNXXEF2ubRA=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=dwkvV1iYvDOLPZo3NpALK6Ebgw+T825oh5QfYY6OiE5Ol00L7uUgwtq5FY8vyggTw zZ8qokRtT+0y4TYjp+1ugyroPU7QWZJVTjFa6zrGADk1wIXPbuZ+5kIp1evvGuGcYP JTioWBHCAbN1/qVC99SdbxhdpssKa9aUxiD1jWqg= Received: by vla1-c477e3898c96.qloud-c.yandex.net with HTTP; Sun, 12 Apr 2020 21:09:28 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Li-Wen Hsu Cc: "freebsd-testing@freebsd.org" In-Reply-To: References: Subject: Re: ipdivert tests and net.inet.ip.fw.default_to_accept MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sun, 12 Apr 2020 19:09:28 +0100 Message-Id: <6963991586714482@vla4-4046ec513d04.qloud-c.yandex.net> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 490fsT6cQNz4Rtr X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=dwkvV1iY; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 2a02:6b8:0:1472:2741:0:8b7:110 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-5.77 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0:1000::/52]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-3.57)[ip: (-9.23), ipnet: 2a02:6b8::/32(-4.77), asn: 13238(-3.85), country: RU(0.01)]; DKIM_TRACE(0.00)[ipfw.ru:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[0.1.1.0.7.b.8.0.0.0.0.0.1.4.7.2.2.7.4.1.0.0.0.0.8.b.6.0.2.0.a.2.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[melifaro@freebsd.org,melifaro@ipfw.ru]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; FROM_NEQ_ENVFROM(0.00)[melifaro@freebsd.org,melifaro@ipfw.ru] X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 18:09:35 -0000 12.04.2020, 18:45, "Li-Wen Hsu" : > (CC freebsd-testing@ for more people can join the discussion) > > Hi Alexander, Ehlo! > > I'm checking test failures and panics, and found that the two ipdivert > tests we added previously have never been tested correctly. I've Yep, I've been running tests manually but haven't managed to raise a pull request to auto-load ipdivert prior to the tests yet. > loaded ipdivert.ko to unskip them in test VM, and found that these > two tests will fail or panic the kernel when > net.inet.ip.fw.default_to_accept is not 1. Wow. That's an interesting one! I've been always testing them with default_to_accept set to 1, as it eases test configuration. > > I'm thinking: > > 1) Also checks for net.inet.ip.fw.default_to_accept=1 at the beginning > and skip the test if 0 Well, ipfw defaults are not that well isolated in vnet. Maybe a better way would be to just install allow-all rule in VNET jail and proceed normally. > 2) Is this lock order reversal normal? No. > 3) Does this panic indicate a bug in the relative code? Yes. Let me investigate it. > > How do you think? > > Details of running the two tests are as following: > > # kyua test divert:ipdivert_ip_input_local_success > divert:ipdivert_ip_input_local_success -> lock order reversal: >  1st 0xffffffff81c8e558 allprison (allprison) @ > /usr/src/sys/kern/kern_jail.c:953 >  2nd 0xffffffff81d9a750 vnet_sysinit_sxlock (vnet_sysinit_sxlock) @ > /usr/src/sys/net/vnet.c:577 > stack backtrace: > #0 0xffffffff80c28671 at witness_debugger+0x71 > #1 0xffffffff80bc7747 at _sx_slock_int+0x67 > #2 0xffffffff80cfd2ce at vnet_alloc+0x11e > #3 0xffffffff80b7fd93 at kern_jail_set+0x1a23 > #4 0xffffffff80b81670 at sys_jail_set+0x40 > #5 0xffffffff8105d09d at amd64_syscall+0x73d > #6 0xffffffff810328d0 at fast_syscall_common+0x101 > failed: 1 != 0 (1 != 0) [0.814s] > > # kyua test divert:ipdivert_ip_output_remote_success > divert:ipdivert_ip_output_remote_success -> panic: Duplicate free of > 0xfffff80003c3fa00 from zone 0xfffffe000a1d0000(mbuf) slab > 0xfffff80003c3ffd8(10) > cpuid = 3 > time = 1586710625 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0038476f70 > vpanic() at vpanic+0x182/frame 0xfffffe0038476fc0 > panic() at panic+0x43/frame 0xfffffe0038477020 > uma_dbg_free() at uma_dbg_free+0x1f2/frame 0xfffffe0038477060 > uma_zfree_arg() at uma_zfree_arg+0x130/frame 0xfffffe00384770b0 > m_free() at m_free+0xb9/frame 0xfffffe00384770e0 > m_freem() at m_freem+0x28/frame 0xfffffe0038477100 > div_send() at div_send+0x43c/frame 0xfffffe0038477170 > sosend_generic() at sosend_generic+0x44c/frame 0xfffffe0038477220 > sosend() at sosend+0x66/frame 0xfffffe0038477250 > kern_sendit() at kern_sendit+0x246/frame 0xfffffe00384772f0 > sendit() at sendit+0x1cc/frame 0xfffffe0038477340 > sys_sendto() at sys_sendto+0x4d/frame 0xfffffe0038477390 > amd64_syscall() at amd64_syscall+0x73d/frame 0xfffffe00384774b0 > fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe00384774b0 > --- syscall (133, FreeBSD ELF64, sys_sendto), rip = 0x8007beeba, rsp = > 0x7fffffffdc68, rbp = 0x7fffffffdcb0 --- > KDB: enter: panic > > Best, > Li-Wen