Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mount.mounted doesn't remount when removing noexec option. #41510

Closed
UtahDave opened this issue May 30, 2017 · 9 comments
Closed

mount.mounted doesn't remount when removing noexec option. #41510

UtahDave opened this issue May 30, 2017 · 9 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - 2018.3.0
Milestone

Comments

@UtahDave
Copy link
Contributor

Description of Issue/Question

When removing the noexec option the mount isn't remounted.

Setup

Create an XFS mount

sudo apt-get install xfsprogs
sudo dd if=/dev/zero of=/virtualfs bs=1024 count=30720
sudo losetup /dev/loop0 /virtualfs
sudo mkfs -t xfs /dev/loop0
sudo mkdir /mnt/vfs

Steps to Reproduce Issue

cat /srv/salt/testmount.sls

/mnt/vfs:
  mount.mounted:
    - device: /dev/loop0
    - fstype: xfs
    - mkmnt: True
    - opts: defaults,nodev,nosuid,noexec
salt '<minion id>' state.sls testmount
[boucha@elsapo ~]$ mount
<-- snip -->
/dev/loop0 on /mnt/vfs type xfs (rw,noexec,nosuid,nodev)

Change the sls file to:

/mnt/vfs:
  mount.mounted:
    - device: /dev/loop0
    - fstype: xfs
    - mkmnt: True
    - opts: defaults,nodev,nosuid
salt '<minion id>' state.sls testmount
[boucha@elsapo ~]$ mount
<-- snip -->
/dev/loop0 on /mnt/vfs type xfs (rw,noexec,nosuid,nodev)

The above didn't cause a remount, so let's do that below.

sudo umount /mnt/vfs
sudo mount -t xfs /dev/loop0 /mnt/vfs
[boucha@elsapo ~]$ mount
<-- snip -->
/dev/loop0 on /mnt/vfs type xfs (rw)

Versions Report

[boucha@elsapo mnt]$ salt --versions-report
Salt Version:
           Salt: 2016.11.4
 
Dependency Versions:
           cffi: 1.9.1
       cherrypy: unknown
       dateutil: 2.6.0
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: 1.4.4
       M2Crypto: 0.21.1
           Mako: 0.9.1
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.17
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
   python-gnupg: 0.3.7
         PyYAML: 3.12
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.3
            ZMQ: 4.0.5
 
System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-119-generic
         system: Linux
        version: Ubuntu 14.04 trusty
@UtahDave UtahDave added the ZD The issue is related to a Zendesk customer support ticket. label May 30, 2017
@gtmanfred gtmanfred added Bug broken, incorrect, or confusing behavior P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around labels May 30, 2017
@gtmanfred gtmanfred added this to the Approved milestone May 30, 2017
@gtmanfred
Copy link
Contributor

Yup, it looks like this updates /etc/fstab, but does not issue a remount.

Thanks for reporting,
Daniel

@rickh563
Copy link

ZD-1482

@cachedout
Copy link
Contributor

@garethgreenaway Please have a look and tell me if you think this is viable.

@UtahDave
Copy link
Contributor Author

Would it be as simple as adding xfs to this list?

if fstype in ['nfs', 'cvfs'] or fstype.startswith('fuse'):

@garethgreenaway
Copy link
Contributor

garethgreenaway commented Jun 6, 2017

My suspicions would be that noexec is one of the invisible options that shows up in the results from the mount command but it not in the /proc/self/mountinfo file which is used to determine what is mounted. Potential fix would be to add noexec to the list here:

mount_invisible_options = [

Updated: Ran a quick test and it looks like it is there. Going to dig into this and see whats happening.

@garethgreenaway
Copy link
Contributor

@UtahDave To confirm, you do get a message back saying that fstab was updated right? The volume just wasn't remounted?

@garethgreenaway
Copy link
Contributor

Digging more into this, it looks like the logic that is checking for mount options is only going one way. If a volume is mounted with a certain set of options, then an additional one is added later, a remount is forced. If an option is taken away then a remount is not forced. Seems this should go both ways, working on a fix now.

@cachedout
Copy link
Contributor

@garethgreenaway Did you ever get a fix in for this? If so, does it need to be linked here so this can be closed?

@garethgreenaway
Copy link
Contributor

@cachedout Still thinking about how to fix this one.

@garethgreenaway garethgreenaway added the fixed-pls-verify fix is linked, bug author to confirm fix label Sep 13, 2017
@Ch3LL Ch3LL closed this as completed Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around ZD The issue is related to a Zendesk customer support ticket. ZRELEASED - 2018.3.0
Projects
None yet
Development

No branches or pull requests

6 participants