Skip to content

test how much does fapolicyd affect a source RPM rebuild#23

Open
milosmalik wants to merge 1 commit intolinux-application-whitelisting:mainfrom
milosmalik:effect-on-source-RPM-rebuild
Open

test how much does fapolicyd affect a source RPM rebuild#23
milosmalik wants to merge 1 commit intolinux-application-whitelisting:mainfrom
milosmalik:effect-on-source-RPM-rebuild

Conversation

@milosmalik
Copy link
Collaborator

Recently reported customer cases revealed that a running fapolicyd service has a negative effect (slowdown) on SW building process.

TBA later

The TC cover RHEL-2611.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new stress test designed to quantify the performance overhead of the fapolicyd service during source RPM rebuild operations. The primary goal is to investigate and provide data on a reported customer issue where fapolicyd negatively impacts software build times. The changes include the test definition, the execution script, and an update to the CI plan to incorporate this new performance measurement.

Highlights

  • New Stress Test Added: A new test has been introduced to measure the performance impact of fapolicyd on source RPM rebuilds, directly addressing customer-reported slowdowns.
  • CI Plan Update: The CI test plan (Plans/ci-tests.fmf) was updated to explicitly include and run this new stress test, ensuring its execution in the continuous integration pipeline.
  • Fapolicyd Configuration for Testing: The test script includes setup to configure fapolicyd rules to allow necessary operations within the /root/rpmbuild directory, ensuring the build process can proceed while fapolicyd is active.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Plans/ci-tests.fmf
    • Disabled the 'modified-only' discovery setting.
    • Added an explicit reference to the new '/Stress/effect-on-source-RPM-rebuild' test.
  • Stress/effect-on-source-RPM-rebuild/main.fmf
    • Created a new FMF test definition for evaluating fapolicyd's impact on source RPM rebuilds.
    • Specified test script, duration, and required packages (fapolicyd, fapolicyd-selinux, rpm-build).
    • Included platform-specific adjustments to disable the test on older RHEL versions (4-7).
    • Linked the test to the Red Hat issue tracker (RHEL-2611).
  • Stress/effect-on-source-RPM-rebuild/runtest.sh
    • Developed a Beakerlib shell script to execute the fapolicyd stress test.
    • Configured fapolicyd rules to allow RPM build operations within /root/rpmbuild.
    • Performed source RPM rebuilds with fapolicyd enabled and disabled for comparison.
    • Included assertions to check for 'Operation not permitted' errors during builds.
Activity
  • No specific review comments or activity have been recorded yet for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new stress test to measure the performance impact of fapolicyd on RPM builds. The test script has a critical issue where it fails to capture and report the performance data, which is its primary goal. There are also several opportunities for improvement in the script's robustness and maintainability, such as avoiding fragile file globbing, refactoring duplicated code into a function, and consolidating commands for better readability.

rlRun "rpm -ivh ./fapolicyd-*"
rlRun -s "time rpmbuild -bb ~/rpmbuild/SPECS/fapolicyd.spec"
rlAssertNotGrep "Operation not permitted" $rlRun_LOG -i
rm -f $rlRun_LOG

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The log file containing the time command's output is being deleted here without capturing the performance data. This makes the performance measurement aspect of the test ineffective, which is the primary goal of this test. The same issue is present on line 61. You should parse $rlRun_LOG to extract the build time before removing the file in both places, store the values, and then compare them at the end of the test to report on the performance impact. For example: TIME_WITH_FAPOLICYD=$(grep '^real' $rlRun_LOG | awk '{print $2}').

Comment on lines +35 to +36
rlRun "echo 'allow perm=any uid=root : dir=/root/rpmbuild' > /etc/fapolicyd/rules.d/22-buildroot.rules"
rlRun "echo 'allow perm=any uid=root trust=1 : all' >> /etc/fapolicyd/rules.d/22-buildroot.rules"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These two rlRun calls with echo can be combined into a single rlRun with a cat heredoc. This improves readability and is slightly more efficient as it invokes rlRun only once.

Suggested change
rlRun "echo 'allow perm=any uid=root : dir=/root/rpmbuild' > /etc/fapolicyd/rules.d/22-buildroot.rules"
rlRun "echo 'allow perm=any uid=root trust=1 : all' >> /etc/fapolicyd/rules.d/22-buildroot.rules"
rlRun "cat <<EOF > /etc/fapolicyd/rules.d/22-buildroot.rules
allow perm=any uid=root : dir=/root/rpmbuild
allow perm=any uid=root trust=1 : all
EOF"

@milosmalik milosmalik force-pushed the effect-on-source-RPM-rebuild branch 2 times, most recently from 231b6bf to 0702f14 Compare March 5, 2026 07:08
Recently reported customer cases revealed that a running fapolicyd
service has a negative effect (slowdown) on SW building process.

TBA later

The TC cover RHEL-2611.
@milosmalik milosmalik force-pushed the effect-on-source-RPM-rebuild branch from 0702f14 to b41a2b9 Compare March 5, 2026 08:29
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.

1 participant