<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>35597</bug_id>
          
          <creation_ts>2018-11-12 16:33:36 +0300</creation_ts>
          <short_desc>Segfault in sssd&apos;s krb5_child</short_desc>
          <delta_ts>2018-11-29 13:21:50 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>libkrb5</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan A. Melnikov">iv</reporter>
          <assigned_to name="Ivan A. Melnikov">iv</assigned_to>
          <cc>iv</cc>
    
    <cc>jenya</cc>
    
    <cc>rider</cc>
    
    <cc>shaba</cc>
    
    <cc>sin</cc>
    
    <cc>slev</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>175707</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2018-11-12 16:33:36 +0300</bug_when>
    <thetext>To reproduce
* add a machine to a FreeIPA domain, using FQDN (e.g. test.ipa.example.com);
* make sure that a domain user does not have a ccache (e.g. run kdestroy), and logout;
* ssh to the machine by its short name (e.g. ssh iv@test); don&apos;t enable GSSAPI on your SSH client, use your domain password.

Expected result: you are logged in, you have ccache with TGT.
Real result: you are not logged in (permission denied); in the machine logs you see that there was a segfault in /usr/libexec/sssd/krb5_child.

I managed to get a core dump. Here is the segmentation fault backtrace:

#0  krb5_copy_principal (context=0x11a4bb0, inprinc=0x6e, outprinc=0x7ffdc68f6050) at copy_princ.c:43
#1  0x00007ff3f6fd0115 in krb5_cc_cache_match (context=0x11a4bb0, client=0x11a0e80, cache_out=cache_out@entry=0x7ffdc68f60b8) at cccursor.c:197
#2  0x0000000000408844 in create_ccache (ccname=&lt;optimized out&gt;, creds=0x117c000) at src/providers/krb5/krb5_child.c:999
#3  0x000000000040c084 in get_and_save_tgt (kr=kr@entry=0x1178220, password=&lt;optimized out&gt;) at src/providers/krb5/krb5_child.c:1761
#4  0x000000000040c283 in tgt_req_child (kr=kr@entry=0x1178220) at src/providers/krb5/krb5_child.c:2114
#5  0x0000000000407161 in main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at src/providers/krb5/krb5_child.c:3379


It&apos;s inprinc=0x6e does not seem to be valid address.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>175794</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2018-11-14 16:51:29 +0300</bug_when>
    <thetext>Here are some more pieces of information from GDB:

(gdb) frame 1
#1  0x00007ff3f6fd0115 in krb5_cc_cache_match (context=0x11a4bb0, client=0x11a0e80, cache_out=cache_out@entry=0x7ffdc68f60b8) at cccursor.c:197
197             ret = krb5_cc_get_principal(context, cache, &amp;princ);
(gdb) print cache-&gt;data
$23 = (krb5_pointer) 0x1182a80
(gdb) print cache-&gt;ops-&gt;prefix
$24 = 0x7ff3f702632a &quot;MEMORY&quot;
(gdb) print cache-&gt;ops-&gt;get_princ
$25 = (krb5_error_code (*)(krb5_context, krb5_ccache, krb5_principal *)) 0x7ff3f6fd7450 &lt;krb5_mcc_get_principal&gt;

So, we are dealing with memory ccache. Looking at *((krb5_mcc_data*)cache-&gt;data), it indeed contains garbage and ((krb5_mcc_data*)cache-&gt;data)-&gt;prin is 0x6e.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>176171</commentid>
    <comment_count>2</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2018-11-29 13:21:50 +0300</bug_when>
    <thetext>krb5-1.16.2-alt2 -&gt; sisyphus:

Thu Nov 29 2018 Stanislav Levin &lt;slev@altlinux&gt; 1.16.2-alt2
- Fixed yield of cache from MEMORY ccache (closes #35597, #35667).

Wed Aug 29 2018 Alexey Shabalin &lt;shaba@altlinux&gt; 1.16.1-alt2
- rebuild with openssl-1.1

Mon Aug 27 2018 Ivan A. Melnikov &lt;iv@altlinux&gt; 1.16.1-alt1
- 1.16.1 (CVE-2018-5729, CVE-2018-5730)

Mon Jan 22 2018 Evgeny Sinelnikov &lt;sin@altlinux&gt; 1.16-alt1
- Update to latest stable release 1.16

Fri Nov 03 2017 Evgeny Sinelnikov &lt;sin@altlinux&gt; 1.15.2-alt2
- Fix build-pdf on Sisyphus
- Add noport, nss_wrapper and socket_wrapper for tests running

Wed Nov 01 2017 Evgeny Sinelnikov &lt;sin@altlinux&gt; 1.15.2-alt1
- Update to latest stable release 1.15.2 with kdcpreauth from 1.16.x

Sun Aug 20 2017 Evgeny Sinelnikov &lt;sin@altlinux.ru&gt; 1.15.1-alt1
- Update to latest stable release 1.15.1 with kdcpreauth from 1.16.x

Fri Mar 24 2017 Evgeny Sinelnikov &lt;sin@altlinux.ru&gt; 1.14.5-alt1
- Update to first spring release 1.14.5

Tue Feb 28 2017 Evgeny Sinelnikov &lt;sin@altlinux.ru&gt; 1.14.4-alt2
- Add _keytab group for default keytab /etc/krb5.keytab

Wed Feb 15 2017 Evgeny Sinelnikov &lt;sin@altlinux.ru&gt; 1.14.4-alt1
- 1.14.4
- fixed CVE-2016-3120</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>