Code Monkey home page Code Monkey logo

Comments (14)

nhorman avatar nhorman commented on August 16, 2024

run rngd -f -d instead of running it via systemd while the system is up, then kill it with a SIGTERM from another terminal and send me the output of that

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

screenlog.txt

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

Ok description:

if I kill rngd before

jent_read_entropy time on cpu 0 is 1.265280712500e+01 sec

-> you have the first case

Initializing available sources
Initializing entropy source hwrng
Limiting thread count to 2 active cpus
JITTER starts 2 threads
JITTER thread on cpu 0 wakes up for refill
JITTER thread on cpu 1 wakes up for refill
Terminated

Instead if I wait after

Pool full at 4096, sleeping!

I got

Checking on done for thread 0

jent_read_entropy time on cpu 1 is 1.045238600000e+01 sec

Writing to pipe

DONE Writing to pipe with return -1

Error on pipe write: Bad file descriptor

jent_read_entropy time on cpu 0 is 3.505968987500e+01 sec

Writing to pipe

DONE Writing to pipe with return -1

Error on pipe write: Bad file descriptor

Closing thread 0

Checking on done for thread 1

Closing thread 1

but before the closing thread message is very slow

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

Also If I execute

rngd -d -l
Entropy sources that are available but disabled

1: TPM RNG Device (tpm)

and get stuck for a while
then it prints


Available and enabled entropy sources:

0: Hardware RNG Device (hwrng)

5: JITTER Entropy generator (jitter)

Checking on done for thread 0

but if I type

rngd -d -x jitter -l

is very fast

Disabling 5: JITTER Entropy generator (jitter)

Entropy sources that are available but disabled

1: TPM RNG Device (tpm)

5: JITTER Entropy generator (jitter)

Available and enabled entropy sources:

0: Hardware RNG Device (hwrng)

from rng-tools.

nhorman avatar nhorman commented on August 16, 2024

you don't have to disable jittier, thats where the problem is that we want to debug.

That said, I'm not sure how this is happening, on my system as soon as close the read side of the pipe, all the writers return immediately with the EBADF error, causing them to break out of their loop and exit.

Let me ask you, when you say "very slow" do you remember about how long it took to exit? Was it approximately 35 seconds?

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024
time rngd -l
Entropy sources that are available but disabled

1: TPM RNG Device (tpm)

Available and enabled entropy sources:

0: Hardware RNG Device (hwrng)

5: JITTER Entropy generator (jitter)

Command terminated by signal 2
real    0m 12.59s
user    0m 21.41s
sys     0m 3.28s
time rngd -l -x jitter
Disabling 5: JITTER Entropy generator (jitter)

Entropy sources that are available but disabled

1: TPM RNG Device (tpm)

5: JITTER Entropy generator (jitter)

Available and enabled entropy sources:

0: Hardware RNG Device (hwrng)

Command exited with non-zero status 1
real    0m 0.00s
user    0m 0.00s
sys     0m 0.00s

from rng-tools.

nhorman avatar nhorman commented on August 16, 2024

ok, I think I know whats happening. if you look at
#67 (comment)

You'll see that the time spend generating entropy in the jitterentropy daemon is :
jent_read_entropy time on cpu 0 is 3.505968987500e+01 sec

Thats about 35 seconds, While sending pthread_kill(SIGINT) to the writer thread will make it break the loop if its blocked on a write, it won't cause it to return early from that generation function, meaning that you have to wait for some part of that 35 seconds to break out of the loop and exit. Thats not strictly speaking wrong, but it is a bit of an irritant. I might could try to square that up with some setjmp/longjump magic, but I'm not sure.

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

Ok my issue is that rngd get stuck on reboot
Now I have to look at another issue for now I disabled jitter and is working fine

I will try to add more printf and debug again (sadly is quite difficult to add gdb to this system :-( )

from rng-tools.

nhorman avatar nhorman commented on August 16, 2024

https://github.com/nhorman/rng-tools/tree/early-jitter-exit

I've created the new branch above, which uses sigsetjmp/siglongjump to effect an early return from jent_read_entropy, which should allow for earlier exiting from threads that are delayed by the gathering of entropy from the jitter library. Please build that branch and give it a try with jitterentropy enabled. If it works for you I'll merge it.

from rng-tools.

nhorman avatar nhorman commented on August 16, 2024

ping, any update?

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

Testing it now

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

no differences.

from rng-tools.

nicola-lunghi avatar nicola-lunghi commented on August 16, 2024

I will try to look at this next week (now I'm stuck with another issue).
if you want you can close it and I will reopen it with more debug information.

from rng-tools.

nhorman avatar nhorman commented on August 16, 2024

ok, saying no differences without additional information doesn't help. I'm going to add some debug information to this branch. I'll leave this open and when you have time, please run rngd with -d so debug information is recorded in the logs, and send that in.

from rng-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.