From nobody Tue Nov 23 21:29:47 2021 X-Original-To: bugs@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 2BE75189348D for ; Tue, 23 Nov 2021 21:29:48 +0000 (UTC) (envelope-from bugzilla-noreply@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 4HzHNC6Bc7z4rRb for ; Tue, 23 Nov 2021 21:29:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 B0C6B1DCD7 for ; Tue, 23 Nov 2021 21:29:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1ANLTlrX050755 for ; Tue, 23 Nov 2021 21:29:47 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1ANLTl16050754 for bugs@FreeBSD.org; Tue, 23 Nov 2021 21:29:47 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260006] Compressed user core files with large segments are truncated Date: Tue, 23 Nov 2021 21:29:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.4-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: chris_horneck@dell.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637702987; 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=c8ai1ma5wiLCBOdfiNiT+SAhiziOI6njVJZkEzUbv/w=; b=mgCgSh1O5vtw6Iv7q/naefvXyiI2tSokUH/SP9fJyGPc/6kPujrpe5qc/V/XAljHlURsxG NcRn3VoXU/PqLdcBKEDiKGT6etDoDN2qas/noDK19y8tR1GbkYOko4WCSvWWomwkXvlqRO ls1yPxNlqIxF5wi6yEsZtHUDjDGHyCtix/+jjjsR7K9h1am84mOVNB+pHgXxyq+N6tdGS0 //9PDdbURrVqtVBRMUdXtEOC800Lx7g5TpdVkUMRfQVTramdNqSX9EN23YpuMw95+fMfP/ Q3xxwCPOUHmlbnmkUboMWNkjfIiMwHtXC3r7TxBk84tj6/03QIpDJa/S9cf6GA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637702987; a=rsa-sha256; cv=none; b=RtB5xsVFvZRk2vh6u6HQxOkPNO2Y/244FOZiqKCVszCKbRtRbU6Yzw6/JLDRZfal++OslY AHTNd3dc/T5leIu/Ezh/oAoCtuqrYPllBcc+jk3Eq9Zp6fcOCpR4u5lEYYG79JtDimjEO8 Fhz+jqV7ifog4uVg6qpgJOnA/CGO7Uw1Ry7qIg9FBlCyNOd37KfC5VTgknUDCz+q3gUub2 q2VrZkcBf8XL3oaEgC2iK0mSavYkJa0Tut5Fdq5di+i1Ep1IZkMsKgMe0diXaeYDevHhJJ XOBN93blTCsOOTQRwu4jfT21e6nmM11MiMi3B/LTnt99Kavj1QF+dnczJPQl3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260006 Bug ID: 260006 Summary: Compressed user core files with large segments are truncated Product: Base System Version: 11.4-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: chris_horneck@dell.com Created attachment 229685 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D229685&action= =3Dedit Test program This problem can happen with kernels compiled with GZIO and sysctl kern.compress_user_cores=3D1. If the program being dumped has a memory segment with size >=3D 0xFFFFFFFF,= the segment will be silently truncated, which "damages" any memory segments wri= tten to the core file afterwards. The root of the problem is in imgact_elf.c. The function compress_chunk acc= epts a length of type u_int (32-bits), while it's callers pass lengths of type size_t (64-bits). Thus, any segment with a length that cannot fit in 32-bits will be truncated. The function compress_chunk lives on in later branches and appears to suffer the same problem. Trivial test program that allocates a large memory segment before crashing = is attached. Kernel must be compiled with GZIO and sysctl kern.compress_user_cores=3D1. --=20 You are receiving this mail because: You are the assignee for the bug.=