git/reftable
Patrick Steinhardt 0b4f8afef6 reftable/stack: accept insecure random bytes
The reftable library uses randomness in two call paths:

  - When reading a stack in case some of the referenced tables
    disappears. The randomness is used to delay the next read by a
    couple of milliseconds.

  - When writing a new table, where the randomness gets appended to the
    table name (e.g. "0x000000000001-0x000000000002-0b1d8ddf.ref").

In neither of these cases do we need strong randomness.

Unfortunately though, we have observed test failures caused by the
former case. In t0610 we have a test that spawns a 100 processes at
once, all of which try to write a new table to the stack. And given that
all of the processes will require randomness, it can happen that these
processes make the entropy pool run dry, which will then cause us to
die:

    + test_seq 100
    + printf %s commit\trefs/heads/branch-%s\n
    68d032e9edd3481ac96382786ececc37ec28709e 1
    + printf %s commit\trefs/heads/branch-%s\n
    68d032e9edd3481ac96382786ececc37ec28709e 2
    ...
    + git update-ref refs/heads/branch-98 HEAD
    + git update-ref refs/heads/branch-97 HEAD
    + git update-ref refs/heads/branch-99 HEAD
    + git update-ref refs/heads/branch-100 HEAD
    fatal: unable to get random bytes
    fatal: unable to get random bytes
    fatal: unable to get random bytes
    fatal: unable to get random bytes
    fatal: unable to get random bytes
    fatal: unable to get random bytes
    fatal: unable to get random bytes

The report was for NonStop, which uses OpenSSL as the backend for
randomness. In the preceding commit we have adapted that backend to also
return randomness in case the entropy pool is empty and the caller
passes the `CSPRNG_BYTES_INSECURE` flag. Do so to fix the issue.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-01-07 09:04:18 -08:00
..
LICENSE reftable: add LICENSE 2021-10-08 10:45:48 -07:00
basics.c reftable: handle realloc error in parse_names() 2024-12-28 08:00:44 -08:00
basics.h reftable: fix allocation count on realloc error 2024-12-28 08:00:44 -08:00
block.c reftable: avoid leaks on realloc error 2024-12-28 08:00:44 -08:00
block.h reftable: rename scratch buffer 2024-11-26 08:39:38 +09:00
blocksource.c reftable/blocksource: adapt interface name 2024-10-17 16:59:56 -04:00
blocksource.h reftable/blocksource: adapt interface name 2024-10-17 16:59:56 -04:00
constants.h reftable: make the compaction factor configurable 2024-05-13 17:02:39 -07:00
error.c reftable/error: introduce out-of-memory error code 2024-10-02 07:53:50 -07:00
iter.c reftable: handle trivial `reftable_buf` errors 2024-10-17 16:59:56 -04:00
iter.h reftable: convert from `strbuf` to `reftable_buf` 2024-10-17 16:59:56 -04:00
merged.c Merge branch 'ps/reftable-alloc-failures-zalloc-fix' 2024-12-23 09:32:06 -08:00
merged.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
pq.c reftable: avoid leaks on realloc error 2024-12-28 08:00:44 -08:00
pq.h reftable/pq: handle allocation failures when adding entries 2024-10-02 07:53:55 -07:00
reader.c reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
reader.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
record.c reftable: avoid leaks on realloc error 2024-12-28 08:00:44 -08:00
record.h reftable/record: adapt `reftable_record_key()` to handle allocation failures 2024-10-17 16:59:56 -04:00
reftable-basics.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
reftable-blocksource.h reftable: add blocksource, an abstraction for random access reads 2021-10-08 10:45:48 -07:00
reftable-error.h reftable/error: introduce out-of-memory error code 2024-10-02 07:53:50 -07:00
reftable-iterator.h reftable/generic: adapt interface to allow reuse of iterators 2024-05-13 17:04:18 -07:00
reftable-merged.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
reftable-reader.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
reftable-record.h reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
reftable-stack.h reftable/stack: add accessor for the hash ID 2024-11-26 17:18:36 +09:00
reftable-writer.h reftable/stack: add mechanism to notify callers on reload 2024-11-26 17:18:38 +09:00
stack.c reftable/stack: accept insecure random bytes 2025-01-07 09:04:18 -08:00
stack.h reftable: make the compaction factor configurable 2024-05-13 17:02:39 -07:00
system.c reftable/system: provide thin wrapper for lockfile subsystem 2024-11-19 12:23:11 +09:00
system.h Merge branch 'ps/build-sign-compare' 2024-12-23 09:32:11 -08:00
tree.c reftable/tree: handle allocation failures 2024-10-02 07:53:55 -07:00
tree.h reftable/tree: handle allocation failures 2024-10-02 07:53:55 -07:00
writer.c reftable: avoid leaks on realloc error 2024-12-28 08:00:44 -08:00
writer.h reftable: rename scratch buffer 2024-11-26 08:39:38 +09:00