diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-09-01 16:07:09 +0000 |
|---|---|---|
| committer | Colin Percival <cperciva@FreeBSD.org> | 2026-09-03 22:45:57 +0000 |
| commit | 813eb5a4975aafd2e5f5799ba4244649b35d4d5b (patch) | |
| tree | eefdd9e5cf0ee344c6bc5fd56f612aa6c10685cb | |
| parent | 151d7a8cb1202df2d5194ffa75be3095954d5209 (diff) | |
devstat: Fix a kernel stack disclosure
The 16-byte "device_name" field was not zero-filled, so could contain
uninitialized stack data. Zero the whole struct, as that's the
prevailing pattern for this kind of conversion code, and it's more
robust in the face of future revisions to struct devstat.
Approved by: re (cperciva)
Reviewed by: olce, kib
Reported by: Reo Shiseki
Fixes: a11d132f6c62 ("devstat: Provide 32-bit compatibility")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59309
(cherry picked from commit 7cb1a76f88158fb690418336b736e66c238cd4f7)
(cherry picked from commit 6e94e0734b9d3036df8c7d94d827f8eb1119905b)
| -rw-r--r-- | sys/kern/subr_devstat.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 1bc37b970cbf..a421a1de2b0f 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -431,6 +431,7 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS) struct devstat32 ds32; unsigned int i; + memset(&ds32, 0, sizeof(ds32)); CP(*nds, ds32, sequence0); CP(*nds, ds32, allocated); CP(*nds, ds32, start_count); |
