Page MenuHomeFreeBSD

sg2342_googlemail.com (Stefan Grundmann)
User

Projects

User does not belong to any projects.

User Details

User Since
Jan 19 2016, 3:04 PM (296 w, 5 d)

Recent Activity

Nov 28 2020

sg2342_googlemail.com accepted D26137: Wireguard merge.

It's a real bug insofar as people will run this virtualized. It's probably not possible to reproduce this on physical hardware because the OS is delivering new packets to a closed socket almost half a second after the socket has been closed. This suggests that the bhyve thread was blocked from running after the packet arrived but before the socket was closed.

FreeBSD ifnet is full of life cycle issues, it would take fairly thorough revamping, eliminating ifnet pointers floating around the stack that no one is going to pay for. So I'm loath to put too much additional time in to this. This is further compounded in a virtual environment where vcpu scheduling can create a situation where one vcpu destroys an object and another vcpu runs hundreds of milliseconds later accessing it. I've already added considerable overhead to the data path as it is for things that no one would actually see in production that I would at some point like to see taken out.

Since we're just dealing with hypervisor scheduling at this point the only thing we can do here is add a delay:

diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c
index 0d5aca904ec..cf2f10fb697 100644
--- a/sys/dev/if_wg/module/module.c
+++ b/sys/dev/if_wg/module/module.c
@@ -340,6 +340,7 @@ wg_detach(if_ctx_t ctx)
        taskqgroup_drain_all(qgroup_if_io_tqg);
        pause("link_down", hz/4);
        wg_peer_remove_all(sc);
+       pause("link_down", hz);
        mtx_destroy(&sc->sc_mtx);
        rw_destroy(&sc->sc_index_lock);
        taskqgroup_detach(qgroup_if_io_tqg, &sc->sc_handshake);
Nov 28 2020, 2:06 PM

Nov 24 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

moved the test setup to a different machine and after 1 hour and 19 minutes of running the test setup i got a panic here:

Nov 24 2020, 4:43 AM
sg2342_googlemail.com added a comment to D26137: Wireguard merge.

I don't have time to test right now, but this is an analogous double free fix in the wg_encap path that I did earlier in the wg_decap path.

Nov 24 2020, 3:41 AM

Nov 23 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

i did not test Diff 21 79917 ( Mon, Nov 23, 10:04 PM ) since it does not seem to involve the code responsible for the device destruction panics.

Nov 23 2020, 10:46 PM

Nov 20 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

with 79581 applied, device destruction can still panic the kernel (same setup as before: loop create, ping, sleep, destroy on FreeBSD and ping flood the wg address of the FreeBSD machine)

Nov 20 2020, 3:44 AM

Oct 27 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

with the same setup (on FreeBSD: while true; do ifconfig wg0 create .....; ping -c 1 PEERIP; sleep 1; ifconfig wg0 destroy; done and on the Linux peer: ping -f FreeBSDwgIP) i can also get a different panic: here the gtaskqueue_drain thread got to wg_deliver_in(...) but peer->p_sc->sc_socket->so_so4 is 0x0

Oct 27 2020, 3:56 AM
sg2342_googlemail.com added a comment to D26137: Wireguard merge.

with 78675 applied (and clone_setdefcallback changed to clone_setdefcallback_prefix in ifwg.c), i got another
kernel panic (on wg device destruction):

Oct 27 2020, 3:36 AM

Oct 15 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

Another kernel panic triggered by interface destruction: incoming upd traffic from the wg peer arrives in wg_input() where sc is already gone.

Oct 15 2020, 3:45 AM

Oct 14 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

In order to have working wg in VIMAGE jails:

Oct 14 2020, 9:30 PM

Oct 1 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

This might be out of scope of this review:
the WGC_SET ioctl is not priv(9) checked (and there is no PRIV_NET_WG entry in sys/priv.h)

Oct 1 2020, 3:00 AM
sg2342_googlemail.com added a comment to D26137: Wireguard merge.

IMHO wg_get() (sys/dev/if_wg/module/module.c:526) should not expose private-key
and wireguard_status() (sbin/ifconfig/ifwg.c:546) should not print it.

Oct 1 2020, 12:42 AM
sg2342_googlemail.com requested changes to D26137: Wireguard merge.

When a peer has more than one AllowedIPs, dump_peer() (sys/ifconfig/ifwg.c:270)
will print the address (but not the mask) of the first entry multiple times
because of sys/ifconfig/ifwg.c:306 which should be

Oct 1 2020, 12:41 AM

Sep 12 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

According to ifconfig(8): Cloned interfaces are members of their interface family group by default.

The use of iflib_clone_register() in module.c prevents that this is done for if_wg.

How so? iflib_clone_register calls if_clone_simple which is what vxlan does as well.

Sep 12 2020, 12:42 AM

Sep 10 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

According to ifconfig(8): Cloned interfaces are members of their interface family group by default.

Sep 10 2020, 3:36 AM

Sep 8 2020

sg2342_googlemail.com added a comment to D26137: Wireguard merge.

if the wg interface has an ipv6 address, SIOCIFDESTROY can panic the kernel.

Sep 8 2020, 1:03 AM

Jul 13 2020

sg2342_googlemail.com added a comment to D25639: make lang/erlang-runtime23 package build reproducible.

after reading D24586 :

Jul 13 2020, 2:22 AM · Erlang, Ports Committers
sg2342_googlemail.com updated the diff for D25639: make lang/erlang-runtime23 package build reproducible.
Jul 13 2020, 12:37 AM · Erlang, Ports Committers
sg2342_googlemail.com updated the diff for D25639: make lang/erlang-runtime23 package build reproducible.

update path in diff, add PORTREVISION

Jul 13 2020, 12:07 AM · Erlang, Ports Committers

Jul 12 2020

sg2342_googlemail.com requested review of D25639: make lang/erlang-runtime23 package build reproducible.
Jul 12 2020, 11:36 PM · Erlang, Ports Committers

May 16 2018

sg2342_googlemail.com added inline comments to D15289: sandbox jls(8).
May 16 2018, 2:17 AM · capsicum
sg2342_googlemail.com added inline comments to D15289: sandbox jls(8).
May 16 2018, 1:56 AM · capsicum

May 12 2018

sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).

fix RESCUE: include lib/libjail/jail.c in librescue if necessary

May 12 2018, 12:57 AM · capsicum

May 11 2018

sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).

cap_jail.c: improve allocation and error handling in service command

May 11 2018, 3:14 PM · capsicum
sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).

cap_sysctl.c: resolve names to mibs when limits are set.

May 11 2018, 3:36 AM · capsicum
sg2342_googlemail.com added inline comments to D15289: sandbox jls(8).
May 11 2018, 2:12 AM · capsicum
sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).
  • rename cap_jail_get -> cap_jail and system.cap_jail_get -> system.cap_jail
  • cap_jail:
    • fix copyright
    • add man page
  • cap_jail.c:
    • style(9) changes
    • use dnvlist_* in service command
    • split nvlist -> iov function in two: nvl_to_iov_s is used by the service and makes sure there is space before memcpy
  • jls.c: use caph_enter_casper
  • cap_sysctl.c: style
  • cap_sysclt.3: reference sysctl(3)
May 11 2018, 1:30 AM · capsicum

May 10 2018

sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).

I removed to kernel changes and used libcasper to obtain sysctl and jail_get functionality needed for jls(1).

May 10 2018, 2:13 AM · capsicum

May 4 2018

sg2342_googlemail.com updated the diff for D15289: sandbox jls(8).

caph_cache_catpages(3) before cap_enter(2)

May 4 2018, 2:56 AM · capsicum
sg2342_googlemail.com created D15289: sandbox jls(8).
May 4 2018, 1:25 AM · capsicum

May 3 2018

sg2342_googlemail.com added a watcher for capsicum: sg2342_googlemail.com.
May 3 2018, 9:53 PM