From nobody Mon Nov 29 14:21:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9C85618B0123; Mon, 29 Nov 2021 14:21:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J2nZh62Lfz3RFP; Mon, 29 Nov 2021 14:21:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99FAD23F67; Mon, 29 Nov 2021 14:21:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ATEL09b055926; Mon, 29 Nov 2021 14:21:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ATEL02p055925; Mon, 29 Nov 2021 14:21:00 GMT (envelope-from git) Date: Mon, 29 Nov 2021 14:21:00 GMT Message-Id: <202111291421.1ATEL02p055925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 294965542720 - stable/13 - Fix segment size in compressing core dumps List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2949655427209b7d086eb35a92ea1e175d1b1a67 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638195661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PsjM/cOvIe+hBMc34XiOYwR+egrTNrk7zCZxtrH3SqA=; b=ZG6B8IczOu8QDqVU1yM+lty/0V0SXeDOwaVEkc0MnYqYUv4Hgz6KTHPlxK7SwkNI20B4cA 7MAGBbMuBk8y096DH96hTp52oaJSybce3bd1OnRAKLX9XdL+/htPI/lYEemVVuTR90htQr 4Oc8rQmtSycEcHSZBbZJKi5/XEHhWX5Mz2FBYUmvak+R1WaK0J7/tLh0Fdw9sK7w+Rv7U1 rz+/CFuusuPecdJhpOTvvBYQyBSXV8svceE/0+EdP2KAXWC961zIEQrNjRLOCOT/MA4AWL vdIj3QM0VHhHBcdXju7/HvZNt5qVgC94mhA135jdRpIazT+Fv3CBEYwgAIGQjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638195661; a=rsa-sha256; cv=none; b=KM+rCNFlIMrLuhRWus5gNAoq8m/RU7+VPDmKoRIabSZrgc8SqQftYg0etrLiPz6CTXhe5a ctSpd3+RV+kE2LLOA7zTQEujbXlBuxdidhsHLJf1DyzknLOWjtaOeRsyFf3tRLVJpna7bg LRfOqyr6+pRiMCWooNiYK9leNWqq/QaFdYskPO+CEeLNYZoMzpA3a6Z32aMj3qa26Kuv/T Knbl8TreiV7Hf0rO4TChoJRdmAqqEeecADqdwklavFEi1Vf4ZjHlnw23RU6x8CzTMvHs7V jaLNCltz9/le2oAr/31jESQDrNLdSsqcKlC95y4v3KV8MPcbJoQDnexF+6Cy6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2949655427209b7d086eb35a92ea1e175d1b1a67 commit 2949655427209b7d086eb35a92ea1e175d1b1a67 Author: Justin Hibbits AuthorDate: 2021-10-01 18:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-11-29 14:08:11 +0000 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) --- sys/kern/imgact_elf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index e1b6e3fc6ba7..18ddbae57d4a 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1505,9 +1505,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) {