|WARNING| [v3,5/5] test: allow setting random seed for tests
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Fri Nov 27 22:46:33 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173288
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-27
**Patch 2/5: random: always use getentropy**
Warning: the new `rte_srand()` Doxygen text implies `rte_rand()` output is unpredictable.
```
+ * random source provided by the operating system, so there is no need
+ * to re-seed it to get unpredictable values. Seeding it explicitly is
```
Only the initial seed comes from the OS entropy source. `rte_rand()` itself is a linear LFSR, so an observer of enough output can recover the state and predict later values. On the TSC fallback path, which this series keeps, the seed itself is also low entropy. Read as written, the text invites using `rte_rand()` for keys, nonces or other security-sensitive values.
Suggested fix: say the generator is seeded from the OS random source. State explicitly that `rte_rand()` is not cryptographically secure and must not be used for key material, IVs or nonces.
**Patch 5/5: test: allow setting random seed for tests**
Info: the documentation and the code disagree for interactive mode.
The new text says the seed is applied "before each test command is run". In interactive mode the code reseeds only once, before `cmdline_interact()`:
```
+ if (use_test_seed)
+ rte_srand(test_seed);
+
cmdline_interact(cl);
```
Successive commands typed at the prompt therefore continue the same sequence. Either note that the per-command reseed applies only to tests given on the command line or via `DPDK_TEST`, or reseed per command in interactive mode as well.
Info: negative input is accepted silently. `strtoull()` takes values such as `DPDK_TEST_SEED=-1` and wraps them to a large unsigned value without error:
```
+ test_seed = strtoull(env, &end, 0);
```
This is harmless for a seed, but rejecting a leading `-` would make input validation consistent with the "Invalid DPDK_TEST_SEED" check.
Review-Result: WARNING
More information about the test-report
mailing list