From nobody Sat Mar 23 12:53:06 2024 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 4V1zdG6Pycz5FNfH for ; Sat, 23 Mar 2024 12:53:06 +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 4V1zdG3JXwz4v4R for ; Sat, 23 Mar 2024 12:53:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711198386; a=rsa-sha256; cv=none; b=U9S2XP8ZYNjaNrABkNCRp+P4fP66x6KNTCzlF7P19PwDKtoF8nYMGTi3PtBPONBC4Waz+B oQLeV9kiqpQm1W7a/f6qZpqiLomc2YzIqs6WGNc+WJkLHTpxU7lB3Cczv53Skii38EmNOJ Ivz0DSrUaguTVSnAFV9ZTFCe41ANTL1iyRJhg0FBhXsb/iJkIVz0iwrHorTMt3aadxhFd2 Rp7kL8kr4RiyTrEaDNcRwp028MwWFu7jmzFBac1pWTOqsF9mZ/lHPVgPjaP6bitRatQzoC nnk2pCBPkasrCsAe9WQ170aKK76fbd/rw5Yb+6c5fBCtzySLiBLKQKp/7yXm2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711198386; 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=cRCydN0tPwPevPuxfPdUVLbwcUI7nGxMIuor9mMVUOU=; b=FQXO++IEEp2Pw1dBXqENBwbS43TRhEorasIUBwvr25UzBAt1gU0BzQW2EgzQLO554aVvus VfHct2CPsqOGKIWC0PrWGh7J2Qlr3/NADwipWevHAIUSwHO0mWENjZWffr8E6cRQUT2XKJ o/9ZcmcpN3jq9N2gjK4BnjyGYafIqbODuP7su84SqugdLBlzgOouxwo0cHCb/RzrMXu6FS u7DvWLJwCEmQtkSxg9rj0Mx7PK3hpV0sH+uaKCowiD7YirIv7r3usjQntWQAJlxKISBTOj I86ngO+StduU1QxFpmhV13cDz/7xON1JDTuHmcHXMQjVK4H4E8g0Uuzkgrhn0Q== 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 4V1zdG2wYLzpjY for ; Sat, 23 Mar 2024 12:53:06 +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 42NCr6gL084597 for ; Sat, 23 Mar 2024 12:53:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 42NCr6j1084590 for bugs@FreeBSD.org; Sat, 23 Mar 2024 12:53:06 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 277906] libalias fails to report an error from dlsym() Date: Sat, 23 Mar 2024 12:53:06 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: Igor.Gusarov@kaspersky.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 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=3D277906 Bug ID: 277906 Summary: libalias fails to report an error from dlsym() Product: Base System Version: 14.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: Igor.Gusarov@kaspersky.com The following code can be found in file /usr/src/sys/netinet/libalias/alias= .c around line 1715 p =3D dlsym(handle, "alias_mod"); if ((error =3D dlerror()) !=3D NULL) { fprintf(stderr, "%s\n", dlerror()); return (EINVAL); } This code calls dlerror() function twice: first time to check if there is an error, and the second time to print that error. Such approach is wrong, as described in manual page for dlerror(3): > At each call > to dlerror(), the error indication is reset. Thus in the case of two > calls to dlerror(), where the second call follows the first immediately, > the second call will always return a null pointer. Which may result in the following not helpful error message when trying to start natd: # service natd restart Stopping natd. Waiting for PIDS: 23950. Starting natd. (null) <--- Here. This null message is printed at alias.c:1715 #=20 Suggested fix: Apply the following patch to /usr/src/sys/netinet/libalias/alias.c --- alias.c 2023-11-10 03:07:53.000000000 +0300 +++ alias.c.new 2024-03-23 15:48:15.335314000 +0300 @@ -1712,7 +1712,7 @@ p =3D dlsym(handle, "alias_mod"); if ((error =3D dlerror()) !=3D NULL) { - fprintf(stderr, "%s\n", dlerror()); + fprintf(stderr, "%s\n", error); return (EINVAL); } --=20 You are receiving this mail because: You are the assignee for the bug.=