|
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
|
| 1.20 |
15-Oct-2024 |
riastradh |
Revert cprng_fast(9) to seed and reseed asynchronously in softint.
This reverts sys/crypto/cprng_fast/cprng_fast.c revisions 1.17-1.19.
I thought we had eliminated all paths into cprng_fast(9) from hard interrupt context, which would allow us to call into cprng_strong(9) and entropy(9) to synchronously reseed whenever needed -- this would improve security over netbsd-9 for the first query to cprng_intr(9) on each CPU.
Unfortunately, I missed the calls under spin locks (which are effectively also hard interrupt context, in that they hold up interrupts on this CPU or interrupt handlers trying to take the lock on other CPUs). And one such spin lock is struct ifnet::ifq_lock at IPL_NET, which is held by if_transmit when it calls IFQ_ENQUEUE which calls into altq(4) which sometimes does, e.g., red_addq which calls cprng_fast32.
Until we migrate ifq_lock to IPL_SOFTNET (which is potentially feasible, because most of the network stack runs in softint now, but it requires a lot of auditing and maybe changes to lots of drivers), we'll have to make sure cprng_fast(9) doesn't try to take an adaptive lock.
And the simplest way to ensure that is to just revert back to the netbsd-9 semantics of asynchronously reseeding in softint, at the cost of a potential security weakness. I don't expect this regression to be permanent -- we just can't restore the change as is until we deal with ifq_lock.
1.19 cprng_fast(9): Drop and retake percpu reference across cprng_strong. 1.18 cprng_fast(9): Assert not in pserialize read section. 1.17 cprng(9): cprng_fast is no longer used from interrupt context.
PR kern/58575: altq(4) takes adaptive lock while holding spin lock
|
|
Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base thorpej-ifq-base thorpej-altq-separation-base
|
| 1.19 |
05-Aug-2023 |
riastradh |
branches: 1.19.6; cprng_fast(9): Drop and retake percpu reference across cprng_strong.
cprng_strong may sleep on an adaptive lock (via entropy_extract), which invalidates percpu(9) references.
Discovered by stumbling upon this panic in a test run:
panic: kernel diagnostic assertion "(cprng == percpu_getref(cprng_fast_percpu)) && (percpu_putref(cprng_fast_percpu), true)" failed: file "/home/riastradh/netbsd/current/src/sys/rump/librump/rumpkern/../../../crypto/cprng_fast/cprng_fast.c", line 117
XXX pullup-10
|
|
Revision tags: netbsd-10-base bouyer-sunxi-drm-base
|
| 1.18 |
01-Sep-2022 |
riastradh |
branches: 1.18.4; cprng_fast(9): Assert not in pserialize read section.
This may sleep to take the global entropy lock in case it needs to be reseeded. If that happens we can't be in a pserialize read section.
|
| 1.17 |
01-Jun-2022 |
riastradh |
cprng(9): cprng_fast is no longer used from interrupt context.
Rip out logic to defer reseeding to softint.
|
|
Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
| 1.16 |
28-Jul-2020 |
riastradh |
Rewrite cprng_fast in terms of new ChaCha API.
|
| 1.15 |
30-Apr-2020 |
riastradh |
Count cprng_fast reseed events.
|
| 1.14 |
30-Apr-2020 |
riastradh |
Adapt cprng_fast to use entropy_epoch(), not rnd_initial_entropy.
This way it has an opportunity to be reseeded after boot.
|
|
Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
|
| 1.13 |
13-Apr-2015 |
riastradh |
More rnd.h user cleanup.
|
| 1.12 |
13-Apr-2015 |
riastradh |
cprng_strong(kern_cprng, ...) never blocks, pass 0 for flags.
FASYNC was wrong anyway! It's FNONBLOCK.
|
|
Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
|
| 1.11 |
11-Aug-2014 |
justin |
branches: 1.11.2; 1.11.4; Fix inconsistent use of inline in prototype and definition
|
|
Revision tags: tls-maxphys-base
|
| 1.10 |
11-Aug-2014 |
riastradh |
Tweak cprng_fast_buf to use 32-bit unaligned writes if possible.
|
| 1.9 |
11-Aug-2014 |
riastradh |
Move initial entropy bookkeeping out of the fast path.
|
| 1.8 |
11-Aug-2014 |
riastradh |
Use percpu_foreach instead of manual iteration.
|
| 1.7 |
11-Aug-2014 |
riastradh |
Access to struct cprng_fast must be consistently at IPL_VM.
|
|
Revision tags: netbsd-7-base
|
| 1.6 |
11-Aug-2014 |
riastradh |
branches: 1.6.2; No need for cprng_fast_seed to be inline.
|
| 1.5 |
11-Aug-2014 |
riastradh |
Include <sys/rnd.h>, don't copypasta declare rnd_initial_entropy.
|
| 1.4 |
11-Aug-2014 |
riastradh |
Sort #includes.
|
| 1.3 |
10-Aug-2014 |
justin |
define function consistently as inline
|
| 1.2 |
10-Aug-2014 |
tls |
Merge tls-earlyentropy branch into HEAD.
|
|
Revision tags: tls-earlyentropy-base
|
| 1.1 |
09-Aug-2014 |
tls |
branches: 1.1.2; file cprng_fast.c was initially added on branch tls-earlyentropy.
|
|
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base tls-maxphys-base netbsd-7-base
|
| 1.2 |
10-Aug-2014 |
tls |
branches: 1.2.4; Merge tls-earlyentropy branch into HEAD.
|
|
Revision tags: tls-earlyentropy-base
|
| 1.1 |
09-Aug-2014 |
tls |
branches: 1.1.2; file cprng_fast.h was initially added on branch tls-earlyentropy.
|
|
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
|
| 1.3 |
28-Jul-2020 |
riastradh |
Rewrite cprng_fast in terms of new ChaCha API.
|
|
Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base tls-maxphys-base netbsd-7-base
|
| 1.2 |
10-Aug-2014 |
tls |
branches: 1.2.4; Merge tls-earlyentropy branch into HEAD.
|
|
Revision tags: tls-earlyentropy-base
|
| 1.1 |
09-Aug-2014 |
tls |
branches: 1.1.2; file files.cprng_fast was initially added on branch tls-earlyentropy.
|