Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libshmif shmif: use cprng_strong64 instead ...



details:   https://anonhg.NetBSD.org/src/rev/b28c472c9bfc
branches:  trunk
changeset: 745199:b28c472c9bfc
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Feb 25 03:24:48 2020 +0000

description:
shmif: use cprng_strong64 instead of cprng_fast64 to generate a unique ID

shmif uses random bytes generated by cprng(9) as a unique device ID
between rump kernels to identify packets fed by itself and not receive
them.  So if generated bytes are identical between shmif interfaces on
different rump kernels, shmif may drop incoming packets unintentionally.
This is one cause of recent ATF test failures of IPsec.

Fix it by using cprng_strong64 instead of cprng_fast64.  This is a
workaround and we should also investigate why cprng_fast64 starts
failing on rump kernels, although using cprng_strong64 in initialization
itself is feasible.

Fix PR kern/54897

diffstat:

 sys/rump/net/lib/libshmif/if_shmem.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 23647c7c5241 -r b28c472c9bfc sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c      Tue Feb 25 00:42:12 2020 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c      Tue Feb 25 03:24:48 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $    */
+/*     $NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -172,7 +172,7 @@
        sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_memfd = -1;
        sc->sc_unit = unit;
-       sc->sc_uuid = cprng_fast64();
+       sc->sc_uuid = cprng_strong64();
 
        ifp = &sc->sc_ec.ec_if;
 



Home | Main Index | Thread Index | Old Index