From nobody Mon Sep 23 00:44:44 2024 X-Original-To: ports-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 4XBklx39ybz5XRlB for ; Mon, 23 Sep 2024 00:44:45 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XBklw5z7Xz55Rl for ; Mon, 23 Sep 2024 00:44:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727052284; a=rsa-sha256; cv=none; b=wmJ65nIzdU4A24eKHtMVsMjg5xtV1aXQcHgI6Z5QgDAL6TORT2MJ0fuXpnhFm5AMauP67Z /cgSRKwUfSzwaXk9lY/x3bUswk18ziDPqHMAmYJQ28zjq8GXViwqU2E8NmGw+Q7HQjorMs RDMxX7t0xT5WxKleeFT7Wm9vd9j2PLkl6VjC7nbyvdcTLsXUpt/y10eBjZoqxpSTpbXR+1 TBRh0SdoOdIWH81e5TgJn72bpihAn9mhbzORGlTRPyff35p+5LxmcfNxBjuT9qTlJx5tj7 EwKl293RjOlOztOurMBYyBT+0T/1Xdx7Mdi0B9KuesK4C1lVxKnaV7eoe4qOxA== 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=1727052284; 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=6Tb/h+oIJWlGCLO5sM0U3fGp6nr7vASk+KwxXIwPUls=; b=jcAreeDattUSGs8FKJGtnM281k85R3e2hyaQ5JiGYY+rAm1EhPFIOOZcI2/g4vHlq3zTsD RiuHCgxrsntqtLuAYBbFp63J1w1rVfTYs3ZRHCBQ522tY3Fd36b9nvsXK7GLuOypzhE3xd vIKHg1wMpt8Mgn2c32+mOGHbKiKsTfDp8stjTiZVGGXVvLNUSQKu1Yp4rXRSrnmiPMtFSO wlxD0pdPAShP5mnSQde6vdDxQX5tvem1jIWvamtZFZ4V4sTEf2ifUFQfXTO29wC5uQTuXk bwpWYGk+38ghcQf7MA1d9iua8mC0kSk7iRtJPz40TuShTUSSwPnvR4Bu4xT6iw== 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 4XBklw4ZPjzPHq for ; Mon, 23 Sep 2024 00:44:44 +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 48N0iied036517 for ; Mon, 23 Sep 2024 00:44:44 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 48N0iiMs036516 for ports-bugs@FreeBSD.org; Mon, 23 Sep 2024 00:44:44 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: ports-bugs@FreeBSD.org Subject: [Bug 281656] security/krb5 Date: Mon, 23 Sep 2024 00:44:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: cyschow@shaw.ca X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: cy@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name 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: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-ports-bugs@freebsd.org Sender: owner-freebsd-ports-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D281656 Bug ID: 281656 Summary: security/krb5 Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: cy@FreeBSD.org Reporter: cyschow@shaw.ca Flags: maintainer-feedback?(cy@FreeBSD.org) Assignee: cy@FreeBSD.org Created attachment 253765 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D253765&action= =3Dedit patch to g_initialize.c to avoid the problem I am experiencing segmentation fault when logging in to my newly updated 13= .4 FreeBSD machine. I am using pam_ldap and nss_ldap to lookup accounts on my = LDAP server. Here is the stack trace for the crash (account name replaced with xxxxxxx): # lldb `which tcsh` -c tcsh.core (lldb) target create "/bin/tcsh" --core "tcsh.core" Core file 'tcsh.core' (x86_64) was loaded. (lldb) bt * thread #1, name =3D 'tcsh', stop reason =3D signal SIGSEGV * frame #0: 0x000018b37c64018e libgssapi_krb5.so.2.2`loadConfigFiles at g_initialize.c:504:39 frame #1: 0x000018b37c63bf3d libgssapi_krb5.so.2.2`updateMechList at g_initialize.c:532:2 frame #2: 0x000018b37c63bb59 libgssapi_krb5.so.2.2`build_mechSet at g_initialize.c:342:2 frame #3: 0x000018b37c63bac8 libgssapi_krb5.so.2.2`gss_indicate_mechs(minorStatus=3D0x000018b37303e8ec, mechSet_out=3D0x000018b37303e868) at g_initialize.c:292:6 frame #4: 0x000018b37c6447cc libgssapi_krb5.so.2.2`gss_indicate_mechs_by_attrs(minor=3D0x000018b37303e8e= c, desired_mech_attrs=3D0x000018b37303e8d8, except_mech_attrs=3D0x000018b37303= e8c8, critical_mech_attrs=3D0x0000000000000000, mechs=3D0x000018b3859d72c0) at g_mechattr.c:112:14 frame #5: 0x000018b3859d0bdb libgs2.so`___lldb_unnamed_symbol132 + 523 frame #6: 0x000018b3859d0ddc libgs2.so`gs2_client_plug_init + 108 frame #7: 0x000018b37c02ec1a libsasl2.so.3`sasl_client_add_plugin + 90 frame #8: 0x000018b37c03bda5 libsasl2.so.3`_sasl_load_plugins + 981 frame #9: 0x000018b37c02f050 libsasl2.so.3`sasl_client_init + 528 frame #10: 0x000018b37af628fe libldap.so.2`ldap_int_sasl_init + 110 frame #11: 0x000018b37af7871e libldap.so.2`ldap_int_initialize + 142 frame #12: 0x000018b37af5c7d1 libldap.so.2`ldap_create + 49 frame #13: 0x000018b37af5cc44 libldap.so.2`ldap_initialize + 52 frame #14: 0x000018b3798a0530 nss_ldap.so.1`___lldb_unnamed_symbol440 + 1008 frame #15: 0x000018b3798a16d8 nss_ldap.so.1`_nss_ldap_search_s + 88 frame #16: 0x000018b3798a26b0 nss_ldap.so.1`_nss_ldap_getbyname + 192 frame #17: 0x000018b3798a4243 nss_ldap.so.1`_nss_ldap_getpwnam_r + 67 frame #18: 0x000018b3752244ef libc.so.7`__nss_compat_getpwnam_r(retval=3D0x000018b373041510, mdata=3D, ap=3D0x000018b3730413d0) at nss_compat.c:211:15 frame #19: 0x000018b37522126d libc.so.7`_nsdispatch(retval=3D0x000018b373041510, disp_tab=3D0x000018b3753= 02700, database=3D"", method_name=3D"", defaults=3D) at nsdispatch.c:= 727:14 frame #20: 0x000018b3751dbf2c libc.so.7`getpwnam [inlined] getpwnam_r(name=3D"xxxxxxx", pwd=3D0x000018b375311648, buffer=3D"root", buf= size=3D1024, result=3D0x000018b373041510) at getpwent.c:575:7 frame #21: 0x000018b3751dbee0 libc.so.7`getpwnam [inlined] wrap_getpwnam_r(key=3D(name =3D "xxxxxxx", uid =3D 1977254368), pwd=3D0x000018b375311648, buffer=3D"root", bufsize=3D1024, res=3D0x000018b3= 73041510) at getpwent.c:666:10 frame #22: 0x000018b3751dbee0 libc.so.7`getpwnam [inlined] getpw(fn=3D, key=3D) at getpwent.c:642:8 frame #23: 0x000018b3751dbe92 libc.so.7`getpwnam(name=3D"xxxxxxx") at getpwent.c:692:10 frame #24: 0x000018ab523a607c tcsh`xgetpwnam(name=3D"xxxxxxx") at sh.misc.c:635:19 frame #25: 0x000018ab523d1e0e tcsh`gettilde [inlined] gethomedir(us=3DL"xxxxxxx") at tc.func.c:1471:10 frame #26: 0x000018ab523d1e01 tcsh`gettilde(us=3DL"xxxxxxx") at tc.func.c:1555:10 frame #27: 0x000018ab5238d45e tcsh`gethdir(home=3D) at sh.c:2364:14 frame #28: 0x000018ab5239dded tcsh`globexpand [inlined] globtilde(s=3DL= "") at sh.glob.c:87:12 frame #29: 0x000018ab5239dd86 tcsh`globexpand(v=3D, noglob= =3D0) at sh.glob.c:356:12 frame #30: 0x000018ab5239d81e tcsh`globone(str=3DL"~xxxxxxx", action=3D= 0) at sh.glob.c:496:7 frame #31: 0x000018ab5238f212 tcsh`dfollow(cp=3D, old=3D0)= at sh.dir.c:587:30 frame #32: 0x000018ab5238efe4 tcsh`dochngd(v=3D0x000018b375dc7ce8, c=3D) at sh.dir.c:522:12 frame #33: 0x000018ab523abd32 tcsh`execute(t=3D0x000018b375e2a380, wanttty=3D1884, pipein=3D, pipeout=3D0x0000000000000000, do_glob=3D) at sh.sem.c:653:7 frame #34: 0x000018ab523ab1ad tcsh`execute(t=3D0x000018b375e2a350, wanttty=3D1884, pipein=3D0x0000000000000000, pipeout=3D0x0000000000000000, = do_glob=3D1) at sh.sem.c:0:3 frame #35: 0x000018ab5238cc5e tcsh`process(catch=3D1) at sh.c:2162:2 frame #36: 0x000018ab5238baaf tcsh`main(argc=3D, argv=3D0x000018b373042280) at sh.c:1430:5 frame #37: 0x000018ab52389dbd tcsh`_start(ap=3D, cleanup=3D) at crt1_c.c:71:7 Here is the line of code that is crashing: (lldb) down frame #0: 0x000018b37c64018e libgssapi_krb5.so.2.2`loadConfigFiles at g_initialize.c:504:39 501 502 memset(&globbuf, 0, sizeof(globbuf)); 503 if (glob(MECH_CONF_PATTERN, 0, NULL, &globbuf) =3D=3D 0) { -> 504 for (path =3D globbuf.gl_pathv; *path !=3D NULL; pa= th++) 505 load_if_changed(*path, g_confFileModTime, &highest); 506 } 507 globfree(&globbuf); (lldb) p globbuf (glob_t) { gl_pathc =3D 0 gl_matchc =3D 1099511627776 gl_offs =3D 0 gl_flags =3D 0 gl_pathv =3D 0x0000000000000000 gl_errfunc =3D 0x0000000000000000 gl_closedir =3D 0x0000000000000000 gl_readdir =3D 0x0000000000000000 gl_opendir =3D 0x0000000000000000 gl_lstat =3D 0x0000000000000000 gl_stat =3D 0x0000000000000000 } The issue boils down to this man page: # man 3 glob ... gl_pathv contains a pointer to a NULL-terminated list of matched pathnames. However, if gl_pathc is zero, the contents of gl_pathv are undefined. ... The code is unconditionally referencing gl_pathv without check if gl_pathc = is non-zero. Unfortunately, in this case, gl_pathv is NULL, and the dereference causes the crash. I checked the manpage in Linux, and from what I read, it makes no mention of that fact. At this time, I am assuming this is a FreeBSD-specific issue. I am attaching a patch to avoid this problem. I can confirm that it works o= n my systems. --=20 You are receiving this mail because: You are the assignee for the bug.=