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

qubes-pciback: add optional support for PCI device whitelisting #107

Closed
wants to merge 1 commit into from

Conversation

3hhh
Copy link
Contributor

@3hhh 3hhh commented Nov 22, 2022

This feature can be used by advanced users to assign devices to pciback in a policy-like manner based on various PCI device attributes.

References QubesOS/qubes-issues#7886 QubesOS/qubes-issues#7792

@marmarek
Copy link
Member

First of all, please s/whitelist/allowlist/;s/blacklist/blocklist/.
But then, I don't like the file embedded into initramfs as the only configuration option - this is incompatible dracut --no-hostonly (which should produce universal initramfs, independent of local hardware). There should be an option to use cmdline for that.
Additionally, asking the user to use regex directly sounds like a massive footgun. It's easy to match vendor/product id instead of device class for example. Better go with more constrained approach: for example list of allowed classes, or maybe just list of allowed devices directly (list of BDF, as for rd.qubes.hide_pci).

@3hhh
Copy link
Contributor Author

3hhh commented Nov 23, 2022 via email

@3hhh
Copy link
Contributor Author

3hhh commented Nov 23, 2022

I think I now implemented what you probably meant.

Anyway if you don't like the overall approach, please close it down.

This feature can be used by advanced users to assign devices
to pciback in a policy-like manner based on various PCI device
attributes.

References
QubesOS/qubes-issues#7886
QubesOS/qubes-issues#7792
@marmarek
Copy link
Member

I still don't like regex as configuration format. It's way too easy to produce both a) something that doesn't work at all (unpleasant but usually you can boot alternative kernel and fix your config), and b) config that appears to work, but does something completely different than you wanted (like not exclude devices you meant to exclude).

As for hostonly-mode compatibility, there should be a way to configure it purely on command line (yes, it's pretty much incompatible with using regex like you did), without embedding any extra config file.

Anyway, while this version probably is fine for you, it isn't something I want to introduce (and promise to maintain) into standard Qubes setup. If you want, you can open another PR with simplified (less powerful, but also less of a footgun) interface.

@marmarek marmarek closed this Nov 29, 2022
@3hhh
Copy link
Contributor Author

3hhh commented Dec 3, 2022

Well, the only other relatively simple variant that might work as syntax language in bash would be globbing statements.

One could try that, but it still leaves the issue of PCIE hotplugging: Currently hotplugged PCIE devices (Expresscard, Thunderbolt, ...) will land in dom0 and may exploit whatever dom0 kernel bug there.
Maybe Xen PCIE hotplugging is disabled, but that won't stop the dom0 kernel from parsing the device and loading drivers etc.

IMHO that issue could only be solved with some sort of dom0 kernel driver that makes policy decisions. This driver should then also be used at boot time. So hopefully there's no need for the functionality of this PR in the long run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants