<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:05: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-7002] mkfs.lustre mishandles SELinux context of temporary directory</title>
                <link>https://jira.whamcloud.com/browse/LU-7002</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;After Shadow&apos;s patch for &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2655&quot; title=&quot;Make ability to mount lustre server target on selinux enabled servers.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2655&quot;&gt;&lt;del&gt;LU-2655&lt;/del&gt;&lt;/a&gt; (see &lt;a href=&quot;http://review.whamcloud.com/5135&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/5135&lt;/a&gt;), in &lt;tt&gt;ldiskfs_write_ldd()&lt;/tt&gt; if SELinux is enabled then the security context of the temporary mount point is appended to the mount options. Unfortunately this is done by appending the context to ldd_mount_opts and so it gets written into CONFIGS/mountdata.&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;# lsb_release -d
Description:	  CentOS Linux release 7.1.1503 (Core) 
# git describe
v2_7_57_0-60-g0addfa9
# getenforce
Enforcing
# insmod ./ldiskfs/ldiskfs.ko 
# dd if=/dev/zero of=/tmp/lustre-mdt1 bs=1K count=200000
200000+0 records in
200000+0 records out
204800000 bytes (205 MB) copied, 1.40722 s, 146 MB/s
# mkfs.lustre --fsname=lustre --mgs --mdt --index=0 /tmp/lustre-mdt1

   Permanent disk data:
Target:     lustre:MDT0000
Index:      0
Lustre FS:  lustre
Mount type: ldiskfs
Flags:      0x65
              (MDT MGS first_time update )
Persistent mount opts: user_xattr,errors=remount-ro
Parameters:

checking for existing Lustre data: not found
formatting backing filesystem ldiskfs on /dev/loop0
	   target name  lustre:MDT0000
	   4k blocks     0
	   options        -I 512 -i 2048 -q -O dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg -E lazy_journal_init -F
mkfs_cmd = mke2fs -j -b 4096 -L lustre:MDT0000  -I 512 -i 2048 -q -O dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg -E lazy_journal_init -F /dev/loop0
Writing CONFIGS/mountdata
# mount /tmp/lustre-mdt1 /mnt/mds1 -t ldiskfs -o loop
# hexdump -C /mnt/mds1/CONFIGS/mountdata 
00000000  01 00 d0 1d 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000010  01 00 00 00 65 00 00 00  00 00 00 00 01 00 00 00  |....e...........|
00000020  6c 75 73 74 72 65 00 00  00 00 00 00 00 00 00 00  |lustre..........|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  6c 75 73 74 72 65 3a 4d  44 54 30 30 30 30 00 00  |lustre:MDT0000..|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001000  75 73 65 72 5f 78 61 74  74 72 2c 65 72 72 6f 72  |user_xattr,error|
00001010  73 3d 72 65 6d 6f 75 6e  74 2d 72 6f 2c 63 6f 6e  |s=remount-ro,con|
00001020  74 65 78 74 3d 75 6e 63  6f 6e 66 69 6e 65 64 5f  |text=unconfined_|
00001030  75 3a 6f 62 6a 65 63 74  5f 72 3a 75 73 65 72 5f  |u:object_r:user_|
00001040  74 6d 70 5f 74 3a 73 30  00 00 00 00 00 00 00 00  |tmp_t:s0........|
00001050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00003000
# umount /mnt/mds1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then when the device is mounted as lustre mount.lustre tries to clear the &lt;tt&gt;LDD_F_UPDATE&lt;/tt&gt; flag from CONFIGS/mountdata, so we call &lt;tt&gt;ldiskfs_write_ldd()&lt;/tt&gt; again which appends the context to the new temporary directory to &lt;tt&gt;ldd_mount_opts&lt;/tt&gt; and uses the result as the options to mount the target as ldiskfs. This fails since the context option can only be specified once.&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;# LOAD=1 ./lustre/tests/llmount.sh
Loading modules from /root/lustre-release/lustre
...
# strace -f -o mount.strace -s 1024 mount /tmp/lustre-mdt1 /mnt/mds1 -t lustre -o loop
mount.lustre: Unable to mount /dev/loop0: Invalid argument

mount.lustre FATAL: failed to write local files: Invalid argument
# awk &apos;$2 ~ /^mount/&apos; mount.strace
8672  mount(&quot;/dev/loop0&quot;, &quot;/tmp/mntACvy85&quot;, &quot;ldiskfs&quot;, 0, &quot;user_xattr,errors=remount-ro,context=unconfined_u:object_r:user_tmp_t:s0,context=unconfined_u:object_r:user_tmp_t:s0&quot;) = -1 EINVAL (Invalid argument)
8672  mount(&quot;/dev/loop0&quot;, &quot;/mnt/mds1&quot;, &quot;lustre&quot;, MS_STRICTATIME, &quot;osd=osd-ldiskfs,user_xattr,errors=remount-ro,context=unconfined_u:object_r:user_tmp_t:s0,mgs,update,svname=lustre-MDT0000,device=/dev/loop0&quot;) = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;mount.lustre does succeed but the &lt;tt&gt;LDD_F_UPDATE&lt;/tt&gt; flag is never cleared.&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;# mount
...
/tmp/lustre-mdt1 on /mnt/mds1 type lustre (ro,seclabel)
# umount /mnt/mds1
# mount /tmp/lustre-mdt1 /mnt/mds1 -t lustre -o loop
mount.lustre: Unable to mount /dev/loop0: Invalid argument

mount.lustre FATAL: failed to write local files: Invalid argument
# mount
...
/tmp/lustre-mdt1 on /mnt/mds1 type lustre (ro,seclabel)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="31469">LU-7002</key>
            <summary>mkfs.lustre mishandles SELinux context of temporary directory</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="1">Fixed</resolution>
                                        <assignee username="jhammond">John Hammond</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                            <label>SELinux</label>
                            <label>utils</label>
                    </labels>
                <created>Thu, 13 Aug 2015 15:07:38 +0000</created>
                <updated>Mon, 24 Oct 2016 16:08:37 +0000</updated>
                            <resolved>Mon, 14 Mar 2016 03:14:58 +0000</resolved>
                                    <version>Lustre 2.5.0</version>
                    <version>Lustre 2.7.0</version>
                    <version>Lustre 2.8.0</version>
                                    <fixVersion>Lustre 2.9.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>10</watches>
                                                                            <comments>
                            <comment id="124063" author="jgmitter" created="Thu, 13 Aug 2015 17:20:51 +0000"  >&lt;p&gt;John,&lt;br/&gt;
Assigning to you as I understand you are taking on this work.&lt;br/&gt;
Thanks.&lt;br/&gt;
Joe&lt;/p&gt;</comment>
                            <comment id="141311" author="gerrit" created="Fri, 5 Feb 2016 10:22:02 +0000"  >&lt;p&gt;Frederic Saunier (frederic.saunier@atos.net) uploaded a new patch: &lt;a href=&quot;http://review.whamcloud.com/18319&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/18319&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-7002&quot; title=&quot;mkfs.lustre mishandles SELinux context of temporary directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-7002&quot;&gt;&lt;del&gt;LU-7002&lt;/del&gt;&lt;/a&gt; utils: SELinux context repeated in mount opts&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 62cddd677017bad162a568202b5f8ac940424c1b&lt;/p&gt;</comment>
                            <comment id="145370" author="gerrit" created="Mon, 14 Mar 2016 02:41:53 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/18319/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/18319/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-7002&quot; title=&quot;mkfs.lustre mishandles SELinux context of temporary directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-7002&quot;&gt;&lt;del&gt;LU-7002&lt;/del&gt;&lt;/a&gt; utils: SELinux context repeated in mount opts&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: a40a4e630c515301497f409a491fd3eb6a715f01&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="17241">LU-2655</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|hzxkfj:</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>