Bug 263750 - random_fortuna: standalone module build broken in stable/12
Summary: random_fortuna: standalone module build broken in stable/12
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.3-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-03 09:06 UTC by Eugene Grosbein
Modified: 2022-05-03 20:29 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2022-05-03 09:06:09 UTC
cd /home/src/sys/modules/random_fortuna

/home/src/sys/dev/random/randomdev.c:70:13: error: conflicting types for 'read_random_uio'
static int (read_random_uio)(struct uio *, bool);
            ^
/home/src/sys/sys/random.h:73:1: note: previous definition is here
read_random_uio(void *a __unused, u_int b __unused)
^
/home/src/sys/dev/random/randomdev.c:96:2: error: use of undeclared identifier '_read_random_uio'
        _read_random_uio = (read_random_uio);
        ^
/home/src/sys/dev/random/randomdev.c:97:2: error: use of undeclared identifier '_read_random'
        _read_random = (read_random);
        ^
/home/src/sys/dev/random/randomdev.c:98:2: error: use of undeclared identifier '_is_random_seeded'
        _is_random_seeded = (is_random_seeded);
        ^
/home/src/sys/dev/random/randomdev.c:160:2: error: conflicting types for 'read_random_uio'
(read_random_uio)(struct uio *uio, bool nonblock)
 ^
/home/src/sys/sys/random.h:73:1: note: previous definition is here
read_random_uio(void *a __unused, u_int b __unused)
^
/home/src/sys/dev/random/randomdev.c:261:2: error: redefinition of 'read_random'
(read_random)(void *random_buf, u_int len)
 ^
/home/src/sys/sys/random.h:78:1: note: previous definition is here
read_random(void *a __unused, u_int b __unused)
^
/home/src/sys/dev/random/randomdev.c:295:2: error: redefinition of 'is_random_seeded'
(is_random_seeded)(void)
 ^
/home/src/sys/sys/random.h:82:1: note: previous definition is here
is_random_seeded(void)
^
7 errors generated.
*** Error code 1
Comment 1 Eugene Grosbein freebsd_committer freebsd_triage 2022-05-03 09:07:09 UTC
First line should be:

cd /home/src/sys/modules/random_fortuna && make
Comment 2 Eugene Grosbein freebsd_committer freebsd_triage 2022-05-03 09:12:25 UTC
It seems the following trivial patch should be enough to fix this.

--- sys/modules/random_fortuna/Makefile.orig        2022-05-03 16:11:02.665565000 +0700
+++ sys/modules/random_fortuna/Makefile     2022-05-03 16:10:55.497517000 +0700
@@ -6,6 +6,6 @@
 SRCS   = randomdev.c hash.c fortuna.c
 SRCS   += opt_param.h bus_if.h device_if.h
 SRCS   += opt_ddb.h
-CFLAGS += -DRANDOM_LOADABLE
+CFLAGS += -DDEV_RANDOM -DRANDOM_LOADABLE

 .include <bsd.kmod.mk>
--- sys/modules/random_other/Makefile.orig  2022-05-03 16:09:34.601209000 +0700
+++ sys/modules/random_other/Makefile       2022-05-03 16:08:59.489104000 +0700
@@ -6,6 +6,6 @@
 SRCS   = randomdev.c hash.c other_algorithm.c
 SRCS   += opt_param.h bus_if.h device_if.h
 SRCS   += opt_ddb.h
-CFLAGS += -DRANDOM_LOADABLE
+CFLAGS += -DDEV_RANDOM -DRANDOM_LOADABLE

 .include <bsd.kmod.mk>
Comment 3 jhs 2022-05-03 16:28:00 UTC
I jhs@ confirm the logic of patch marked Comment2 2022-05-03 09:12:25 UTC
However the patch has to be applied manually as tabs seem to have been converted to spaces before th patch was generated.
Thanks
Comment 4 Ed Maste freebsd_committer freebsd_triage 2022-05-03 19:55:55 UTC
Aha, not an issue on stable/13 and later, after

    sys: Remove DEV_RANDOM device option
    
    Remove 'device random' from kernel configurations that reference it (most).
    Replace perhaps mistaken 'nodevice random' in two MIPS configs with 'options
    RANDOM_LOADABLE' instead.  Document removal in UPDATING; update NOTES and
    random.4.
    
    Reviewed by:    delphij, markm (previous version)
    Approved by:    secteam(delphij)
    Differential Revision:  https://reviews.freebsd.org/D19918
Comment 5 Ed Maste freebsd_committer freebsd_triage 2022-05-03 20:02:20 UTC
(In reply to Eugene Grosbein from comment #2)
Patch LGTM, please commit to stable/12.
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-05-03 20:29:13 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=487fcaf8e9b7b7faabdbcbf0293ed09d1de95889

commit 487fcaf8e9b7b7faabdbcbf0293ed09d1de95889
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2022-05-03 20:23:22 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2022-05-03 20:28:49 +0000

    random_fortuna, random_other: unbreak standalone module build

    This is direct commit to stable/12 as newer branches
    do not have the problem.

    PR:             263750
    Reviewed by:    emaste
    Tested by:      Julian H. Stacey <jhs at berklix.com>

 sys/modules/random_fortuna/Makefile | 2 +-
 sys/modules/random_other/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)