diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2020-12-01 11:28:04 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2020-12-01 11:28:04 +0000 |
commit | 3b62c1161f7bae29d5920d4ce12309099b69afa5 (patch) | |
tree | ff6ead67b395d789ed8a107a30ade910c7b5bf5c /sys/net | |
parent | 5e07c6db1026ffbd12e9c84a27155657cae63eba (diff) |
bzero the antireplay counter rwlock before rw_init'ing it, not after.
This was triggering a WITNESS detection
witness: lock_object uninitialized: 0xffff800000bcf0d8
Starting stack trace...
witness_checkorder(ffff800000bcf0d8,9,0) at witness_checkorder+0xab
rw_enter_write(ffff800000bcf0c8) at rw_enter_write+0x43
noise_remote_decrypt(ffff800000bcea48,c4992785,0,fffffd80073c89bc,10) at noise_remote_decrypt+0x135
wg_decap(ffff80000054a000,fffffd805f53ac00) at wg_decap+0xda
wg_decap_worker(ffff80000054a000) at wg_decap_worker+0x7a
taskq_thread(ffff80000012d900) at taskq_thread+0x9f
alternating between two lock objects. From Matt Dunwoodie, thanks semarie@
for explanations about witness and looking at the code.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/wg_noise.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/net/wg_noise.c b/sys/net/wg_noise.c index adb00568eb4..cbf17a02c24 100644 --- a/sys/net/wg_noise.c +++ b/sys/net/wg_noise.c @@ -467,8 +467,8 @@ noise_remote_begin_session(struct noise_remote *r) kp.kp_local_index = hs->hs_local_index; kp.kp_remote_index = hs->hs_remote_index; getnanouptime(&kp.kp_birthdate); - rw_init(&kp.kp_ctr.c_lock, "noise_counter"); bzero(&kp.kp_ctr, sizeof(kp.kp_ctr)); + rw_init(&kp.kp_ctr.c_lock, "noise_counter"); /* Now we need to add_new_keypair */ rw_enter_write(&r->r_keypair_lock); |