All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Petr Vorel <pvorel@suse.cz>
Cc: linux-nfs <linux-nfs@vger.kernel.org>, Steve Dickson <steved@redhat.com>
Subject: Re: [PATCH 0/3] Add getrandom() fallback, cleanup headers
Date: Wed, 25 Oct 2023 22:13:00 +0200 (CEST)	[thread overview]
Message-ID: <857096093.3016.1698264780882.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20231025194701.456031-1-pvorel@suse.cz>

----- Ursprüngliche Mail -----
> Von: "Petr Vorel" <pvorel@suse.cz>
> I also wonder why getrandom() syscall does not called with GRND_NONBLOCK
> flag. Is it ok/needed to block?

With GRND_NONBLOCK it would return EAGAIN if not enough
randomness is ready. How to handle this then? Aborting the start of the daemon?

Before we other think the whole thing, the sole purpose of the getrandom()
call is seeding libc's PRNG with srand() to give every waiter a different
amount of sleep time upon concurrent database access.
See wait_for_dbaccess() and handling of SQLITE_LOCKED.

I'm pretty sure instead of seeding from getrandom() we can also use the current
time or read a few bytes from /dev/urandom.
Just make sure that every user of sqlite_plug_init() has a different seed.

Thanks,
//richard

  parent reply	other threads:[~2023-10-25 20:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 19:46 [PATCH 0/3] Add getrandom() fallback, cleanup headers Petr Vorel
2023-10-25 19:46 ` [PATCH 1/3] reexport/fsidd.c: Remove unused headers Petr Vorel
2023-10-25 19:47 ` [PATCH 2/3] support/reexport.c: " Petr Vorel
2023-10-25 19:56   ` Richard Weinberger
2023-10-25 19:47 ` [PATCH 3/3] support/backend_sqlite.c: Add getrandom() fallback Petr Vorel
2023-10-25 20:13 ` Richard Weinberger [this message]
2023-10-25 20:54   ` [PATCH 0/3] Add getrandom() fallback, cleanup headers Petr Vorel
2023-10-25 20:57     ` Petr Vorel
2023-11-13 16:51 ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=857096093.3016.1698264780882.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.