diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2021-10-01 18:39:18 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2021-10-01 19:16:33 +0000 |
| commit | 63cb9308a75b99fe057409705bc1b2ac0293f578 (patch) | |
| tree | 56ac4e5291afb8f10cd50934fc16ba9b18b81de4 | |
| parent | 0177102173f39e17366a32eb22653aeb5248c355 (diff) | |
| download | src-63cb9308a75b99fe057409705bc1b2ac0293f578.tar.gz src-63cb9308a75b99fe057409705bc1b2ac0293f578.zip | |
Fix segment size in compressing core dumps
A core segment is bounded in size only by memory size. On 64-bit
architectures this means a segment can be much larger than 4GB.
However, compress_chunk() takes only a u_int, clamping segment size to
4GB-1, resulting in a truncated core. Everything else, including the
compressor internally, uses size_t, so use size_t at the boundary here.
This dates back to the original refactor back in 2015 (r279801 /
aa14e9b7).
MFC after: 1 week
Sponsored by: Juniper Networks, Inc.
| -rw-r--r-- | sys/kern/kern_exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index cbe0152a8001..4b3035cb7e08 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1884,9 +1884,9 @@ exec_unregister(const struct execsw *execsw_arg) * Write out a core segment to the compression stream. */ static int -compress_chunk(struct coredump_params *cp, char *base, char *buf, u_int len) +compress_chunk(struct coredump_params *cp, char *base, char *buf, size_t len) { - u_int chunk_len; + size_t chunk_len; int error; while (len > 0) { |
