Skip to content

ci: cover disabled SELinux and SMACK paths - #15447

Open
limadog9 wants to merge 3 commits into
uutils:mainfrom
limadog9:ci/security-contexts-disabled
Open

limadog9 wants to merge 3 commits into
uutils:mainfrom
limadog9:ci/security-contexts-disabled

Conversation

@limadog9

Copy link
Copy Markdown
Contributor

Build and lint both security-context features on an Ubuntu runner with the kernel facilities disabled. Run explicit binary integration tests for the disabled paths and correct the Cargo feature comments.

Closes #13332.

@codspeed

codspeed Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will regress 1 benchmark

1 warning, 1 note

⚠️ 120 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 412 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory cp_recursive_deep_tree[(120, 4)] 705.4 KB 789 KB -10.6%
⚡ Memory timeout_enforced 179.6 KB 88.8 KB ×2
⚡ CPU Simulation df_deep_directory 940.3 µs 900 µs +4.48%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing limadog9:ci/security-contexts-disabled (dd10a6c) with main (53ca8ad)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@oech3

oech3 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Can we disable SELinux at existing job and run this instead?

@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from 1b33e91 to 8c904dd Compare October 17, 2026 14:23
@limadog9

Copy link
Copy Markdown
Contributor Author

Updated to reuse the existing SELinux job. It runs the enabled tests, then restarts the same Fedora VM with selinux=0 and runs the disabled-path tests with both features built. Removed the separate job.

run: |
lima bash -c 'test "$(getenforce)" = Disabled && test ! -e /sys/fs/smackfs'
- name: Test disabled security context handling
run: lima bash -c "cd work && cargo test --features 'feat_selinux,feat_smack' --no-default-features --test tests security_contexts_disabled"

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.

why no test for mkdir and mkfifo? the issue was found with mkdir's SMACK branch
please add test_security_contexts_disabled in test_mkdir.rs and test_mkfifo.rs too

Comment thread tests/by-util/test_cp.rs
}

#[test]
#[cfg(all(target_os = "linux", feature = "feat_selinux", feature = "feat_smack"))]

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.

same guard copied in 6 files, could be a small helper in uutests, no?

@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from 8c904dd to 89f4192 Compare October 17, 2026 21:26
@limadog9

Copy link
Copy Markdown
Contributor Author

Added test_security_contexts_disabled for mkdir and mkfifo, and extracted the shared guard into uutests. The new test also caught a disabled-SELinux bug in mkfifo, which is fixed. All eight tests pass.

Comment thread src/uu/mkfifo/src/mkfifo.rs Outdated
let set_security_context = matches.get_flag(options::SECURITY_CONTEXT);
let context = matches.get_one::<String>(options::CONTEXT);
if set_security_context || context.is_some() {
if (set_security_context || context.is_some()) && uucore::selinux::is_selinux_enabled()

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.

this is a mkfifo fix, could you please put it in its own commit (mkfifo: ...)?

Comment thread tests/by-util/test_mkdir.rs Outdated
return;
}
let scene = TestScenario::new(util_name!());
for (option, dir) in [("-Z", "default"), ("--context=some_context", "explicit")] {

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.

mknod, cp and install warn "ignoring --context" here, why is mkdir silent?
this test locks in the silent ignore, could you please make it warn too?

Comment thread tests/by-util/test_mkfifo.rs Outdated
for (option, fifo) in [
("-Z", "default"),
("--context", "default_long"),
("--context=some_context", "explicit"),

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.

same here, mkfifo should warn like mknod does

@sylvestre

Copy link
Copy Markdown
Contributor

sorry but it needs to be rebased

@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from 89f4192 to da40907 Compare November 3, 2026 10:58
@sylvestre
sylvestre force-pushed the ci/security-contexts-disabled branch from da40907 to 957ea1f Compare November 6, 2026 10:39
@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch 4 times, most recently from 40325ae to b7b78cd Compare November 8, 2026 14:28
@sylvestre
sylvestre force-pushed the ci/security-contexts-disabled branch from b7b78cd to 51bf134 Compare November 14, 2026 09:28
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from 51bf134 to e0c9308 Compare November 14, 2026 14:34
@limadog9

Copy link
Copy Markdown
Contributor Author

Rebased and removed the unrelated tail changes. Kept the CI coverage, mkfifo fix, and mkdir fix in separate commits as requested.

@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from e0c9308 to 1f8fa4c Compare November 23, 2026 01:08
@sylvestre
sylvestre force-pushed the ci/security-contexts-disabled branch from 1f8fa4c to 0f44782 Compare November 23, 2026 19:15
@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from 0f44782 to f3f7cd4 Compare November 29, 2026 15:15
@sylvestre
sylvestre force-pushed the ci/security-contexts-disabled branch from f3f7cd4 to dd10a6c Compare November 29, 2026 15:20
Build both security-context features in the Fedora job. Reboot the VM with SELinux disabled and run the disabled-kernel tests using the shared uutests check.

Closes uutils#13332.
Skip SELinux creation contexts when the kernel facility is disabled. Warn once for an explicit context when neither SELinux nor SMACK is enabled, while keeping default context requests silent. Cover empty contexts and multiple operands in the disabled-kernel tests.
Match GNU by warning once for an explicit context when neither SELinux nor SMACK is enabled. Keep -Z silent and verify that both operands are created, including when the explicit context is empty.
@limadog9
limadog9 force-pushed the ci/security-contexts-disabled branch from dd10a6c to ea17c3b Compare December 1, 2026 17:27

This branch has not been deployed

No deployments
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.

Missing CI coverage for feat_selinux/feat_smack without an actual SELinux/SMACK kernel

3 participants