<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:54:09 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-12615] Lustre mdt_object_remote() bug</title>
                <link>https://jira.whamcloud.com/browse/LU-12615</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;In the latest version of lustre file system, the mdt module has a null pointer dereference bug due to the lack of validation for specific fields of packets sent by client.&lt;/p&gt;

&lt;p&gt;The kernel panic:&lt;/p&gt;

&lt;p&gt;&#160;&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;
[93830.742518] BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
[93830.745373] IP: [&amp;lt;ffffffffc101cc2a&amp;gt;] mdt_object_lock_internal+0x4a/0x360 [mdt]
[93830.748121] PGD 0
[93830.750311] Oops: 0000 [#1] SMP
[93830.752631] Modules linked in: ofd(OE) ost(OE) osp(OE) mdd(OE) lod(OE) mdt(OE) lfsck(OE) mgs(OE) osd_ldiskfs(OE) lquota(OE) ldiskfs(OE) loop lustre(OE) obdecho(OE) mgc(OE) lov(OE) mdc(OE) osc(OE) lmv(OE) fid(OE) fld(OE) ptlrpc(OE) obdclass(OE) crc_t10dif crct10dif_generic ksocklnd(OE) lnet(OE) libcfs(OE) dm_flakey dm_mod nfit libnvdimm iosf_mbi crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ppdev ablk_helper parport_pc cryptd parport virtio_balloon joydev i2c_piix4 pcspkr ip_tables ext4 mbcache jbd2 ata_generic pata_acpi virtio_net virtio_console virtio_blk cirrus drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm ata_piix crct10dif_pclmul drm crct10dif_common crc32c_intel libata serio_raw virtio_pci virtio_ring virtio drm_panel_orientation_quirks floppy [last unloaded: stap_f794b15c5a4eaa0a0f39cf777c459f09_5532]
[93830.772472]
[93830.774428] CPU: 0 PID: 5222 Comm: mdt00_004 Kdump: loaded Tainted: G           OE  ------------   3.10.0-957.10.1.el7_lustre.x86_64 #1
[93830.779447] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 3288b3c 04/01/2014
[93830.782131] task: ffff9e93fb009040 ti: ffff9e90369d8000 task.ti: ffff9e90369d8000
[93830.784762] RIP: 0010:[&amp;lt;ffffffffc101cc2a&amp;gt;]  [&amp;lt;ffffffffc101cc2a&amp;gt;] mdt_object_lock_internal+0x4a/0x360 [mdt]
[93830.787609] RSP: 0018:ffff9e90369dba80  EFLAGS: 00010246
[93830.789999] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9e90369dbae8
[93830.792546] RDX: ffff9e93ef99a0f0 RSI: 0000000000000000 RDI: ffff9e93ef99a000
[93830.795054] RBP: ffff9e90369dbad0 R08: 0000000000000000 R09: 0000000000000000
[93830.797536] R10: ffff9e9400aa3c00 R11: 0000000000000020 R12: ffff9e93ef99a0f0
[93830.799980] R13: ffff9e93ef99a000 R14: ffff9e90369dbae8 R15: 0000000000000000
[93830.802402] FS:  0000000000000000(0000) GS:ffff9e943fc00000(0000) knlGS:0000000000000000
[93830.804901] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[93830.807152] CR2: 0000000000000050 CR3: 0000000422b0e000 CR4: 00000000003606f0
[93830.809521] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[93830.811846] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[93830.814138] Call Trace:
[93830.816037]  [&amp;lt;ffffffffc094c2dc&amp;gt;] ? lustre_msg_get_flags+0x2c/0xa0 [ptlrpc]
[93830.818297]  [&amp;lt;ffffffffc1025f33&amp;gt;] mdt_intent_getxattr+0xb3/0x2c0 [mdt]
[93830.820529]  [&amp;lt;ffffffffc10229e4&amp;gt;] mdt_intent_policy+0x2d4/0xdd0 [mdt]
[93830.822702]  [&amp;lt;ffffffffc1025e80&amp;gt;] ? mdt_intent_getattr+0x480/0x480 [mdt]
[93830.824902]  [&amp;lt;ffffffffc08ffc66&amp;gt;] ldlm_lock_enqueue+0x356/0xa20 [ptlrpc]
[93830.827040]  [&amp;lt;ffffffffc05da3d3&amp;gt;] ? cfs_hash_bd_add_locked+0x63/0x80 [libcfs]
[93830.829184]  [&amp;lt;ffffffffc05dd96e&amp;gt;] ? cfs_hash_add+0xbe/0x1a0 [libcfs]
[93830.831278]  [&amp;lt;ffffffffc0928587&amp;gt;] ldlm_handle_enqueue0+0xa47/0x15a0 [ptlrpc]
[93830.833470]  [&amp;lt;ffffffffc0950520&amp;gt;] ? lustre_swab_ldlm_lock_desc+0x30/0x30 [ptlrpc]
[93830.835699]  [&amp;lt;ffffffffc09b1082&amp;gt;] tgt_enqueue+0x62/0x210 [ptlrpc]
[93830.837786]  [&amp;lt;ffffffffc09b72ca&amp;gt;] tgt_request_handle+0x91a/0x15c0 [ptlrpc]
[93830.839875]  [&amp;lt;ffffffffc05d6fa7&amp;gt;] ? libcfs_debug_msg+0x57/0x80 [libcfs]
[93830.841956]  [&amp;lt;ffffffffc095a88e&amp;gt;] ptlrpc_server_handle_request+0x24e/0xab0 [ptlrpc]
[93830.844066]  [&amp;lt;ffffffffb1ccbadb&amp;gt;] ? __wake_up_common+0x5b/0x90
[93830.846014]  [&amp;lt;ffffffffc095e384&amp;gt;] ptlrpc_main+0xbb4/0x20f0 [ptlrpc]
[93830.847946]  [&amp;lt;ffffffffb1cd08c0&amp;gt;] ? finish_task_switch+0x50/0x1c0
[93830.849866]  [&amp;lt;ffffffffc095d7d0&amp;gt;] ? ptlrpc_register_service+0xfa0/0xfa0 [ptlrpc]
[93830.851842]  [&amp;lt;ffffffffb1cc1c71&amp;gt;] kthread+0xd1/0xe0
[93830.853559]  [&amp;lt;ffffffffb1cc1ba0&amp;gt;] ? insert_kthread_work+0x40/0x40
[93830.855362]  [&amp;lt;ffffffffb2375c1d&amp;gt;] ret_from_fork_nospec_begin+0x7/0x21
[93830.857178]  [&amp;lt;ffffffffb1cc1ba0&amp;gt;] ? insert_kthread_work+0x40/0x40
[93830.858951] Code: 89 f3 48 83 ec 28 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 f6 05 bd a3 5d ff 01 74 0d f6 05 b8 a3 5d ff 04 0f 85 7e 00 00 00 &amp;lt;48&amp;gt; 8b 43 50 f6 40 1c 02 0f 85 d6 00 00 00 45 0f b6 c9 4d 89 f8 
[93830.864078] RIP  [&amp;lt;ffffffffc101cc2a&amp;gt;] mdt_object_lock_internal+0x4a/0x360 [mdt]
[93830.866025]  RSP &amp;lt;ffff9e90369dba80&amp;gt;
[93830.867566] CR2: 0000000000000050
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In function mdt_object_remote(), there is no check about the pointer o, if the value of o is null, a null pointer dereference bug will happen.&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;
&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; inline &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; mdt_object_remote(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct mdt_object *o){ 
&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; lu_object_remote(&amp;amp;o-&amp;gt;mot_obj);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="56530">LU-12615</key>
            <summary>Lustre mdt_object_remote() bug</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.whamcloud.com/images/icons/priorities/critical.svg">Critical</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="1">Fixed</resolution>
                                        <assignee username="hongchao.zhang">Hongchao Zhang</assignee>
                                    <reporter username="yunye.ry">Alibaba Cloud</reporter>
                        <labels>
                    </labels>
                <created>Tue, 30 Jul 2019 11:19:59 +0000</created>
                <updated>Thu, 12 Sep 2019 04:14:21 +0000</updated>
                            <resolved>Wed, 21 Aug 2019 11:29:37 +0000</resolved>
                                    <version>Lustre 2.13.0</version>
                                    <fixVersion>Lustre 2.13.0</fixVersion>
                    <fixVersion>Lustre 2.12.3</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="252349" author="pjones" created="Wed, 31 Jul 2019 17:58:42 +0000"  >&lt;p&gt;Hongchao&lt;/p&gt;

&lt;p&gt;Could you please investigate&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="252381" author="hongchao.zhang" created="Thu, 1 Aug 2019 12:15:02 +0000"  >&lt;p&gt;Hi,&lt;br/&gt;
What is the client version?&lt;br/&gt;
if the mdt_object is NULL, there could be two cases, the first is there is no MDT_BODY field in the request,&lt;br/&gt;
the second is no OBD_MD_FLID flag is set on &quot;body-&amp;gt;mbo_valid&quot;.&lt;/p&gt;

&lt;p&gt;btw, is the kernel dump available?&lt;br/&gt;
Thanks!&lt;/p&gt;</comment>
                            <comment id="252396" author="adilger" created="Thu, 1 Aug 2019 17:37:35 +0000"  >&lt;p&gt;Hongchao, this is being induced by specially-crafted RPC requests to test error handling on the server.&lt;/p&gt;

&lt;p&gt;It looks like this is via:&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;mdt_intent_getxattr()
  -&amp;gt;mdt_object_lock(info-&amp;gt;mti_object)
    -&amp;gt;mdt_object_lock_internal()
      -&amp;gt;mdt_object_remote()
        -&amp;gt;lu_object_remote(&amp;amp;o-&amp;gt;mot_obj)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;tt&gt;info-&amp;gt;mti_object&lt;/tt&gt; field is assigned in &lt;tt&gt;mdt_body_unpack()&lt;/tt&gt;, but that is checking &lt;tt&gt;!IS_ERR(obj)&lt;/tt&gt; before assigning it.  It looks like the problem is caused by the request not containing the &lt;tt&gt;OBD_MD_FLID&lt;/tt&gt; flag to indicate that the &lt;tt&gt;mbo_fid1&lt;/tt&gt; field is valid, which causes &lt;tt&gt;mdt_body_unpack()&lt;/tt&gt; to return without setting &lt;tt&gt;mti_object&lt;/tt&gt;, without returning an error.  For some RPCs (e.g. &lt;tt&gt;mdt_sync()&lt;/tt&gt;) there is an MDT_BODY field, but is not a requirement for &lt;tt&gt;OBD_MD_FLFID&lt;/tt&gt; to be set because it can be used for both whole-device sync or single-file sync, so this is correct behavior for &lt;tt&gt;mdt_body_unpack()&lt;/tt&gt;.  The other place that &lt;tt&gt;mti_object&lt;/tt&gt; is assigned is &lt;tt&gt;tsi2mdt_info()&lt;/tt&gt; using &lt;tt&gt;tsi_corpus&lt;/tt&gt;, but that is itself set in &lt;tt&gt;mdt_body_unpack()&lt;/tt&gt; so is the same root cause.&lt;/p&gt;

&lt;p&gt;I checked all of the &lt;tt&gt;mdt_reint_&amp;#42;&lt;/tt&gt; routines and they appear to handle the error from &lt;tt&gt;mdt_object_find()&lt;/tt&gt; properly, so you should focus on other places that are using &lt;tt&gt;mti_object&lt;/tt&gt; directly.  Looking at &lt;tt&gt;mdt_sync()&lt;/tt&gt;, the handling is a bit strange because it is checking if &lt;tt&gt;mbo_fid1&lt;/tt&gt; is unset for the whole-device sync, then assumes &lt;tt&gt;mti_object&lt;/tt&gt; is OK otherwise (which it may not be if &lt;tt&gt;OBD_MD_FLFID&lt;/tt&gt; is unset).  &lt;/p&gt;

&lt;p&gt;I think there are two potential ways to handle this:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;add checks for &lt;tt&gt;mti_object == NULL&lt;/tt&gt; at the start of high-level RPC handling routines &lt;tt&gt;mdt_intent_getxattr()&lt;/tt&gt;, &lt;tt&gt;mdt_getattr()&lt;/tt&gt;, &lt;tt&gt;mdt_getxattr()&lt;/tt&gt;, &lt;tt&gt;mdt_swap_layouts()&lt;/tt&gt;, and &lt;tt&gt;mdt_sync()&lt;/tt&gt; (some of which LASSERT(obj != NULL) or equivalent, and should instead just return &lt;tt&gt;-EPROTO&lt;/tt&gt; in that case)&lt;/li&gt;
	&lt;li&gt;add checks in low-level routines like &lt;tt&gt;mdt_object_remote()&lt;/tt&gt;, &lt;tt&gt;mdt_object_exists()&lt;/tt&gt;, &lt;tt&gt;mdt_object_child()&lt;/tt&gt;, &lt;tt&gt;mdt_object_fid()&lt;/tt&gt; that are accessing &lt;tt&gt;mot_obj&lt;/tt&gt;, but those functions are called in a lot of places and if &lt;tt&gt;mti_object&lt;/tt&gt; is checked once at the top level then we don&apos;t need to check it repeatedly, so I&apos;d rather not do this.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="252927" author="gerrit" created="Sun, 11 Aug 2019 06:57:47 +0000"  >&lt;p&gt;Hongchao Zhang (hongchao@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/35764&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/35764&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12615&quot; title=&quot;Lustre mdt_object_remote() bug&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12615&quot;&gt;&lt;del&gt;LU-12615&lt;/del&gt;&lt;/a&gt; mdt: check mdt_object&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 9ad3ae7465eaedcc86772c2518e88def4b18b8e8&lt;/p&gt;</comment>
                            <comment id="253335" author="gerrit" created="Wed, 21 Aug 2019 04:48:10 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/35764/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/35764/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12615&quot; title=&quot;Lustre mdt_object_remote() bug&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12615&quot;&gt;&lt;del&gt;LU-12615&lt;/del&gt;&lt;/a&gt; mdt: check mdt_object&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: e5e0bdb7a5c2d47ceaa2d1c190806d1be4999129&lt;/p&gt;</comment>
                            <comment id="253365" author="pjones" created="Wed, 21 Aug 2019 11:29:37 +0000"  >&lt;p&gt;Landed for 2.13&lt;/p&gt;</comment>
                            <comment id="253457" author="gerrit" created="Thu, 22 Aug 2019 21:09:45 +0000"  >&lt;p&gt;Minh Diep (mdiep@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/35869&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/35869&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12615&quot; title=&quot;Lustre mdt_object_remote() bug&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12615&quot;&gt;&lt;del&gt;LU-12615&lt;/del&gt;&lt;/a&gt; mdt: check mdt_object&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_12&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: f562e6cea802aa408bd94c84427e983eeae55730&lt;/p&gt;</comment>
                            <comment id="254577" author="gerrit" created="Thu, 12 Sep 2019 03:47:57 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/35869/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/35869/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12615&quot; title=&quot;Lustre mdt_object_remote() bug&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12615&quot;&gt;&lt;del&gt;LU-12615&lt;/del&gt;&lt;/a&gt; mdt: check mdt_object&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_12&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 41e2bd9752851a7f3989c6edfe2134742d0ab59f&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="56513">LU-12605</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|i00kf3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</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>