diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-07-27 15:42:49 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-07-28 17:34:59 +0000 |
| commit | 475a72f754781d781ef3b48a4faf3c350a2e1cca (patch) | |
| tree | 9422022e5e74288cf988ea1e815371f6256cbf4b /libexec | |
| parent | 20c738692c6117edb5496aab8147c519539676a7 (diff) | |
coredump: Don't assume that the number of ELF segments is consistent
In an ELF coredump, each dumped vm_map_entry is represented by a
segment. __elfN(coredump) first computes the number of segments by
looping over the vm_map entries (in each_dumpable_segment()), then
allocates a buffer to hold the ELF header and program headers, then
loops over the entries again to populate the program headers.
each_dumpable_segment() holds the vm_map read lock, but that lock is
dropped between the two calls. If the map is shared with another
process, via rfork(), then the map can change. cb_put_phdr() did not
account for this, and so could write out of bounds.
Add a check to prevent this; simply do not write out excess segments.
Approved by: so
Security: FreeBSD-SA-26:55.elf
Security: CVE-2026-58088
Reported by: Maik Muench of Secfault Security
Reviewed by: kib, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58416
Diffstat (limited to 'libexec')
0 files changed, 0 insertions, 0 deletions
