selabel: Use pcre2 for regex#318
Conversation
|
Looks good. We require sign-offs in commits and there seems to be a lint error |
SELinux uses pcre2 for its regex library, and there's a Rust crate for it available, so might as well use it for compatibility. Using the regular regex crate also doesn't support look-arounds, so better to move away from it anyways. Fixes composefs#317 Signed-off-by: Dallas Strouse <dallas.strouse2007@gmail.com>
|
Should be good now. Apparently I added a reference where one wasn't needed so I threw that out, and I added the signed-off-by. |
|
Also, fwiw, if it ever turns out to be a problem, you can enable the JIT by using |
|
Nevermind. Looks like no JIT wins, at least on my system. |
|
This removes some optimizations that may or may not matter (I don't know) so we should be careful about this and try to verify that the hit is not too important. |
|
Figured it out; I pulled the secureblue/silverblue image and extracted it, then ran the bootc shipped by my distribution (Fedora) and a patched bootc from bootc-dev/bootc#2262: JIT enabled is worse: |
|
I'm not sure if there's another library out there that's compatible with the PCRE2 regex flavor that SELinux uses. I've also tried hyperscan and regexr, but hyperscan is slower than pcre2, and regexr likes to error out: |
cgwalters
left a comment
There was a problem hiding this comment.
Thanks, this looks sane.
That said, it may make sense instead at some point to cut over to using https://docs.rs/selinux/latest/selinux/label/struct.Labeler.html#method.look_up_by_path instead
Temporarily update bootc in the tools container to use the version from the rhcontainerbot copr that is built from the latest commits. This includes fixes for SELinux label support for Bazzite. See: composefs/composefs-rs#318
Also temporarily update bootc in the container image to use the version from the rhcontainerbot copr that is built from the latest commits. This includes fixes for SELinux label support for Bazzite. This is thus required to compute the same composefs hash when building the UKI and when deploying the image on the system. See: composefs/composefs-rs#318 See: bf6e8fa tools: Use latest bootc from rhcontainerbot copr
SELinux uses pcre2 for its regex library, and there's a Rust crate for it available, so might as well use it for compatibility. Using the regular regex crate also doesn't support look-arounds, so better to move away from it anyways.
Fixes #317
(hopefully).cargo testpasses, so I think we're good. I don't quite know how to shimmy this into bootc so I can test it properly.