<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:50:37 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-5337] bad free from lod_striped_it_fini()</title>
                <link>https://jira.whamcloud.com/browse/LU-5337</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;This was found using memory allocation fault injection.&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;export MDSCOUNT=4
llmount.sh

lfs mkdir -c4 /mnt/lustre/d0
echo /root/lustre-release/lustre/osp/osp_object.c:1149 &amp;gt; /proc/fs/lustre/alloc_fail # fail to alloc it in osp_it_init()
rmdir /mnt/lustre/d0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[  152.160897] ------------[ cut here ]------------
[  152.161814] kernel BUG at mm/slab.c:2965!
[  152.161814] invalid opcode: 0000 [#1] SMP 
[  152.161814] last sysfs file: /sys/devices/system/cpu/possible
[  152.161814] CPU 1 
[  152.161814] Modules linked in: lustre(U) ofd(U) osp(U) lod(U) ost(U) mdt(U) mdd(U) mgs(U) nodemap(U) osd_ldiskfs(U) ldiskfs(U) exportfs lquota(U) lfsck(U) jbd obdecho(U) mgc(U) lov(U) osc(U) mdc(U) lmv(U) fid(U) fld(U) ptlrpc(U) obdclass(U) ksocklnd(U) lnet(U) sha512_generic sha256_generic libcfs(U) autofs4 nfs lockd fscache auth_rpcgss nfs_acl sunrpc ipv6 microcode virtio_balloon virtio_net i2c_piix4 i2c_core ext4 jbd2 mbcache virtio_blk virtio_pci virtio_ring virtio pata_acpi ata_generic ata_piix dm_mirror dm_region_hash dm_log dm_mod [last unloaded: speedstep_lib]
[  152.177629] 
[  152.177629] Pid: 6163, comm: mdt00_002 Not tainted 2.6.32-431.5.1.el6.lustre.x86_64 #1 Bochs Bochs
[  152.177629] RIP: 0010:[&amp;lt;ffffffff81184707&amp;gt;]  [&amp;lt;ffffffff81184707&amp;gt;] cache_free_debugcheck+0x1c7/0x260
[  152.177629] RSP: 0018:ffff8801f8169960  EFLAGS: 00010002
[  152.177629] RAX: 0000000080042800 RBX: ffff88021fd304c0 RCX: ffff8801f816c000
[  152.177629] RDX: 0000000000000000 RSI: 0000000000080000 RDI: ffff8801f816c570
[  152.177629] RBP: ffff8801f81699a0 R08: 00000000fffffffe R09: 0000000000000000
[  152.177629] R10: 000000000000000f R11: 000000000000000f R12: ffff8801f816c570
[  152.177629] R13: ffff8801f94301f0 R14: ffffffffa0d9df54 R15: ffff8801f94302a0
[  152.177629] FS:  0000000000000000(0000) GS:ffff88002fa00000(0000) knlGS:0000000000000000
[  152.177629] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[  152.177629] CR2: 00000000006d4460 CR3: 0000000217dfe000 CR4: 00000000000006e0
[  152.177629] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  152.177629] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  152.177629] Process mdt00_002 (pid: 6163, threadinfo ffff8801f8168000, task ffff8801f8166600)
[  152.177629] Stack:
[  152.177629]  ffff8801f8145418 ffff8801f816c570 0000000000000000 ffff88021fd304c0
[  152.177629] &amp;lt;d&amp;gt; 0000000000000286 ffff8801f816c570 ffff88021ccdf308 ffff8801f94302a0
[  152.177629] &amp;lt;d&amp;gt; ffff8801f81699f0 ffffffff81187a99 ffff8801f81699c0 ffff8801de8aecc0
[  152.177629] Call Trace:
[  152.177629]  [&amp;lt;ffffffff81187a99&amp;gt;] kfree+0xe9/0x300
[  152.177629]  [&amp;lt;ffffffffa0d9df54&amp;gt;] osp_it_fini+0x194/0x1e0 [osp]
[  152.177629]  [&amp;lt;ffffffffa0d5a044&amp;gt;] lod_striped_it_fini+0xb4/0x200 [lod]
[  152.177629]  [&amp;lt;ffffffffa0805143&amp;gt;] mdd_may_delete+0x543/0x990 [mdd]
[  152.177629]  [&amp;lt;ffffffffa08055d5&amp;gt;] mdd_unlink_sanity_check+0x45/0x100 [mdd]
[  152.177629]  [&amp;lt;ffffffffa080c563&amp;gt;] mdd_unlink+0x233/0xcc0 [mdd]
[  152.177629]  [&amp;lt;ffffffffa0cb985a&amp;gt;] ? mdt_reint_unlink+0x9ca/0x10b0 [mdt]
[  152.177629]  [&amp;lt;ffffffffa0cb0a08&amp;gt;] mdo_unlink+0x18/0x50 [mdt]
[  152.177629]  [&amp;lt;ffffffffa0cb9894&amp;gt;] mdt_reint_unlink+0xa04/0x10b0 [mdt]
[  152.177629]  [&amp;lt;ffffffffa0cb07a1&amp;gt;] mdt_reint_rec+0x41/0xe0 [mdt]
[  152.177629]  [&amp;lt;ffffffffa0c9baf3&amp;gt;] mdt_reint_internal+0x4c3/0x7c0 [mdt]
[  152.177629]  [&amp;lt;ffffffffa0c9c37b&amp;gt;] mdt_reint+0x6b/0x120 [mdt]
[  152.177629]  [&amp;lt;ffffffffa06ebc35&amp;gt;] tgt_request_handle+0x245/0xad0 [ptlrpc]
[  152.177629]  [&amp;lt;ffffffffa069ed91&amp;gt;] ptlrpc_main+0xcf1/0x1880 [ptlrpc]
[  152.177629]  [&amp;lt;ffffffff81554710&amp;gt;] ? _spin_unlock_irq+0x30/0x40
[  152.177629]  [&amp;lt;ffffffff8105e57d&amp;gt;] ? finish_task_switch+0x7d/0x110
[  152.177629]  [&amp;lt;ffffffff8105e548&amp;gt;] ? finish_task_switch+0x48/0x110
[  152.177629]  [&amp;lt;ffffffff815514a5&amp;gt;] ? thread_return+0x4e/0x7d9
[  152.177629]  [&amp;lt;ffffffffa069e0a0&amp;gt;] ? ptlrpc_main+0x0/0x1880 [ptlrpc]
[  152.177629]  [&amp;lt;ffffffff8109eab6&amp;gt;] kthread+0x96/0xa0
[  152.177629]  [&amp;lt;ffffffff8100c30a&amp;gt;] child_rip+0xa/0x20
[  152.177629]  [&amp;lt;ffffffff81554710&amp;gt;] ? _spin_unlock_irq+0x30/0x40
[  152.177629]  [&amp;lt;ffffffff8100bb10&amp;gt;] ? restore_args+0x0/0x30
[  152.177629]  [&amp;lt;ffffffff8109ea20&amp;gt;] ? kthread+0x0/0xa0
[  152.177629]  [&amp;lt;ffffffff8100c300&amp;gt;] ? child_rip+0x0/0x20
[  152.177629] Code: ff a5 48 83 c4 18 4c 89 e0 5b 41 5c 41 5d 41 5e 41 5f c9 c3 8b 83 0c 80 00 00 4d 89 74 04 f8 8b 83 14 80 00 00 eb 80 0f 0b eb fe &amp;lt;0f&amp;gt; 0b eb fe 0f 0b 0f 1f 00 eb fb 48 8b 40 10 48 8b 10 e9 d0 fe 
[  152.177629] RIP  [&amp;lt;ffffffff81184707&amp;gt;] cache_free_debugcheck+0x1c7/0x260
[  152.177629]  RSP &amp;lt;ffff8801f8169960&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem is at the bottom of lod_striped_it_next(). If do_index_try() or dio_it.init() fail then it-&amp;gt;lit_it still points to the old (invalid) down layer iterator. In this case after next() fails, mdd_dir_is_empty() calls lod_striped_it_fini() which in turn calls osp_it_fini() on the already invalid osd_it_ea iterator.&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;        next-&amp;gt;do_index_ops-&amp;gt;dio_it.put(env, it-&amp;gt;lit_it);
        next-&amp;gt;do_index_ops-&amp;gt;dio_it.fini(env, it-&amp;gt;lit_it);

        rc = next-&amp;gt;do_ops-&amp;gt;do_index_try(env, next, &amp;amp;dt_directory_features);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (rc != 0)
                RETURN(rc);

        next = lo-&amp;gt;ldo_stripe[it-&amp;gt;lit_stripe_index];
        LASSERT(next != NULL);
        LASSERT(next-&amp;gt;do_index_ops != NULL);

        it_next = next-&amp;gt;do_index_ops-&amp;gt;dio_it.init(env, next, it-&amp;gt;lit_attr,
                                                  BYPASS_CAPA);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!IS_ERR(it_next)) {
                it-&amp;gt;lit_it = it_next;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; again;
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                rc = PTR_ERR(it_next);
        }

        RETURN(rc);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="25558">LU-5337</key>
            <summary>bad free from lod_striped_it_fini()</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="3">Duplicate</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                            <label>lod</label>
                            <label>malloc</label>
                            <label>osp</label>
                    </labels>
                <created>Mon, 14 Jul 2014 14:27:08 +0000</created>
                <updated>Fri, 5 Jun 2015 00:31:54 +0000</updated>
                            <resolved>Sun, 3 May 2015 03:58:58 +0000</resolved>
                                    <version>Lustre 2.6.0</version>
                    <version>Lustre 2.7.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                            <comments>
                            <comment id="114101" author="di.wang" created="Sun, 3 May 2015 03:58:58 +0000"  >&lt;p&gt;Will fix this in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6530&quot; title=&quot;LustreError: 4286:0:(lod_object.c:572:lod_striped_it_next()) LBUG&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6530&quot;&gt;&lt;del&gt;LU-6530&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="29735">LU-6530</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzwrbb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14892</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>