From nobody Tue Feb 22 07:28:57 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8740419C85BE; Tue, 22 Feb 2022 07:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K2rQ13LlSz3Q61; Tue, 22 Feb 2022 07:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645514937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lq2VH7sjsqcqPyoXODebHe/HwYCHqdILifX5FPdLXf4=; b=gGIXAU9CHE6TDIYA3N1VTGmoQ02fPA6p45QVgOVT8PSDjQwzo8JWa5XHr4s8YHouEtTYaA zu8PJkTEde9xLf8axbGFoG0g3ET1uHxgM9lz8mf8ocVBz9yiaA+FvhQpeBayLnlOGgcBx+ 6glCH52ahzW5PvB7wEY5lst9+mlQm7nc1SWzuL6pR5a6r60ncOa7oRdvrGYTDdt72vTBfi F5biWl39UxQzchPAVWu5nCAFWg2Xq0uTB84wSH1oFAG78u0JO05LmLxTTT+2ZIZ82kpMaW umDQ72BUmr3gioCrx9vHU/ufcyHvUnP0E34sVfL+c8nnVm2X+fPnmdQGrB6WaQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5383C20120; Tue, 22 Feb 2022 07:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21M7SvDF017293; Tue, 22 Feb 2022 07:28:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21M7SvF4017292; Tue, 22 Feb 2022 07:28:57 GMT (envelope-from git) Date: Tue, 22 Feb 2022 07:28:57 GMT Message-Id: <202202220728.21M7SvF4017292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "David E. O'Brien" Subject: git: 220841e5279f - stable/12 - random(4): Fix RANDOM_LOADABLE build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obrien X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 220841e5279fad74fd696b2076520f38d5592d74 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645514937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lq2VH7sjsqcqPyoXODebHe/HwYCHqdILifX5FPdLXf4=; b=ZCOxb2Dm54CpxMxZWpKIoQng5Ctr+EBJuf7CBQAr7K9HvvS9cRYUsKrjJTKR0+ovEStaP2 RwdzG1H+VAzJfWk+lfLUSA3wFux1Hw1yTrC7gZvsVtEnngBwWBBklhRBL1nSO21YvEORP5 oV98NIC4hb2Q9XZDsETw3JU9BTncR450hzhaEK00dBRXIJEE6WW/uX7uf5equyei8ac8+q Nqch+jrsP0Lrp+qgEFhXuVpnL5owSwIS0Yw0iJ/NoejRpCqBDJzbHnWkEWmYXEvrwydVK1 kZhl/tnNIbVT3vp9nFTZlVBFSf/OBYS89ISMKF640WJe5TKMNaljEmHvI/+ikg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645514937; a=rsa-sha256; cv=none; b=j+JF1BdFPK6+KzHKwYsPwEp6YKpNlkIxeAZArJ0suWhnOSiS5VAnEEoSQaqTtWwSO6YoLn 8gdE80BiNzpQaMrPj19nx4eOrwDPMzr+JrNaVMFLV21RUlOUnRiW9PbVNisdcSZx+tU2KO GP93N7+4jSJ/735Mu2W/lIr/LlCLaZZoAQ29Xz/St1gv4VfuZic9L2zOjreKGmcMvCwiPf AYuYsIUHmqdtJtRmr+QuQZRRTHx5JGrPvBoOKdgzJwmcZKN/Mm3CzcUEImvSsOfTsIGso/ PI/keq1NYQzoohVbBY0xwhdmuobhpxGE7mQBA/6TY4EHF8GMj6OsNRfJ/GsXQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by obrien: URL: https://cgit.FreeBSD.org/src/commit/?id=220841e5279fad74fd696b2076520f38d5592d74 commit 220841e5279fad74fd696b2076520f38d5592d74 Author: Conrad Meyer AuthorDate: 2019-06-01 01:22:21 +0000 Commit: David E. O'Brien CommitDate: 2022-02-22 06:20:48 +0000 random(4): Fix RANDOM_LOADABLE build I introduced an obvious compiler error in r346282, so this change fixes that. Unfortunately, RANDOM_LOADABLE isn't covered by our existing tinderbox, and it seems like there were existing latent linking problems. I believe these were introduced on accident in r338324 during reduction of the boolean expression(s) adjacent to randomdev.c and hash.c. It seems the RANDOM_LOADABLE build breakage has gone unnoticed for nine months. This change correctly annotates randomdev.c and hash.c with !random_loadable to match the pre-r338324 logic; and additionally updates the HWRNG drivers in MD 'files.*', which depend on random_device symbols, with !random_loadable (it is invalid for the kernel to depend on symbols from a module). (The expression for both randomdev.c and hash.c was the same, prior to r338324: "optional random random_yarrow | random !random_yarrow !random_loadable". I.e., "random && (yarrow || !loadable)." When Yarrow was removed ("yarrow := False"), the expression was incorrectly reduced to "optional random" when it should have retained "random && !loadable".) Additionally, I discovered that virtio_random was missing a MODULE_DEPEND on random_device, which breaks kld load/link of the driver on RANDOM_LOADABLE kernels. Address that issue as well. (cherry picked from commit 5ca5dfe938c1e4c741dc4c7bd83c738714456978) --- sys/conf/files | 4 ++-- sys/conf/files.amd64 | 4 ++-- sys/conf/files.i386 | 4 ++-- sys/conf/files.powerpc | 2 +- sys/dev/random/random_infra.c | 5 ++++- sys/dev/virtio/random/virtio_random.c | 1 + 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 0b01ac08623e..5ac40e866e8f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2881,9 +2881,9 @@ rt2860.fw optional rt2860fw | ralfw \ clean "rt2860.fw" dev/random/random_infra.c optional random dev/random/random_harvestq.c optional random -dev/random/randomdev.c optional random +dev/random/randomdev.c optional random !random_loadable dev/random/fortuna.c optional random !random_loadable -dev/random/hash.c optional random +dev/random/hash.c optional random !random_loadable dev/rc/rc.c optional rc dev/rccgpio/rccgpio.c optional rccgpio gpio dev/re/if_re.c optional re diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 425abcd8b4c7..d1470131b860 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -420,8 +420,8 @@ dev/nvme/nvme_sysctl.c optional nvme dev/nvme/nvme_test.c optional nvme dev/nvme/nvme_util.c optional nvme dev/nvram/nvram.c optional nvram isa -dev/random/ivy.c optional rdrand_rng -dev/random/nehemiah.c optional padlock_rng +dev/random/ivy.c optional rdrand_rng !random_loadable +dev/random/nehemiah.c optional padlock_rng !random_loadable dev/qat/qat.c optional qat dev/qat/qat_ae.c optional qat dev/qat/qat_c2xxx.c optional qat diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 4bb09402791a..603a9a4dba88 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -311,8 +311,8 @@ dev/nvme/nvme_util.c optional nvme dev/nvram/nvram.c optional nvram isa dev/ofw/ofwpci.c optional fdt pci dev/pcf/pcf_isa.c optional pcf -dev/random/ivy.c optional rdrand_rng -dev/random/nehemiah.c optional padlock_rng +dev/random/ivy.c optional rdrand_rng !random_loadable +dev/random/nehemiah.c optional padlock_rng !random_loadable dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 90f683f7a890..f9df5e04d04c 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -101,7 +101,7 @@ dev/ofw/ofw_standard.c optional aim powerpc dev/ofw/ofw_subr.c standard dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac dev/quicc/quicc_bfe_fdt.c optional quicc mpc85xx -dev/random/darn.c optional powerpc64 random +dev/random/darn.c optional powerpc64 random !random_loadable dev/scc/scc_bfe_macio.c optional scc powermac dev/sdhci/fsl_sdhci.c optional mpc85xx sdhci dev/sec/sec.c optional sec mpc85xx diff --git a/sys/dev/random/random_infra.c b/sys/dev/random/random_infra.c index 19973ac4b46d..a6090b54c454 100644 --- a/sys/dev/random/random_infra.c +++ b/sys/dev/random/random_infra.c @@ -196,9 +196,12 @@ read_random(void *buf, u_int len) bool is_random_seeded(void) { + bool result; + RANDOM_CONFIG_S_LOCK(); - random_reader_context.is_random_seeded(); + result = random_reader_context.is_random_seeded(); RANDOM_CONFIG_S_UNLOCK(); + return (result); } diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index 15311b9e6fbc..e78bf74f17c2 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -89,6 +89,7 @@ DRIVER_MODULE(virtio_random, virtio_pci, vtrnd_driver, vtrnd_devclass, vtrnd_modevent, 0); MODULE_VERSION(virtio_random, 1); MODULE_DEPEND(virtio_random, virtio, 1, 1, 1); +MODULE_DEPEND(virtio_random, random_device, 1, 1, 1); static int vtrnd_modevent(module_t mod, int type, void *unused)