From nobody Tue Nov 21 14:00:49 2023 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 4SZQy93SFSz51gmW for ; Tue, 21 Nov 2023 14:00:49 +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 4SZQy91c3rz3fFv for ; Tue, 21 Nov 2023 14:00:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700575249; 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=s39LbqnGVuDAoMrOyf4ySHtuj7Z25IAMTWW2M3uOmxU=; b=S6hP4x8QM8XPDbeH67FQFzbXf8J06VveP0Phe9CoI10VHt4sv11UZG5Gx27/lk8quqJu9/ c3X27Wjtdrogj18RtzzWPqk/nR38bSo9HY4KH0fVZXztBA37glaaKCjWsgYNpEeXEwKjDZ jQbfaAWG1ppszfQJLr3yJCfia2LdYBKb9Bs1fzwhhtPUbd4e/BaSAPmycMBrvOMqsVrm2m DodvYICUIncIghQRIOydaESxg0Shv8d3jw0/mTFrkThEuVBr6d1YmC296vVil/H2Bx07P0 M8zcqSEMMsY1J3yqM/o0CtE2BJNoxaec3cCvKcB0P7l7IKpLW8nyrqW0r2pz/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700575249; a=rsa-sha256; cv=none; b=GgIZU8Tyd3TAoPeu3HYs2zjG0R3XilBaFV1NwtL0tyXUcOlZ//iPtPZBrr7WVs/jZ+MxGH OYdn1wb9htbz7glmY32bggNHoC1wN+FDcliTX0lRBrnYwYFoJSZlyR30zOJ/kE+U1MOtcV l4Ro3VvmLbBE0dfFJT2xhtlffvP1iCOE4hgwUGw6FijkUEAkOOJXYF192TiDTBb+P2rz3q nKDX/328sG9O8KJN20ndN3mGIJw+Z5fn8vXlfIhqvSG6oFL2GAwJP5cC0ZMEY1ct93oRUX 1BEI70g5PqMN3Air7V+OHuSABSSiEEdhAbuu9pAM8SK/lsrikZFAo+6+VUUdfA== 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 4SZQy90jW5zdnc for ; Tue, 21 Nov 2023 14:00:49 +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 3ALE0nFk097895 for ; Tue, 21 Nov 2023 14:00:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3ALE0nfs097894 for bugs@FreeBSD.org; Tue, 21 Nov 2023 14:00:49 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 275232] libc memory leak - acl_to_text() / acl_to_text_np() Date: Tue, 21 Nov 2023 14:00:49 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pen@lysator.liu.se 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275232 Bug ID: 275232 Summary: libc memory leak - acl_to_text() / acl_to_text_np() Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: pen@lysator.liu.se Created attachment 246464 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D246464&action= =3Dedit Patch to fix three small memory leaks in libc / acl_to_text() There is a couple of small memory leaks in the libc functions acl_to_text()= ad acl_to_text_np() - if the ACL contains user: and/or group: entries then it = will leak about sizeof(uid_t) allocated blocks for each ACL entry... Compile with "cc -g" and then run with "valgrind --leak-check=3Dfull ./a.ou= t": #include #include int main(int argc, char *argv[]) { acl_t a; acl_entry_t e; uid_t uid; a =3D acl_init(1); acl_create_entry(&a, &e); acl_set_tag_type(e, ACL_USER); uid =3D 1001; acl_set_qualifier(e, &uid); acl_set_entry_type_np(e, ACL_ENTRY_TYPE_ALLOW); char *s =3D acl_to_text(a, NULL); puts(s); acl_free(s); acl_free(a); return 0; } =3D=3D94097=3D=3D 4 bytes in 1 blocks are definitely lost in loss record 1 = of 10 =3D=3D94097=3D=3D at 0x484CBE4: malloc (vg_replace_malloc.c:435) =3D=3D94097=3D=3D by 0x4953AB3: acl_get_qualifier (in /lib/libc.so.7) =3D=3D94097=3D=3D by 0x49556B8: ??? (in /lib/libc.so.7) =3D=3D94097=3D=3D by 0x201B0D: main (acl_to_text_leak.c:20) There are at least three missed acl_free() calls for returned identifiers f= rom acl_get_qualifier() in lib/libc/posix1e/acl_to_text_nfs4.c --=20 You are receiving this mail because: You are the assignee for the bug.=