Skip to content

Commit

Permalink
rules: UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG property (systemd#3714
Browse files Browse the repository at this point in the history
)

Sometimes, the persistent storage rules should be skipped for a subset
of devices. For example, the Qubes operating system prevents dom0 from
parsing untrusted block device content (such as filesystem metadata) by
shipping a custom 60-persistent-storage.rules, patched to bail out early
if the device name matches a hardcoded pattern.

As a less brittle and more flexible alternative, this commit adds a line
to the two relevant .rules files which makes them test the value of the
UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG device property, modeled
after the various DM_UDEV_DISABLE_*_RULES_FLAG properties.
  • Loading branch information
Rusty Bird authored and poettering committed Jul 15, 2016
1 parent 2ed9688 commit 542127e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/60-persistent-storage-tape.rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# persistent storage links: /dev/tape/{by-id,by-path}

ACTION=="remove", GOTO="persistent_storage_tape_end"
ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_tape_end"

# type 8 devices are "Medium Changers"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $devnode", \
Expand Down
1 change: 1 addition & 0 deletions rules/60-persistent-storage.rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <[email protected]>

ACTION=="remove", GOTO="persistent_storage_end"
ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_end"

SUBSYSTEM!="block", GOTO="persistent_storage_end"
KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|scm*|pmem*", GOTO="persistent_storage_end"
Expand Down

0 comments on commit 542127e

Please sign in to comment.