Module Name: src
Committed By: riastradh
Date: Sun Mar 10 04:21:47 UTC 2024
Modified Files:
src/sys/net: if_wg.c
Log Message:
wg(4): Bind to CPU in wg_handle_packet.
Required by use of psref there.
Assert we're bound up front so we catch mistakes early, rather than
later on if we get unlucky in preemption and scheduling.
PR bin/58021
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_wg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.77 src/sys/net/if_wg.c:1.78
--- src/sys/net/if_wg.c:1.77 Tue Aug 1 07:04:16 2023
+++ src/sys/net/if_wg.c Sun Mar 10 04:21:47 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wg.c,v 1.77 2023/08/01 07:04:16 mrg Exp $ */
+/* $NetBSD: if_wg.c,v 1.78 2024/03/10 04:21:47 riastradh Exp $ */
/*
* Copyright (C) Ryota Ozaki <[email protected]>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.77 2023/08/01 07:04:16 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.78 2024/03/10 04:21:47 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq_enabled.h"
@@ -2871,6 +2871,8 @@ wg_handle_packet(struct wg_softc *wg, st
{
struct wg_msg *wgm;
+ KASSERT(curlwp->l_pflag & LP_BOUND);
+
m = wg_validate_msg_header(wg, m);
if (__predict_false(m == NULL))
return;
@@ -5040,6 +5042,7 @@ rumpkern_wg_recv_peer(struct wg_softc *w
{
struct mbuf *m;
const struct sockaddr *src;
+ int bound;
WG_TRACE("");
@@ -5054,7 +5057,9 @@ rumpkern_wg_recv_peer(struct wg_softc *w
WG_DLOG("iov_len=%lu\n", iov[1].iov_len);
WG_DUMP_BUF(iov[1].iov_base, iov[1].iov_len);
+ bound = curlwp_bind();
wg_handle_packet(wg, m, src);
+ curlwp_bindx(bound);
}
#endif /* WG_RUMPKERNEL */