<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:02:01 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-13525] struct sepol_downcall_data is badly formed</title>
                <link>https://jira.whamcloud.com/browse/LU-13525</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;The &lt;tt&gt;struct sepol_downcall_data&lt;/tt&gt; is badly formed for use between kernel and userspace for several reasons:&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;
struct sepol_downcall_data {
        __u32           sdd_magic;
        __kernel_time_t sdd_sepol_mtime;
        __u16           sdd_sepol_len;
        &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt;            sdd_sepol[0];
};
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Firstly, it uses a &quot;&lt;tt&gt;time_t&lt;/tt&gt;&quot; (now &quot;&lt;tt&gt;_&lt;em&gt;kernel_time_t&lt;/tt&gt;&quot;) field, which can be variably sized, either 32-bit or 64-bit depending on the size of &quot;&lt;tt&gt;long&lt;/tt&gt;&quot; (or now &quot;&lt;tt&gt;&lt;/em&gt;_kernel_long_t&lt;/tt&gt;&quot;).  This should be a fixed-size __s64 type so that it is always the same.&lt;/p&gt;

&lt;p&gt;The change from &lt;tt&gt;time_t&lt;/tt&gt; to &lt;tt&gt;kernel_time_t&lt;/tt&gt; in patch &lt;a href=&quot;https://review.whamcloud.com/37678&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37678&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13274&quot; title=&quot;Building againt lustreapi using -std=c99&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13274&quot;&gt;&lt;del&gt;LU-13274&lt;/del&gt;&lt;/a&gt; uapi: make lustre UAPI headers C99 compliant&lt;/tt&gt;&quot; may have broken ABI compatibility for 32-bit userspace (if a 32-bit &lt;tt&gt;l_getsepol&lt;/tt&gt; is used in a VM), but was only landed as commit &lt;tt&gt;v2_13_52-157-g7a7309fa84&lt;/tt&gt; and &lt;tt&gt;b2_12_4-22-g0417dce9fc&lt;/tt&gt; so has not been in a release yet, so can still be fixed before 2.14.0 and 2.12.5 are released.&lt;/p&gt;

&lt;p&gt;Secondly, it has &lt;tt&gt;__u32 sdd_magic&lt;/tt&gt; that is immediately before a (maybe) 64-bit field, which introduces a (maybe) 32-bit padding into the field, depending on the compiler and architecture.  The 64-bit fields in a structure should always be naturally aligned on 64-bit boundaries to avoid potential incompatibility in the structure definition.&lt;/p&gt;

&lt;p&gt;Thirdly, it has &lt;tt&gt;_&lt;em&gt;u16 sdd_sepol_len&lt;/tt&gt; which _may&lt;/em&gt; be followed by padding.&lt;/p&gt;

&lt;p&gt;A better &lt;tt&gt;struct sepol_downcall_data&lt;/tt&gt; that is safe for data transfer between the kernel and userspace would be:&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-comment&quot;&gt;/* old &lt;span class=&quot;code-keyword&quot;&gt;interface&lt;/span&gt; struct is deprecated in 2.14 */&lt;/span&gt;
#define SEPOL_DOWNCALL_MAGIC_OLD 0x8b8bb842
struct sepol_downcall_data_old {
        __u32           sdd_magic;
        __kernel_time_t sdd_sepol_mtime;
        __u16           sdd_sepol_len;
        &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt;            sdd_sepol[0];
};

#define SEPOL_DOWNCALL_MAGIC 0x8b8bb843
struct sepol_downcall_data {
        __u32           sdd_magic;
        __u16           sdd_sepol_len;
        __u16           sdd_padding1;
        __s64          sdd_sepol_mtime;
        &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt;            sdd_sepol[0];
};
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We need to keep compatibility with &lt;tt&gt;struct sepol_downcall_data_old&lt;/tt&gt; for some short time, because this was included in the 2.12.1 release, so &lt;tt&gt;lprocfs_sptlrpc_sepol_seq_write()&lt;/tt&gt; should handle both old and new structs, with a version check for 2.16.53 or so.&lt;/p&gt;</description>
                <environment></environment>
        <key id="59071">LU-13525</key>
            <summary>struct sepol_downcall_data is badly formed</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="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="sebastien">Sebastien Buisson</assignee>
                                    <reporter username="adilger">Andreas Dilger</reporter>
                        <labels>
                            <label>LTS12</label>
                    </labels>
                <created>Wed, 6 May 2020 19:03:52 +0000</created>
                <updated>Thu, 10 Sep 2020 13:52:21 +0000</updated>
                            <resolved>Thu, 10 Sep 2020 13:52:21 +0000</resolved>
                                    <version>Lustre 2.14.0</version>
                    <version>Lustre 2.12.5</version>
                                    <fixVersion>Lustre 2.14.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="269949" author="gerrit" created="Tue, 12 May 2020 16:23:19 +0000"  >&lt;p&gt;Sebastien Buisson (sbuisson@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/38580&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/38580&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13525&quot; title=&quot;struct sepol_downcall_data is badly formed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13525&quot;&gt;&lt;del&gt;LU-13525&lt;/del&gt;&lt;/a&gt; sec: better struct sepol_downcall_data&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 9107bdbf80019781890b850ce0f4b9cd72ae94f9&lt;/p&gt;</comment>
                            <comment id="273905" author="gerrit" created="Sun, 28 Jun 2020 02:47:18 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/38580/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/38580/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13525&quot; title=&quot;struct sepol_downcall_data is badly formed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13525&quot;&gt;&lt;del&gt;LU-13525&lt;/del&gt;&lt;/a&gt; sec: better struct sepol_downcall_data&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 82b8cb5528f489e9ceb7a1899722fc4108e85739&lt;/p&gt;</comment>
                            <comment id="274962" author="simmonsja" created="Fri, 10 Jul 2020 12:14:02 +0000"  >&lt;p&gt;This is done?&lt;/p&gt;</comment>
                            <comment id="279221" author="simmonsja" created="Thu, 10 Sep 2020 13:52:21 +0000"  >&lt;p&gt;The patch landed so this looks done. If not please reopen.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="42505">LU-8955</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="58142">LU-13274</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|i00znz:</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>