diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2021-10-01 18:39:18 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2021-11-29 14:21:19 +0000 |
| commit | f4777562833311b5b4c99e5dda8d50d91a514bf0 (patch) | |
| tree | 9adc5760542ab929342c282a7dd71e5a503f1d59 | |
| parent | 900ca3c03a4e06abc7bb645f594c5ff777fe0378 (diff) | |
| download | src-f4777562833311b5b4c99e5dda8d50d91a514bf0.tar.gz src-f4777562833311b5b4c99e5dda8d50d91a514bf0.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).
PR: 260006
Sponsored by: Juniper Networks, Inc.
(cherry picked from commit 63cb9308a75b99fe057409705bc1b2ac0293f578)
| -rw-r--r-- | sys/kern/imgact_elf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 416de09630ae..c056cfcec8e0 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1473,9 +1473,9 @@ static void note_procstat_vmmap(void *, struct sbuf *, size_t *); * Write out a core segment to the compression stream. */ static int -compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len) +compress_chunk(struct coredump_params *p, char *base, char *buf, size_t len) { - u_int chunk_len; + size_t chunk_len; int error; while (len > 0) { |
