From nobody Mon Nov 29 14:21:25 2021 X-Original-To: dev-commits-src-all@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 CF46518B0C61; Mon, 29 Nov 2021 14:21:26 +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 4J2nb96st0z3hPY; Mon, 29 Nov 2021 14:21:25 +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 9923923DE5; Mon, 29 Nov 2021 14:21:25 +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 1ATELPrX056221; Mon, 29 Nov 2021 14:21:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ATELPfM056220; Mon, 29 Nov 2021 14:21:25 GMT (envelope-from git) Date: Mon, 29 Nov 2021 14:21:25 GMT Message-Id: <202111291421.1ATELPfM056220@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: f47775628333 - stable/12 - Fix segment size in compressing core dumps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/12 X-Git-Reftype: branch X-Git-Commit: f4777562833311b5b4c99e5dda8d50d91a514bf0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638195686; 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=5eb4MFMjfQH6P187nu1KyzwAqn3Q6A+BvTGoqKvXQ0E=; b=Ad6zY3+KfFIAUXT7qw/nF2FExaglSjV5u9Ncn5R0q7txrVmwExxr6AAPRBlP4taFGPhsrF t7wgyswvSG/4qU+B/NTUpLepMMomEdeSg7+Uk10jmyIp9iHla/MI6JU4bBNkuTANE+QpH+ GtdmRxcVXKego82EQSw0HrqtFA6dxNBZbTQHDycbbA5CWZ2yugMwrFrnUCLi4GtoK1iQQM p/n8NAFU3MTXvyDbzC2CHXAX4L/531TfP76obTKTwHJ2ysIIlXIfBFGTl3Pstr5QNb4Hl9 GktChkZlCypzI+Hvpbja7IIE5AMJCLHfqbW8kN21tpBlTAZRQ+aG2otG04VZ4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638195686; a=rsa-sha256; cv=none; b=QBzlY7NDBjpeAEs0NP9p4UvqtVR1y1QGIPDLdmQs2qGjBAfBJN5+ugqdZvUxDHR5So0e+t txKM0KIl2YDqIgMyL/PsDJCNTdbbK3M76qza3zqzVG5DRBKTwjv7oiMJYJytPcSRsv61aw S4gSYKtO9roLzddYLLZGvA2/l8Z8uqKhn6BmZsW6moR6GEQbsfawsqAEWn+VO2uEeESfH5 B1AWdm6h0AeXHdVOtCeowAkAeScVpD54IxgPGt2PCSKtmQedIvLRC+AUqB+wxcCT/Flgoe ca6r+NtFk+LL0wxgO0R86cN9WjeLP+cV14sd61O3f3Y4xqN1MFvsb8cjfEd0ew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f4777562833311b5b4c99e5dda8d50d91a514bf0 commit f4777562833311b5b4c99e5dda8d50d91a514bf0 Author: Justin Hibbits AuthorDate: 2021-10-01 18:39:18 +0000 Commit: Mark Johnston CommitDate: 2021-11-29 14:21:19 +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 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) {