vnRj8zQw - Aleph Paste

diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c
index ee4da9ab8013..b29dd6e91ea6 100644
--- a/drivers/net/wireguard/main.c
+++ b/drivers/net/wireguard/main.c
@@ -15,11 +15,49 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/genetlink.h>
+#include <linux/hw_random.h>
+#include <linux/completion.h>
 #include <net/rtnetlink.h>
 
+static int derp_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
+{
+	printk(KERN_ERR "SARU top %s from %pS\n", __func__, (void *)_RET_IP_);
+	if (wait && max && (((current->flags & PF_KTHREAD) && kthread_should_stop()) || schedule_timeout_interruptible(HZ * 50))) {
+		printk(KERN_ERR "SARU ret EIO %s\n", __func__);
+		return -EIO;
+	}
+	memset(buf, 'A', max);
+	printk(KERN_ERR "SARU ret A %s\n", __func__);
+	return max;
+}
+
+static void derp_rng_cleanup(struct hwrng *rng)
+{
+	printk(KERN_ERR "SARU cleanup\n");
+}
+
+static struct hwrng derp_ops = {
+	.name = "flurpderp",
+	.read = derp_rng_read,
+	.cleanup = derp_rng_cleanup,
+	.quality = 320
+};
+
+static void stop_derp(struct work_struct *w)
+{
+	hwrng_register(&derp_ops);
+	msleep(15000);
+
+	printk(KERN_ERR "SARU unregistering\n");
+	hwrng_unregister(&derp_ops);
+	printk(KERN_ERR "SARU unregistered\n");
+}
+
+static DECLARE_DELAYED_WORK(dsderp, stop_derp);
 static int __init wg_mod_init(void)
 {
 	int ret;
+	schedule_delayed_work(&dsderp, HZ * 2);
 
 	ret = wg_allowedips_slab_init();
 	if (ret < 0)
diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh
index 69c7796c7ca9..859defae750b 100755
--- a/tools/testing/selftests/wireguard/netns.sh
+++ b/tools/testing/selftests/wireguard/netns.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+exec bash -i
 # SPDX-License-Identifier: GPL-2.0
 #
 # Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.