Skip to content

QA fixups and selinux changes for chrony PMDA - #2660

Merged
kmcdonell merged 15 commits into
performancecopilot:mainfrom
kmcdonell:wip
Jul 22, 2026
Merged

QA fixups and selinux changes for chrony PMDA#2660
kmcdonell merged 15 commits into
performancecopilot:mainfrom
kmcdonell:wip

Conversation

@kmcdonell

Copy link
Copy Markdown
Member

As per title.

kmcdonell added 10 commits July 19, 2026 16:48
- fix typo in common.bpftrace diagnostic
- rework logic in 1721 to track biolatency.bt being replaced by
  multiple versions of this file
The xfs metric names order seems to have some dependency on directory
order for the "fake" stats files ... take control and make the order of
metrics to be fetched deterministic.

Also added per-tarball _triage_wait_point using $seq.wait.$iter.
If filename is given, look for it in $here, just like the default
$seq.wait.
Specifically one-liners to answer the question "which installed
packages are using the most disk space?".
Same problem and same fix as was previously triaged for qa/1290.

I now believe this line:

    Warning: invalid file descriptor -1 in syscall fstat()

comes from valgrind on x86_64 RHEL 9.8 and (some versions) of x86_64
Ubuntu 26.04 ... the non-valgrind "dual" tests don't show the warning,
only the valgind variants do.
Same fix as previously applied for qa/987.
… PMDA

1. on RHEL 9.8 the construct
   ifdef(`kernel_io_uring_use', ...)
   fails because the interface is defined but it expands to use
   io_uring_t which is not defined ... this involves a fair amount of
   digging starting with

     $ sudo semodule -X 200 -i pcp.pp
     Failed to resolve typeattributeset statement at /var/lib/selinux/targeted/tmp/modules/200/pcp/cil:118
     Failed to resolve AST
     semodule:  Failed!

   replace the ifdef() with optional_policy() [like we use elswhere
   for other interface uses] seems to fix this.

2. there were a stack of extra AVCs from qa/1686 and the chrony PMDA
   ... it took several iterations before I stopped seeing new AVCs
   so I suspect there are multiple code paths in this PMDA and their
   execution while running qa/1686 is not deterministic, so repeated
   runs see potentially different AVCs

Also tidied up the GNUmakefile to remove duplicate definitions Warnings
that are caused by other people's policies and have nothing to do with
PCP.
Conflicts:
    src/selinux/GNUmakefile

Resolved diffs.
@kmcdonell
kmcdonell requested a review from natoscott July 21, 2026 06:52
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dcd720b-dae2-44ad-919b-0c221e11ab9a

📥 Commits

Reviewing files that changed from the base of the PR and between a20b68e and ffe5ba4.

📒 Files selected for processing (1)
  • src/selinux/pcp.te
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/selinux/pcp.te

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed QA callback counting so callback results no longer inflate failure-related stats.
    • Suppressed recurring, non-actionable Valgrind “invalid file descriptor” messages in QA outputs.
  • Quality Improvements
    • Made XFS metric validation deterministic and improved valgrind output post-processing for more reliable comparisons.
    • Improved bpftrace autostart installation to follow the currently running bpftrace version; updated probe checks accordingly.
  • Documentation
    • Refreshed VM package-management instructions with clearer installed-size sorting and upgrade steps.
  • Compatibility
    • Updated SELinux policy for io_uring usage and expanded chrony-related permissions.
  • Build & Test Support
    • Improved triage wait-file path handling and corrected a bpftrace warning label.

Walkthrough

Changes

The pull request updates QA scripts for deterministic metric checks, Valgrind output filtering, bpftrace setup, wait-file handling, and callback accounting. It also revises VM package guidance and updates SELinux build recipes and PCP policy permissions.

QA validation updates

Layer / File(s) Summary
QA output filtering
qa/1290, qa/1307, qa/1438, qa/1471
Recurring invalid-file-descriptor Valgrind warnings are filtered from QA output and documented as VM-specific.
Deterministic QA execution
qa/987, qa/988, qa/1721, qa/common.check, qa/common.bpftrace
Metric ordering, Valgrind stream handling, bpftrace example selection, wait-file resolution, and a probe-check warning are updated.
QA result accounting
qa/check
Callback results now increment n_callback correctly.
Package guidance
qa/README.vm
Distribution-specific package-size sorting, Slackware upgrade steps, and removal candidates are updated.

SELinux policy updates

Layer / File(s) Summary
SELinux build invocation
src/selinux/GNUmakefile, src/selinux/import/GNUmakefile
SELinux policy builds now invoke the devel Makefile directly without filtering container.if output.
SELinux access policy
src/selinux/pcp.te
Optional io_uring policy handling, directory permissions, and chrony access rules are expanded or revised.

Suggested reviewers: natoscott

Poem

A rabbit filters warnings away,
And sorts the metrics into array.
Bpftrace hops along its versioned trail,
While SELinux guards the chrony mail.
QA counts each callback right.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change set: QA test fixups plus SELinux policy updates for the chrony PMDA.
Description check ✅ Passed The description is minimal, but it still refers to the title and therefore to the same changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
qa/common.check (1)

3849-3852: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Resolve $seq.wait relative to $here in the 0-argument case.

The changes updated the 2-argument branch to explicitly prepend $here/ to the wait file, keeping it consistent with the 1-argument branch and the function documentation. However, the 0-argument fallback case was missed and still resolves $seq.wait in the current working directory, which might lead to unexpected behavior if the script changes directories.

🛠️ Proposed fix
     else
-	__file=$seq.wait
+	__file="$here/$seq.wait"
 	__msg=""
     fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@qa/common.check` around lines 3849 - 3852, Update the 0-argument fallback in
the argument-handling branch to resolve the wait file as relative to $here,
matching the existing 1-argument and 2-argument cases; change the $seq.wait
assignment while preserving the empty $seq.msg initialization.
🧹 Nitpick comments (1)
qa/README.vm (1)

289-289: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Provide the concrete package sorting commands.

The comment # sort packages on installed size, largest to smallest was added to several distribution sections, but the actual commands were omitted. Consider filling these in for completeness:

  • qa/README.vm#L289-L289: add the command for FreeBSD (e.g., pkg query '%as %n' | sort -nr).
  • qa/README.vm#L337-L337: add the command for NetBSD (e.g., pkg_info -as | sort -nr).
  • qa/README.vm#L366-L366: add the command for Gentoo (e.g., qsize -as | sort -nr).
  • qa/README.vm#L444-L444: add the command for Arch Linux (e.g., expac -H M '%m\t%n' | sort -hr or pacman -Qi).
  • qa/README.vm#L479-L479: add the command for OpenIndiana.
  • qa/README.vm#L509-L509: add the command for OpenBSD.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@qa/README.vm` at line 289, Complete each “sort packages on installed size,
largest to smallest” section in qa/README.vm by adding the appropriate concrete
sorting command: FreeBSD at lines 289-289, NetBSD at 337-337, Gentoo at 366-366,
Arch Linux at 444-444, OpenIndiana at 479-479, and OpenBSD at 509-509. Use each
platform’s package-management tooling and ensure output is sorted by installed
size in descending order.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/selinux/GNUmakefile`:
- Line 49: Update the SELinux policy compilation recipe in GNUmakefile to
capture the output of the $(MAKE) invocation in a temporary file, preserve and
explicitly propagate its exit status, then filter the captured output to
suppress only the specified duplicate-definition warnings. Ensure successful
builds remain successful even when all output is filtered, and failed
compilations still fail the recipe; clean up the temporary file in all cases.

In `@src/selinux/pcp.te`:
- Around line 116-118: Guard both kernel_io_uring_use calls with an ifdef before
their existing optional_policy blocks: update src/selinux/pcp.te lines 116-118
for pcp_pmcd_t and lines 234-236 for pcp_pmproxy_t. Preserve optional_policy
inside each ifdef so builds without the macro remain compatible while the
dependency stays optional at load time.

---

Outside diff comments:
In `@qa/common.check`:
- Around line 3849-3852: Update the 0-argument fallback in the argument-handling
branch to resolve the wait file as relative to $here, matching the existing
1-argument and 2-argument cases; change the $seq.wait assignment while
preserving the empty $seq.msg initialization.

---

Nitpick comments:
In `@qa/README.vm`:
- Line 289: Complete each “sort packages on installed size, largest to smallest”
section in qa/README.vm by adding the appropriate concrete sorting command:
FreeBSD at lines 289-289, NetBSD at 337-337, Gentoo at 366-366, Arch Linux at
444-444, OpenIndiana at 479-479, and OpenBSD at 509-509. Use each platform’s
package-management tooling and ensure output is sorted by installed size in
descending order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c3e83684-2987-4da1-9bbf-a028f7d05a1f

📥 Commits

Reviewing files that changed from the base of the PR and between f0c99d8 and d1f61f2.

⛔ Files ignored due to path filters (2)
  • qa/987.out is excluded by !**/*.out
  • qa/988.out is excluded by !**/*.out
📒 Files selected for processing (13)
  • qa/1290
  • qa/1307
  • qa/1438
  • qa/1471
  • qa/1721
  • qa/987
  • qa/988
  • qa/README.vm
  • qa/check
  • qa/common.bpftrace
  • qa/common.check
  • src/selinux/GNUmakefile
  • src/selinux/pcp.te

Comment thread src/selinux/GNUmakefile Outdated
@test -d tmp || mkdir tmp # workaround an el7 selinux makefile issue
# lots of duplicate definition from system container.if - filter out
$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp 2>&1 | grep -v container.if
$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp 2>&1 | grep -v -E '/(container|zabbix|nbdkit|passt|smartmon|insights_core)\.if:[0-9]*: Warning: duplicate definition'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preserve the make exit status when filtering warnings.

Piping $(MAKE) directly into grep without pipefail masks the exit status of make. If the SELinux policy compilation fails, grep -v will still exit with 0 (since it outputs the build errors which don't match the regex), causing this Makefile recipe to falsely report success. This can lead to stale .pp files being silently packaged without developers noticing the failure.

Additionally, if make succeeds and outputs only warnings which are completely filtered out, grep -v will exit with 1, causing the build to falsely fail.

Store the output in a temporary file and explicitly preserve the original make exit status:

🛠 Proposed fix
-	$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp 2>&1 | grep -v -E '/(container|zabbix|nbdkit|passt|smartmon|insights_core)\.if:[0-9]*: Warning: duplicate definition'
+	@$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp > tmp/build.log 2>&1; \
+	RET=$$?; \
+	grep -v -E '/(container|zabbix|nbdkit|passt|smartmon|insights_core)\.if:[0-9]*: Warning: duplicate definition' tmp/build.log || true; \
+	exit $$RET
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp 2>&1 | grep -v -E '/(container|zabbix|nbdkit|passt|smartmon|insights_core)\.if:[0-9]*: Warning: duplicate definition'
@$(MAKE) -f /usr/share/selinux/devel/Makefile $(IAM).pp > tmp/build.log 2>&1; \
RET=$$?; \
grep -v -E '/(container|zabbix|nbdkit|passt|smartmon|insights_core)\.if:[0-9]*: Warning: duplicate definition' tmp/build.log || true; \
exit $$RET
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/selinux/GNUmakefile` at line 49, Update the SELinux policy compilation
recipe in GNUmakefile to capture the output of the $(MAKE) invocation in a
temporary file, preserve and explicitly propagate its exit status, then filter
the captured output to suppress only the specified duplicate-definition
warnings. Ensure successful builds remain successful even when all output is
filtered, and failed compilations still fail the recipe; clean up the temporary
file in all cases.

Comment thread src/selinux/pcp.te Outdated
As pointed out by @coderrabbitai in the context of PR performancecopilot#2660 it is a bad
idea to use the construct
	$(MAKE) ... | grep
in a makefile rule because the result (as far as make is concerned)
moves from the exit status of $(MAKE) to the exit status of grep.
Simply dropping the | grep part of the rule is the right fix.

We are already catching and culling these triaged (not-a-PCP-issue)
selinux build warnings in scripts/cull-build-warnings.

Same change in src/selinux/import/GNUmakefile
As suggested by @coderrabbitai in the context of PR performancecopilot#2660, I had missed
setting the "$here/" prefix for the wait file on the no arguments code
path ... fortunately this is usage of _triage_wait_point() rare (maybe
never?) and not very useful in practice.
@coderabbitai suggestion to avoid build failure on RHEL 7
(and older) where kernel_io_uring_use() is not defined.
@kmcdonell
kmcdonell merged commit 9a9be68 into performancecopilot:main Jul 22, 2026
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 25, 2026
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