Page MenuHomeFreeBSD

Fortuna: Add failpoints to simulate initial seeding conditions
ClosedPublic

Authored by cem on Sep 5 2018, 3:13 PM.

Details

Summary

Set debug.fail_point.random_fortuna_pre_read=return(1) and
debug.fail_point.random_fortuna_seeded=return(1) to return to unseeded
status (sort of).

The goal is to be able to reproduce initial seeding transition problems, e.g.,
Lev's recent CURRENT report about failing newfs arc4random(3) usage.

Test Plan
# Block:
$ sudo sysctl debug.fail_point.random_fortuna_pre_read='return(1)'
debug.fail_point.random_fortuna_pre_read: off -> return(1)
$ sudo sysctl debug.fail_point.random_fortuna_seeded='return(1)'
debug.fail_point.random_fortuna_seeded: off -> return(1)

# Start test operation that uses devrandom and blocks on seeded status:
$ [truss] ./blocked_random_poc
...

# Unblock:
$ sudo sysctl debug.fail_point.random_fortuna_pre_read='off'
debug.fail_point.random_fortuna_pre_read: return(1) -> off
$ sudo sysctl debug.fail_point.random_fortuna_seeded=off
debug.fail_point.random_fortuna_seeded: return(1) -> off

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.Sep 5 2018, 3:13 PM
markm requested changes to this revision.Sep 7 2018, 6:06 PM
markm added inline comments.
sys/dev/random/fortuna.c
398 ↗(On Diff #47698)

Please put this inside the #ifdef _KERNEL

463 ↗(On Diff #47698)

Again, inside #ifdef _KERNEL, please

This revision now requires changes to proceed.Sep 7 2018, 6:06 PM
cem planned changes to this revision.Sep 8 2018, 1:24 AM
cem added inline comments.
sys/dev/random/fortuna.c
398 ↗(On Diff #47698)

Will do.

cem updated this revision to Diff 48032.Sep 14 2018, 4:30 AM
cem marked 3 inline comments as done.

ifdef _KERNEL failpoint sites

markm accepted this revision.Sep 14 2018, 7:46 AM
This revision is now accepted and ready to land.Sep 14 2018, 7:46 AM
This revision was automatically updated to reflect the committed changes.