Bug 1405188

Summary: /dev/shm is created with 755 permissions instead of 777 when the dracut fcoe module is included
Product: Red Hat Enterprise Linux 7 Reporter: Kyle Walker <kwalker>
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED DUPLICATE QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.4CC: dracut-maint-list, ptalbert
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-02 14:33:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to correct the permissions none

Description Kyle Walker 2016-12-15 20:18:27 UTC
Description of problem:
 The following BZ results in the /dev/shm filesystem being mounted with the incorrect 755 permissions:

	https://bugzilla.redhat.com/show_bug.cgi?id=1246217

This has been noted in multiple different Fedora bug reports.

Version-Release number of selected component (if applicable):

	dracut-network-033-463.el7.x86_64

How reproducible:

	Easily

Steps to Reproduce:
1. yum install fcoe-utils lldpad
2. dracut -f -v -a fcoe
3. reboot and verify /dev/shm permissions

Actual results:

	# ls -ld /dev/shm
	drwxr-xr-t. 2 root root 60 Dec 15 15:09 /dev/shm


Expected results:

	$ ls -ld /dev/shm
	drwxrwxrwt. 2 root root 260 Dec 15 15:16 /dev/shm


Additional info:

Comment 1 Kyle Walker 2016-12-15 20:24:19 UTC
Created attachment 1232319 [details]
Patch to correct the permissions

The underlying issue is due to:

/usr/lib/dracut/modules.d/95fcoe/cleanup-fcoe.sh
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e /var/run/lldpad.pid ]; then
    lldpad -k
    mkdir -m 0755 -p /run/initramfs/state/dev/shm
    cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1
    echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab
fi


The above /run/initramfs/state/dev/shm persists across the switchroot as the /dev/shm interface. By issuing the mkdir above as 777, the correct permissions are observed following boot.

Comment 2 Lukáš Nykrýn 2017-01-02 14:33:10 UTC

*** This bug has been marked as a duplicate of bug 1406254 ***

Comment 3 Lukáš Nykrýn 2017-01-02 14:39:07 UTC
That patch is not correct, it will leave a writable directory in /run which could be a security risk. In fedora we now have a fix in initscripts that we don't modify the directory permissions if the directory exists.