CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: riastradh Date: Mon Feb 10 07:13:06 UTC 2020 Modified Files: src/sys/rump/dev/lib/librnd: rnd_component.c Log Message: Omit duplicate rnd_init in rump. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/rump/dev/lib/librnd/rnd_component.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/rump/dev/lib/librnd/rnd_component.c diff -u src/sys/rump/dev/lib/librnd/rnd_component.c:1.5 src/sys/rump/dev/lib/librnd/rnd_component.c:1.6 --- src/sys/rump/dev/lib/librnd/rnd_component.c:1.5 Mon May 30 14:52:06 2016 +++ src/sys/rump/dev/lib/librnd/rnd_component.c Mon Feb 10 07:13:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd_component.c,v 1.5 2016/05/30 14:52:06 pooka Exp $ */ +/* $NetBSD: rnd_component.c,v 1.6 2020/02/10 07:13:06 riastradh Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.5 2016/05/30 14:52:06 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.6 2020/02/10 07:13:06 riastradh Exp $"); #include #include @@ -61,7 +61,6 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV) panic("cannot create /dev/urandom: %d", error); rump_pdev_add(rndattach, 4); - rnd_init(); } #if 0
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: pooka Date: Mon May 30 14:52:06 UTC 2016 Modified Files: src/sys/rump/dev/lib/librnd: rnd_component.c Log Message: Disable PR kern/51135 hack now that the problem is supposedly fixed (to see if tests pass). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/rump/dev/lib/librnd/rnd_component.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/rump/dev/lib/librnd/rnd_component.c diff -u src/sys/rump/dev/lib/librnd/rnd_component.c:1.4 src/sys/rump/dev/lib/librnd/rnd_component.c:1.5 --- src/sys/rump/dev/lib/librnd/rnd_component.c:1.4 Mon May 16 16:31:07 2016 +++ src/sys/rump/dev/lib/librnd/rnd_component.c Mon May 30 14:52:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd_component.c,v 1.4 2016/05/16 16:31:07 pooka Exp $ */ +/* $NetBSD: rnd_component.c,v 1.5 2016/05/30 14:52:06 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.4 2016/05/16 16:31:07 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.5 2016/05/30 14:52:06 pooka Exp $"); #include #include @@ -64,6 +64,7 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV) rnd_init(); } +#if 0 /* * XXX: the following hack works around PR kern/51135 and should ASAP be * nuked to and then from orbit. @@ -90,3 +91,4 @@ RUMP_COMPONENT(RUMP_COMPONENT_POSTINIT) panic("rnd_system_ioctl failed"); /* XXX */ } } +#endif
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: pooka Date: Mon May 16 16:31:07 UTC 2016 Modified Files: src/sys/rump/dev/lib/librnd: rnd_component.c Log Message: Add workaround for PR kern/51135 If the rnd component is present, load extra initial entropy to avoid /dev/random not being able to request it on demand. The extra initial entropy will allow a few instances of /dev/random, but will eventually go into the failure mode described in the PR. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/librnd/rnd_component.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/rump/dev/lib/librnd/rnd_component.c diff -u src/sys/rump/dev/lib/librnd/rnd_component.c:1.3 src/sys/rump/dev/lib/librnd/rnd_component.c:1.4 --- src/sys/rump/dev/lib/librnd/rnd_component.c:1.3 Tue Jan 26 23:12:16 2016 +++ src/sys/rump/dev/lib/librnd/rnd_component.c Mon May 16 16:31:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd_component.c,v 1.3 2016/01/26 23:12:16 pooka Exp $ */ +/* $NetBSD: rnd_component.c,v 1.4 2016/05/16 16:31:07 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.3 2016/01/26 23:12:16 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.4 2016/05/16 16:31:07 pooka Exp $"); #include #include @@ -63,3 +63,30 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV) rump_pdev_add(rndattach, 4); rnd_init(); } + +/* + * XXX: the following hack works around PR kern/51135 and should ASAP be + * nuked to and then from orbit. + */ +#define RNDPRELOAD 256 +#include +RUMP_COMPONENT(RUMP_COMPONENT_POSTINIT) +{ + rnddata_t *rd; + size_t dsize, i; + + CTASSERT(RNDPRELOAD <= sizeof(rd->data)); + + aprint_verbose("/dev/random: " + "loading initial entropy to workaround PR kern/51135\n"); + rd = kmem_alloc(sizeof(*rd), KM_SLEEP); + for (i = 0; i < RNDPRELOAD; i += dsize) { + if (rumpuser_getrandom(rd->data, + RNDPRELOAD-i, RUMPUSER_RANDOM_HARD, &dsize) != 0) + panic("rumpuser_getrandom failed"); /* XXX */ + rd->len = dsize; + rd->entropy = dsize*NBBY; + if (rnd_system_ioctl(NULL, RNDADDDATA, rd)) + panic("rnd_system_ioctl failed"); /* XXX */ + } +}
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: pooka Date: Thu Mar 13 01:52:37 UTC 2014 Modified Files: src/sys/rump/dev/lib/librnd: Makefile Added Files: src/sys/rump/dev/lib/librnd: rnd_component.c Removed Files: src/sys/rump/dev/lib/librnd: component.c Log Message: rename component.c -> rnd_component.c To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/rump/dev/lib/librnd/Makefile cvs rdiff -u -r1.4 -r0 src/sys/rump/dev/lib/librnd/component.c cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/lib/librnd/rnd_component.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/rump/dev/lib/librnd/Makefile diff -u src/sys/rump/dev/lib/librnd/Makefile:1.6 src/sys/rump/dev/lib/librnd/Makefile:1.7 --- src/sys/rump/dev/lib/librnd/Makefile:1.6 Thu Feb 2 19:43:08 2012 +++ src/sys/rump/dev/lib/librnd/Makefile Thu Mar 13 01:52:37 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2012/02/02 19:43:08 tls Exp $ +# $NetBSD: Makefile,v 1.7 2014/03/13 01:52:37 pooka Exp $ # .PATH: ${.CURDIR}/../../../../dev @@ -7,7 +7,7 @@ LIB= rumpdev_rnd SRCS= rndpseudo.c -SRCS+= component.c +SRCS+= rnd_component.c # sys/rump/Makefile.rump sets CPPFLAGS+= -DCOMPAT_50=1, # so we need rndpseudo_50.c from the compat/common directory. Added files: Index: src/sys/rump/dev/lib/librnd/rnd_component.c diff -u /dev/null src/sys/rump/dev/lib/librnd/rnd_component.c:1.1 --- /dev/null Thu Mar 13 01:52:37 2014 +++ src/sys/rump/dev/lib/librnd/rnd_component.c Thu Mar 13 01:52:37 2014 @@ -0,0 +1,65 @@ +/* $NetBSD: rnd_component.c,v 1.1 2014/03/13 01:52:37 pooka Exp $ */ + +/* + * Copyright (c) 2009 Antti Kantee. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: rnd_component.c,v 1.1 2014/03/13 01:52:37 pooka Exp $"); + +#include +#include +#include +#include +#include + +#include "rump_private.h" +#include "rump_dev_private.h" +#include "rump_vfs_private.h" + +void rndattach(int); + +RUMP_COMPONENT(RUMP_COMPONENT_DEV) +{ + extern const struct cdevsw rnd_cdevsw; + devmajor_t bmaj, cmaj; + int error; + + /* go, mydevfs */ + bmaj = cmaj = -1; + + if ((error = devsw_attach("random", NULL, &bmaj, + &rnd_cdevsw, &cmaj)) != 0) + panic("cannot attach rnd: %d", error); + + if ((error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/random", + cmaj, RND_DEV_RANDOM)) != 0) + panic("cannot create /dev/random: %d", error); + if ((error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/urandom", + cmaj, RND_DEV_URANDOM)) != 0) + panic("cannot create /dev/urandom: %d", error); + + rump_pdev_add(rndattach, 4); + rnd_init(); +}
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: apb Date: Tue Dec 20 17:09:04 UTC 2011 Modified Files: src/sys/rump/dev/lib/librnd: Makefile Log Message: Put the path to the compat/common directory in a .PATH line, not in an element of the SRCS list. This should fix a problem in which build products were created in the source tree. Also add a comment about where COMPAT_50 is defined. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/rump/dev/lib/librnd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/dev/lib/librnd/Makefile diff -u src/sys/rump/dev/lib/librnd/Makefile:1.4 src/sys/rump/dev/lib/librnd/Makefile:1.5 --- src/sys/rump/dev/lib/librnd/Makefile:1.4 Mon Dec 19 21:56:18 2011 +++ src/sys/rump/dev/lib/librnd/Makefile Tue Dec 20 17:09:04 2011 @@ -1,15 +1,19 @@ -# $NetBSD: Makefile,v 1.4 2011/12/19 21:56:18 apb Exp $ +# $NetBSD: Makefile,v 1.5 2011/12/20 17:09:04 apb Exp $ # .PATH: ${.CURDIR}/../../../../dev LIB= rumpdev_rnd -SRCS= rnd.c rndpseudo.c rndpool.c -SRCS+= ${.CURDIR}/../../../../compat/common/rndpseudo_50.c +SRCS= rnd.c rndpseudo.c rndpool.c SRCS+= component.c +# sys/rump/Makefile.rump sets CPPFLAGS+= -DCOMPAT_50=1, +# so we need rndpseudo_50.c from the compat/common directory. +.PATH: ${.CURDIR}/../../../../compat/common +SRCS+= rndpseudo_50.c + CPPFLAGS+= -I${RUMPTOP}/librump/rumpvfs .include
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: apb Date: Mon Dec 19 21:56:18 UTC 2011 Modified Files: src/sys/rump/dev/lib/librnd: Makefile Log Message: SRCS += ${.CURDIR}/../../../../compat/common/rndpseudo_50.c to fix build errors like this: DESTDIR/usr/lib/librumpdev_rnd.so: undefined reference to `rumpns_compat_50_rnd_ioctl' To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/librnd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/dev/lib/librnd/Makefile diff -u src/sys/rump/dev/lib/librnd/Makefile:1.3 src/sys/rump/dev/lib/librnd/Makefile:1.4 --- src/sys/rump/dev/lib/librnd/Makefile:1.3 Sat Dec 17 20:05:39 2011 +++ src/sys/rump/dev/lib/librnd/Makefile Mon Dec 19 21:56:18 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2011/12/17 20:05:39 tls Exp $ +# $NetBSD: Makefile,v 1.4 2011/12/19 21:56:18 apb Exp $ # .PATH: ${.CURDIR}/../../../../dev @@ -6,6 +6,7 @@ LIB= rumpdev_rnd SRCS= rnd.c rndpseudo.c rndpool.c +SRCS+= ${.CURDIR}/../../../../compat/common/rndpseudo_50.c SRCS+= component.c
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: pooka Date: Mon Apr 26 09:47:46 UTC 2010 Modified Files: src/sys/rump/dev/lib/librnd: component.c Log Message: ungrossify To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/librnd/component.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/rump/dev/lib/librnd/component.c diff -u src/sys/rump/dev/lib/librnd/component.c:1.3 src/sys/rump/dev/lib/librnd/component.c:1.4 --- src/sys/rump/dev/lib/librnd/component.c:1.3 Mon Mar 1 13:12:20 2010 +++ src/sys/rump/dev/lib/librnd/component.c Mon Apr 26 09:47:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: component.c,v 1.3 2010/03/01 13:12:20 pooka Exp $ */ +/* $NetBSD: component.c,v 1.4 2010/04/26 09:47:46 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.3 2010/03/01 13:12:20 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.4 2010/04/26 09:47:46 pooka Exp $"); #include #include @@ -53,12 +53,11 @@ &rnd_cdevsw, &cmaj)) != 0) panic("cannot attach rnd: %d", error); - /* XXX: truly hideous interface abuse */ - if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/random", 0, - cmaj, RND_DEV_RANDOM, 1)) != 0) + if ((error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/random", + cmaj, RND_DEV_RANDOM)) != 0) panic("cannot create /dev/random: %d", error); - if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/urandom", 0, - cmaj, RND_DEV_URANDOM, 1)) != 0) + if ((error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/urandom", + cmaj, RND_DEV_URANDOM)) != 0) panic("cannot create /dev/urandom: %d", error); rump_pdev_add(rndattach, 4);
CVS commit: src/sys/rump/dev/lib/librnd
Module Name:src Committed By: pooka Date: Tue Sep 8 20:12:52 UTC 2009 Added Files: src/sys/rump/dev/lib/librnd: Makefile component.c shlib_version Log Message: add rump rnd device component To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/lib/librnd/Makefile \ src/sys/rump/dev/lib/librnd/component.c \ src/sys/rump/dev/lib/librnd/shlib_version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/rump/dev/lib/librnd/Makefile diff -u /dev/null src/sys/rump/dev/lib/librnd/Makefile:1.1 --- /dev/null Tue Sep 8 20:12:52 2009 +++ src/sys/rump/dev/lib/librnd/Makefile Tue Sep 8 20:12:52 2009 @@ -0,0 +1,16 @@ +# $NetBSD: Makefile,v 1.1 2009/09/08 20:12:52 pooka Exp $ +# + +.PATH: ${.CURDIR}/../../../../dev + +LIB= rumpdev_rnd + +SRCS= rnd.c rndpool.c + +SRCS+= component.c + +CPPFLAGS+= -Wno-pointer-sign +CPPFLAGS+= -I${RUMPTOP}/librump/rumpvfs + +.include +.include Index: src/sys/rump/dev/lib/librnd/component.c diff -u /dev/null src/sys/rump/dev/lib/librnd/component.c:1.1 --- /dev/null Tue Sep 8 20:12:52 2009 +++ src/sys/rump/dev/lib/librnd/component.c Tue Sep 8 20:12:52 2009 @@ -0,0 +1,66 @@ +/* $NetBSD: component.c,v 1.1 2009/09/08 20:12:52 pooka Exp $ */ + +/* + * Copyright (c) 2009 Antti Kantee. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/09/08 20:12:52 pooka Exp $"); + +#include +#include +#include +#include +#include + +#include "rump_dev_private.h" +#include "rump_vfs_private.h" + +void rndattach(int); + +void +rump_dev_rnd_init() +{ + extern const struct cdevsw rnd_cdevsw; + devmajor_t bmaj, cmaj; + int error; + + /* go, mydevfs */ + bmaj = cmaj = -1; + + if ((error = devsw_attach("random", NULL, &bmaj, + &rnd_cdevsw, &cmaj)) != 0) + panic("cannot attach rnd: %d", error); + + /* XXX: truly hideous interface abuse */ + if ((error = rump_vfs_makedevnodes(S_IFCHR, "random", 0, + cmaj, RND_DEV_RANDOM, 1)) != 0) + panic("cannot create /dev/random: %d", error); + if ((error = rump_vfs_makedevnodes(S_IFCHR, "urandom", 0, + cmaj, RND_DEV_URANDOM, 1)) != 0) + panic("cannot create /dev/urandom: %d", error); + + rump_pdev_add(rndattach, 4); + rnd_init(); +} Index: src/sys/rump/dev/lib/librnd/shlib_version diff -u /dev/null src/sys/rump/dev/lib/librnd/shlib_version:1.1 --- /dev/null Tue Sep 8 20:12:52 2009 +++ src/sys/rump/dev/lib/librnd/shlib_version Tue Sep 8 20:12:52 2009 @@ -0,0 +1,4 @@ +# $NetBSD: shlib_version,v 1.1 2009/09/08 20:12:52 pooka Exp $ +# +major=0 +minor=0