Module Name: src Committed By: riastradh Date: Thu Sep 1 18:32:25 UTC 2022
Modified Files: src/sys/crypto/cprng_fast: cprng_fast.c Log Message: cprng_fast(9): Assert not in pserialize read section. This may sleep to take the global entropy lock in case it needs to be reseeded. If that happens we can't be in a pserialize read section. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/crypto/cprng_fast/cprng_fast.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/crypto/cprng_fast/cprng_fast.c diff -u src/sys/crypto/cprng_fast/cprng_fast.c:1.17 src/sys/crypto/cprng_fast/cprng_fast.c:1.18 --- src/sys/crypto/cprng_fast/cprng_fast.c:1.17 Wed Jun 1 15:44:37 2022 +++ src/sys/crypto/cprng_fast/cprng_fast.c Thu Sep 1 18:32:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cprng_fast.c,v 1.17 2022/06/01 15:44:37 riastradh Exp $ */ +/* $NetBSD: cprng_fast.c,v 1.18 2022/09/01 18:32:25 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.17 2022/06/01 15:44:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.18 2022/09/01 18:32:25 riastradh Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: cprng_fast.c #include <sys/evcnt.h> #include <sys/kmem.h> #include <sys/percpu.h> +#include <sys/pserialize.h> #include <crypto/chacha/chacha.h> @@ -95,6 +96,7 @@ cprng_fast_get(struct cprng_fast **cprng int s; KASSERT(!cpu_intr_p()); + KASSERT(pserialize_not_in_read_section()); *cprngp = cprng = percpu_getref(cprng_fast_percpu); s = splsoftserial();