Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rng-tools for openSUSE:Factory 
checked in at 2022-03-31 17:18:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rng-tools (Old)
 and      /work/SRC/openSUSE:Factory/.rng-tools.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rng-tools"

Thu Mar 31 17:18:47 2022 rev:50 rq:966169 version:6.15

Changes:
--------
--- /work/SRC/openSUSE:Factory/rng-tools/rng-tools.changes      2021-11-20 
02:40:24.100530398 +0100
+++ /work/SRC/openSUSE:Factory/.rng-tools.new.1900/rng-tools.changes    
2022-03-31 17:19:22.512807453 +0200
@@ -1,0 +2,14 @@
+Sun Mar 27 19:45:51 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 6.15:
+  * Adjust rngtests for better behavior in travis
+  * fix use of non-posix setaffinity call to allow building on strict posix
+    (musl) systems
+  * Add armv6l to list of detected arches for pkcs11
+  * misc fixes to allow building on libc-musl
+  * fix a deadlock in jitter shutdown sequence
+  * minor warning fixups (unused variables)
+  * improve cpu detection code
+  * improve jitter cpu monopolization on small/single cpu systems 
+
+-------------------------------------------------------------------

Old:
----
  v6.14.tar.gz

New:
----
  v6.15.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rng-tools.spec ++++++
--- /var/tmp/diff_new_pack.Xg7qCN/_old  2022-03-31 17:19:23.100800821 +0200
+++ /var/tmp/diff_new_pack.Xg7qCN/_new  2022-03-31 17:19:23.104800776 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rng-tools
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir 
udev)/rules.d }
 Name:           rng-tools
-Version:        6.14
+Version:        6.15
 Release:        0
 Summary:        Support daemon for hardware random device
 License:        GPL-3.0-or-later

++++++ v6.14.tar.gz -> v6.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rng-tools-6.14/configure.ac 
new/rng-tools-6.15/configure.ac
--- old/rng-tools-6.14/configure.ac     2021-08-09 17:08:57.000000000 +0200
+++ new/rng-tools-6.15/configure.ac     2022-02-09 14:21:54.000000000 +0100
@@ -17,7 +17,7 @@
 dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  
USA
 
-AC_INIT(rng-tools, 6.14, [Neil Horman <nhor...@tuxdriver.com>])
+AC_INIT(rng-tools, 6.15, [Neil Horman <nhor...@tuxdriver.com>])
 AC_PREREQ(2.52)
 AC_CONFIG_SRCDIR([rngd.c])
 AC_CANONICAL_HOST
@@ -25,6 +25,7 @@
 AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_HEADERS([rng-tools-config.h])
 AC_CONFIG_MACRO_DIRS([m4])
+AC_USE_SYSTEM_EXTENSIONS
 
 dnl Parse options
 
@@ -100,6 +101,12 @@
        ], [AC_MSG_NOTICE([Disabling JITTER entropy source])]
 )
 
+AC_CHECK_DECL(pthread_attr_setaffinity_np,
+               [AC_DEFINE([HAVE_PTHREAD_ATTR_SETAFFINITY], 1,[Set 
ATTR_SETAFFINITY])],
+               [ AC_CHECK_DECL(pthread_setaffinity_np,
+                  [AC_DEFINE([HAVE_PTHREAD_SETAFFINITY],1, [Set 
PTHREAD_SETAFFINITY])], [ AC_MSG_ERROR([Neither pthread_setaffinity_np nor 
pthread_attr_setaffinity_np found])],[[#include <pthread.h>]])
+               ], [[#include <pthread.h>]])
+
 AS_IF(
        [ test "x$with_nistbeacon" != "xno"],
        [
@@ -117,7 +124,7 @@
                PKG_CHECK_MODULES([libcrypto], [libcrypto], [], 
[AC_MSG_ERROR([libcrypto is required])])
                AC_DEFINE([HAVE_PKCS11],1,[Enable PKCS11])
                AS_CASE([$host_cpu],
-                       [i?86|armv7hl],
+                       [i?86|armv7hl|armv6l],
                        [
                                PKCS11_ENGINE=/usr/lib/opensc-pkcs11.so
                        ],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rng-tools-6.14/rngd.c new/rng-tools-6.15/rngd.c
--- old/rng-tools-6.14/rngd.c   2021-08-09 17:08:57.000000000 +0200
+++ new/rng-tools-6.15/rngd.c   2022-02-09 14:21:54.000000000 +0100
@@ -924,7 +924,7 @@
 
        if (!ent_sources) {
                message(LOG_DAEMON|LOG_ERR,
-                       "can't open any entropy source");
+                       "Can't open any entropy source\n");
                message(LOG_DAEMON|LOG_ERR,
                        "Maybe RNG device modules are not loaded\n");
                return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rng-tools-6.14/rngd_jitter.c 
new/rng-tools-6.15/rngd_jitter.c
--- old/rng-tools-6.14/rngd_jitter.c    2021-08-09 17:08:57.000000000 +0200
+++ new/rng-tools-6.15/rngd_jitter.c    2022-02-09 14:21:54.000000000 +0100
@@ -46,7 +46,7 @@
 {
        struct jent_notime_ctx *thread_ctx = (struct jent_notime_ctx *)ctx;
        int ret;
-       int i;
+       long i;
        cpu_set_t *cpus;
        size_t cpusize;
 
@@ -60,19 +60,32 @@
        /*
         * the soft timer function should affine to all cpus
         */
-       i = sysconf(_SC_NPROCESSORS_CONF);
+       i = sysconf(_SC_NPROCESSORS_ONLN);
        cpus = CPU_ALLOC(i);
        cpusize = CPU_ALLOC_SIZE(i);
        CPU_ZERO_S(cpusize, cpus);
-       for(i=i-1;i>=0;i--) {
-               CPU_SET(i,cpus);
+       for(i=i-1; i>=0; i--) {
+               CPU_SET(i, cpus);
        }
-       pthread_attr_setaffinity_np(&thread_ctx->notime_pthread_attr, cpusize, 
cpus);
 
+        /*
+        * Note that only one of:
+        * HAVE_PTHREAD_ATTR_SETAFFINITY
+        * and
+        * HAVE_PTHREAD_SETAFFINITY
+        * Will ever be set, as per the configure.ac logic
+        */
+#ifdef HAVE_PTHREAD_ATTR_SETAFFINITY
+       pthread_attr_setaffinity_np(&thread_ctx->notime_pthread_attr, cpusize, 
cpus);
+#endif
        ret = -pthread_create(&thread_ctx->notime_thread_id,
                                &thread_ctx->notime_pthread_attr,
                                start_routine, arg);
 
+#ifdef HAVE_PTHREAD_SETAFFINITY
+       pthread_setaffinity_np(thread_ctx->notime_thread_id, cpusize, cpus);
+#endif
+
        CPU_FREE(cpus);
        return ret;
 }
@@ -85,9 +98,20 @@
        pthread_attr_destroy(&thread_ctx->notime_pthread_attr);
 }
 
-
 static int rngd_notime_init(void **ctx)
 {
+       long ncpu = sysconf(_SC_NPROCESSORS_ONLN);
+
+       if (ncpu == -1)
+               return -errno;
+
+       if (ncpu == 0)
+               return -EFAULT;
+
+       // Don't allow for software thread if there is only a single cpu
+       if (ncpu < 2)
+               return -EOPNOTSUPP;
+
        using_soft_timer = true;
        return jent_notime_init(ctx);
 }
@@ -105,8 +129,9 @@
 #define RDRAND_ROUNDS           512             /* 512:1 data reduction */
 
 static int num_threads = 0;
+
 struct thread_data {
-        struct rng *ent_src;
+       struct rng *ent_src;
        int core_id;
        int pipe_fd;
        struct rand_data *ec;
@@ -118,7 +143,7 @@
        /* done states -1 : init, 0 : ready, 1 : complete */
        int done;
        struct timespec slptm;
-       sigjmp_buf      jmpbuf;
+       sigjmp_buf jmpbuf;
 };
 
 
@@ -192,8 +217,8 @@
        if (start->tv_nsec >= end->tv_nsec)
                delta = (delta * 1.0e9) + (start->tv_nsec - end->tv_nsec);
        else
-               delta = ((delta + 1) * 1.0e9) + (end->tv_nsec - 
start->tv_nsec);        
-       delta = delta / 1.0e9; 
+               delta = ((delta + 1) * 1.0e9) + (end->tv_nsec - start->tv_nsec);
+       delta = delta / 1.0e9;
 
        return delta;
 }
@@ -202,7 +227,6 @@
                                     struct timespec *start,
                                     struct timespec *end)
 {
-
        /*
         * if slpmode is anything other than -1
         * it will be a positive integer representing
@@ -233,6 +257,7 @@
 
 static void *thread_entropy_task(void *data)
 {
+       sigset_t blockset;
        cpu_set_t cpuset;
 
        ssize_t ret;
@@ -242,9 +267,15 @@
        int written;
        /* STARTUP */
 
+       sigemptyset(&blockset);
+       sigaddset(&blockset, SIGINT);
+       sigaddset(&blockset, SIGTERM);
+       sigaddset(&blockset, SIGALRM);
+       pthread_sigmask(SIG_BLOCK, &blockset, NULL);
+
        /*
         * Set our timeout value
-        * -1 means adaptive, i.e. sleep for the last 
+        * -1 means adaptive, i.e. sleep for the last
         * recorded execution time of a jitter read
         * otherwise sleep for slpmode seconds
         */
@@ -265,7 +296,7 @@
        }
 
        /*
-        * A signal will call siglongjmp and return us here when we exit 
+        * A signal will call siglongjmp and return us here when we exit
         */
        if (sigsetjmp(me->jmpbuf, 1))
                goto out_interrupt;
@@ -321,7 +352,9 @@
        int refill = ent_src->rng_options[JITTER_OPT_REFILL].int_val;
        int delay = ent_src->rng_options[JITTER_OPT_RETRY_DELAY].int_val;
        int rcount = ent_src->rng_options[JITTER_OPT_RETRY_COUNT].int_val;
+#ifndef HAVE_JITTER_NOTIME
        int soft_timer = 
ent_src->rng_options[JITTER_OPT_FORCE_INT_TIMER].int_val;
+#endif
 
        /* Need at least one thread to do this work */
        if (!threads) {
@@ -354,7 +387,6 @@
        return 0;
 }
 
-
 /*
  * Init JITTER
  */
@@ -362,7 +394,7 @@
 {
        cpu_set_t *cpus;
        size_t cpusize;
-       int i;
+       long i;
        int size;
        int flags;
        int entflags = 0;
@@ -386,7 +418,7 @@
 #endif
 
        ret = jent_entropy_init();
-       if(ret) {
+       if (ret) {
                message_entsrc(ent_src,LOG_DAEMON|LOG_WARNING, "JITTER rng 
fails with code %d\n", ret);
                return 1;
        }
@@ -401,13 +433,13 @@
         * 2 threads for two or more cpus
         * 4 threads for four or more cpus
         */
-       i = sysconf(_SC_NPROCESSORS_CONF);
+       i = sysconf(_SC_NPROCESSORS_ONLN);
        cpus = CPU_ALLOC(i);
        cpusize = CPU_ALLOC_SIZE(i);
        CPU_ZERO_S(cpusize, cpus);
        if (sched_getaffinity(0, cpusize, cpus) < 0) {
                message_entsrc(ent_src,LOG_DAEMON|LOG_DEBUG, "Can not determine 
affinity of process, defaulting to 1 thread\n");
-               CPU_SET(0,cpus);
+               CPU_SET(0, cpus);
        }
 
        num_threads = CPU_COUNT_S(cpusize, cpus);
@@ -447,6 +479,14 @@
                core_id++;
                tdata[i].buf_sz = 
ent_src->rng_options[JITTER_OPT_BUF_SZ].int_val;
                tdata[i].ec = jent_entropy_collector_alloc(1, entflags);
+               if (tdata[i].ec == NULL) {
+                       message_entsrc(ent_src,LOG_DAEMON|LOG_WARNING, "Unable 
to start thread for jitter, likely due to lack of cpu count\n");
+                       close(pipefds[0]);
+                       close(pipefds[1]);
+                       free(tdata);
+                       free(threads);
+                       return 1;
+               }
                tdata[i].slpmode = 
ent_src->rng_options[JITTER_OPT_RETRY_DELAY].int_val;
                pthread_create(&threads[i], NULL, thread_entropy_task, 
&tdata[i]);
                pthread_mutex_lock(&tdata[i].statemtx);
@@ -454,9 +494,9 @@
                        pthread_cond_wait(&tdata[i].statecond, 
&tdata[i].statemtx);
                if (tdata[i].done == 1)
                        /* we failed during startup */
-                       message_entsrc(ent_src, LOG_DAEMON|LOG_DEBUG, "CPU 
thread %d failed\n", i);
+                       message_entsrc(ent_src, LOG_DAEMON|LOG_DEBUG, "CPU 
thread %ld failed\n", i);
                else
-                       message_entsrc(ent_src,LOG_DAEMON|LOG_DEBUG, "CPU 
Thread %d is ready\n", i);
+                       message_entsrc(ent_src,LOG_DAEMON|LOG_DEBUG, "CPU 
Thread %ld is ready\n", i);
                pthread_mutex_unlock(&tdata[i].statemtx);
                if (using_soft_timer == true) {
                        num_threads = 1;
@@ -516,10 +556,10 @@
 
        /* And wait for completion of each thread */
        for (i=0; i < num_threads; i++) {
-               /* Signal the threads to exit */
-               pthread_kill(threads[i], SIGUSR1);
                /* and wait for them to shutdown */
                pthread_mutex_lock(&tdata[i].statemtx);
+               pthread_kill(threads[i], SIGUSR1);
+               /* Signal the threads to exit */
                if (!tdata[i].done) {
                        message_entsrc(ent_src,LOG_DAEMON|LOG_DEBUG, "Checking 
on done for thread %d\n", i);
                        pthread_cond_wait(&tdata[i].statecond, 
&tdata[i].statemtx);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rng-tools-6.14/tests/rngtestjitter.sh 
new/rng-tools-6.15/tests/rngtestjitter.sh
--- old/rng-tools-6.14/tests/rngtestjitter.sh   2021-08-09 17:08:57.000000000 
+0200
+++ new/rng-tools-6.15/tests/rngtestjitter.sh   2022-02-09 14:21:54.000000000 
+0100
@@ -1,11 +1,13 @@
 #!/bin/sh
 
-# Test that we catch a repeating zero failure in rngtest
-./rngd -f -o /dev/stdout -x hwrng -x rdrand -x tpm -O jitter:use_aes:1 | 
../rngtest -c 100 --pipe > /dev/null
-if [ $? -eq 0 ]
-then
-       exit 1
-fi
+kill_rngd() {
+       sleep 15
+       echo "killing"
+       killall -9 rngd
+}
+
+kill_rngd &
+
+../rngd -f -o /dev/stdout -x hwrng -x rdrand -x tpm -O jitter:use_aes:1 | 
../rngtest -c 100 --pipe > /dev/null
 
-exit 0
 

Reply via email to