public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29437] New: arc4random is too slow
@ 2022-08-02 10:46 mlichvar at redhat dot com
  2022-08-02 11:03 ` [Bug libc/29437] " fweimer at redhat dot com
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: mlichvar at redhat dot com @ 2022-08-02 10:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29437

            Bug ID: 29437
           Summary: arc4random is too slow
           Product: glibc
           Version: 2.36
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mlichvar at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The new arc4random using getrandom() seems to have a significant impact on
performance of chronyd operating as an NTP server. On an Intel E3-1220 CPU, I
see that the maximum number of requests per second dropped by about 25%. That
would be an issue for some public NTP servers.

chronyd needs a random generator for the low-order bits below the clock
precision in the receive and transmit timestamps to make them less predictable
and make off-path attacks more difficult. The generator doesn't necessarily
have to be cryptographically secure.

The assumption in the code is that arc4random is fast and buffered, as it is on
FreeBSD for instance. It is preferred over getrandom(), for which chrony has to
implement its own buffering. With arc4random using getrandom() and no buffering
the number of syscalls needed per NTP request is now almost doubled.

This can be fixed easily in the chrony source code, but I thought it might be a
good example of a real-world application impacted by this change and there
could be others.

If the plan is to fix this by adding getrandom() to the Linux vDSO, would it
make sense to wait for it to be available before releasing the new arc4random?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-01-09 11:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 10:46 [Bug libc/29437] New: arc4random is too slow mlichvar at redhat dot com
2022-08-02 11:03 ` [Bug libc/29437] " fweimer at redhat dot com
2022-08-02 22:57 ` jason at zx2c4 dot com
2022-08-02 22:58 ` jason at zx2c4 dot com
2022-08-03  6:28 ` mlichvar at redhat dot com
2022-08-06 13:36 ` crrodriguez at opensuse dot org
2022-08-06 13:54 ` crrodriguez at opensuse dot org
2022-08-08 11:05 ` mlichvar at redhat dot com
2022-08-08 12:29 ` adhemerval.zanella at linaro dot org
2022-08-08 12:35 ` fweimer at redhat dot com
2022-08-08 12:37 ` fweimer at redhat dot com
2022-08-08 12:38 ` adhemerval.zanella at linaro dot org
2022-08-08 12:39 ` jason at zx2c4 dot com
2022-08-08 12:42 ` adhemerval.zanella at linaro dot org
2022-08-08 12:43 ` fweimer at redhat dot com
2022-08-08 12:44 ` fweimer at redhat dot com
2022-08-08 12:45 ` jason at zx2c4 dot com
2022-08-08 12:51 ` adhemerval.zanella at linaro dot org
2022-08-08 12:56 ` jason at zx2c4 dot com
2023-01-09 11:44 ` yann at droneaud dot fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).