<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:21:39 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-8915] Don&apos;t use linux list structure as user land arguments for lnet selftest</title>
                <link>https://jira.whamcloud.com/browse/LU-8915</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;As the upstream client looks like move out of staging issues are being brought up that need to be addressed. One issue is that the lnet selftest utility uses and passes linux kernel link list as arguments. A new proper user land interface has to be developed do we can stop using linux link list arguments as ioctl parameters.&lt;/p&gt;</description>
                <environment></environment>
        <key id="42271">LU-8915</key>
            <summary>Don&apos;t use linux list structure as user land arguments for lnet selftest</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.whamcloud.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="4" iconUrl="https://jira.whamcloud.com/images/icons/statuses/reopened.png" description="This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.">Reopened</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="simmonsja">James A Simmons</assignee>
                                    <reporter username="simmonsja">James A Simmons</reporter>
                        <labels>
                    </labels>
                <created>Wed, 7 Dec 2016 14:25:44 +0000</created>
                <updated>Thu, 19 Jan 2023 20:48:49 +0000</updated>
                                            <version>Lustre 2.10.0</version>
                                    <fixVersion>Lustre 2.16.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>11</watches>
                                                                            <comments>
                            <comment id="176911" author="pjones" created="Wed, 7 Dec 2016 18:51:52 +0000"  >&lt;p&gt;Thanks James&lt;/p&gt;</comment>
                            <comment id="176915" author="simmonsja" created="Wed, 7 Dec 2016 18:58:34 +0000"  >&lt;p&gt;Before I go changing user land API&apos;s Doug, Amir and the rest of the LNet guys need to chime in for what the API should looks like.&lt;/p&gt;</comment>
                            <comment id="268901" author="adilger" created="Wed, 29 Apr 2020 21:30:32 +0000"  >&lt;p&gt;I was looking at this today in the context of patch &lt;a href=&quot;https://review.whamcloud.com/38105&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/38105&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13344&quot; title=&quot;Support for linux 5.6 clients&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13344&quot;&gt;&lt;del&gt;LU-13344&lt;/del&gt;&lt;/a&gt; lnet: stop using struct timeval&lt;/tt&gt;&quot; and came to the conclusion that we aren&apos;t &lt;em&gt;really&lt;/em&gt; using &quot;&lt;tt&gt;struct list_head&lt;/tt&gt;&quot; in the userspace interface, even though it looks that way.&lt;/p&gt;

&lt;p&gt;What is actually being done is that &lt;tt&gt;stuct list_head&lt;/tt&gt; is being used in userspace to generate a linked list of reply buffers for requests, and the kernel is essentially using the &quot;&lt;tt&gt;.next&lt;/tt&gt;&quot; field in &lt;tt&gt;lstcon_rpc_trans_interpreter()&lt;/tt&gt; as a way of passing a series of userspace pointers to the kernel. The somewhat confusing part is that this is done within a &lt;tt&gt;list_for_each_entry()&lt;/tt&gt; loop in the kernel, but that is actually walking a &lt;b&gt;different&lt;/b&gt; list, which is OK.&lt;/p&gt;

&lt;p&gt;For the &quot;&lt;tt&gt;head_up&lt;/tt&gt;&quot; pointer passed from userspace, each one has the &quot;&lt;tt&gt;struct lstcon_rpc_ent&lt;/tt&gt;&quot; copied properly from userspace, but only the &lt;tt&gt;.next&lt;/tt&gt; field is used from &quot;&lt;tt&gt;struct list_head rpe_link&lt;/tt&gt;&quot; to point to the next &quot;&lt;tt&gt;struct lstcon_rpc_ent&lt;/tt&gt;&quot; structure. The fact that all of these functions pass &quot;&lt;tt&gt;struct list_head __user *head_up&lt;/tt&gt;&quot; as an argument is misleading and makes it look like they could be using &lt;tt&gt;list_for_each()&lt;/tt&gt; in the kernel on this list, but that never happens. Also, since &quot;&lt;tt&gt;rpe_link&lt;/tt&gt;&quot; is the first field in the structure, passing the &quot;&lt;tt&gt;head_up&lt;/tt&gt;&quot; pointer (named &lt;tt&gt;result_up&lt;/tt&gt; in the caller) as the function argument is really the same as passing the pointer to &quot;&lt;tt&gt;struct lstcon_rpc_ent&lt;/tt&gt;&quot; itself.&lt;/p&gt;

&lt;p&gt;I think it would be possible to change all of these functions and structs in &lt;tt&gt;lnet/include/uapi/linux/lnet/lnetst.h&lt;/tt&gt; from passing &quot;&lt;tt&gt;struct list_head __user *&lt;/tt&gt;&quot; to passing &quot;&lt;tt&gt;struct lstcon_rpc_ent __user *&lt;/tt&gt;&quot; as the argument with no functional difference in the code (even binary compatibility), since all of these pointers end up down in &lt;tt&gt;lstcon_rpc_trans_interpreter()&lt;/tt&gt; at the end. Inside &lt;tt&gt;lstcon_rpc_trans_interpreter()&lt;/tt&gt; instead of &quot;&lt;tt&gt;ent = list_entry()&lt;/tt&gt;&quot; it would use &quot;&lt;tt&gt;ent = container_of()&lt;/tt&gt;&quot; (which &lt;tt&gt;list_entry()&lt;/tt&gt; uses internally these days anyway) to make it clear that it isn&apos;t treating this as a &lt;tt&gt;list_head&lt;/tt&gt;. The &lt;tt&gt;rpe_link.next&lt;/tt&gt; field is treated as a 64-bit field that holds a userspace pointer to the next &quot;&lt;tt&gt;struct lstcon_rpc_ent&lt;/tt&gt;&quot;, which is only ever accessed via &lt;tt&gt;copy_to_user()&lt;/tt&gt; or compared against itself, which is fine.&lt;/p&gt;

&lt;p&gt;In summary, I think we can remove the use of &quot;&lt;tt&gt;struct list&amp;#95;head&lt;/tt&gt;&quot; for from the &lt;tt&gt;lnetst.h&lt;/tt&gt; user/kernel interface without even compatibility issues.&lt;/p&gt;</comment>
                            <comment id="298655" author="gerrit" created="Tue, 13 Apr 2021 14:28:44 +0000"  >&lt;p&gt;James Simmons (jsimmons@infradead.org) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/43298&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/43298&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-8915&quot; title=&quot;Don&amp;#39;t use linux list structure as user land arguments for lnet selftest&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-8915&quot;&gt;LU-8915&lt;/a&gt; lnet: migrate LNet selftest session handling to Netlink&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 3d1631ed0561651bdef83b138f086864f54c6a5d&lt;/p&gt;</comment>
                            <comment id="352860" author="gerrit" created="Mon, 14 Nov 2022 08:24:34 +0000"  >&lt;p&gt;&quot;Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/43298/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/43298/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-8915&quot; title=&quot;Don&amp;#39;t use linux list structure as user land arguments for lnet selftest&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-8915&quot;&gt;LU-8915&lt;/a&gt; lnet: migrate LNet selftest session handling to Netlink&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 15c82ae3d31969afd866ca825c2f6ab11ae36a8f&lt;/p&gt;</comment>
                            <comment id="352896" author="pjones" created="Mon, 14 Nov 2022 14:10:49 +0000"  >&lt;p&gt;Only patch seems to have landed for 2.16. Should reopen if more is to come&lt;/p&gt;</comment>
                            <comment id="352899" author="simmonsja" created="Mon, 14 Nov 2022 14:15:50 +0000"  >&lt;p&gt;More patches coming.&lt;/p&gt;</comment>
                            <comment id="355107" author="gerrit" created="Mon, 5 Dec 2022 15:26:36 +0000"  >&lt;p&gt;&quot;James Simmons &amp;lt;jsimmons@infradead.org&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/49314&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/49314&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-8915&quot; title=&quot;Don&amp;#39;t use linux list structure as user land arguments for lnet selftest&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-8915&quot;&gt;LU-8915&lt;/a&gt; lnet: migrate LNet selftest group handling to Netlink&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 3a0d2dda2cdcb491f11b0ea4977a8ccb11bcf37e&lt;/p&gt;</comment>
                            <comment id="359658" author="gerrit" created="Thu, 19 Jan 2023 15:27:26 +0000"  >&lt;p&gt;&quot;Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/49314/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/49314/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-8915&quot; title=&quot;Don&amp;#39;t use linux list structure as user land arguments for lnet selftest&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-8915&quot;&gt;LU-8915&lt;/a&gt; lnet: migrate LNet selftest group handling to Netlink&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: a6c2d277d09ce9b33d5407dd08da7ffc42066de0&lt;/p&gt;</comment>
                            <comment id="359737" author="pjones" created="Thu, 19 Jan 2023 20:22:22 +0000"  >&lt;p&gt;Still more to come?&lt;/p&gt;</comment>
                            <comment id="359752" author="simmonsja" created="Thu, 19 Jan 2023 20:48:49 +0000"  >&lt;p&gt;yes&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="52056">LU-10975</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="46759">LU-9680</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="13182">LU-10391</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|hzyxpr:</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>