Page MenuHomeFreeBSD

sysctl: Add a regression test which runs sysctl -a
ClosedPublic

Authored by markj on Fri, Jan 24, 4:52 PM.
Tags
None
Referenced Files
F110229188: D48659.diff
Sat, Feb 15, 10:40 AM
Unknown Object (File)
Thu, Feb 13, 7:33 PM
Unknown Object (File)
Mon, Feb 10, 4:24 PM
Unknown Object (File)
Sun, Feb 9, 5:05 PM
Unknown Object (File)
Sat, Feb 8, 8:56 PM
Unknown Object (File)
Sat, Feb 8, 3:20 PM
Unknown Object (File)
Fri, Feb 7, 10:23 AM
Unknown Object (File)
Fri, Feb 7, 6:31 AM
Subscribers

Details

Summary

Run sysctl -a during the test suite so that KASAN/KMSAN have a chance to
catch something.

Inspired by https://jprx.io/cve-2024-54507/

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62000
Build 58884: arc lint + arc unit

Event Timeline

markj requested review of this revision.Fri, Jan 24, 4:52 PM

Go a bit further: add a test which does the same thing in a jail.

emaste added inline comments.
sbin/sysctl/tests/sysctl_test.sh
36

I'm not sure if "Verify" is correct here as we don't actually care about the results. Something like "Exercise kernel code via -a" or so? And a comment referencing KASAN/KMSAN.

This revision is now accepted and ready to land.Fri, Jan 24, 4:56 PM

Improve test descriptions.

This revision now requires review to proceed.Fri, Jan 24, 4:59 PM
This revision is now accepted and ready to land.Fri, Jan 24, 5:00 PM

I wonder if you want to run with -x -a as well or instead?

Add -x to the sysctl flags

This revision now requires review to proceed.Mon, Jan 27, 2:53 PM
This revision is now accepted and ready to land.Mon, Jan 27, 3:12 PM
  • Use -o instead of -x: with the latter sysctl(8) will print a huge amount of output and is a couple orders of magnitude slower. We get the same kernel coverage with -o, so just use that.
  • Avoid using atf_check: it causes kyua to buffer all of the output in memory and then store it in the test results DB, which is somewhat unwieldy. Check the exit status manually.
This revision now requires review to proceed.Mon, Jan 27, 5:51 PM

does sysctl -o still pass all the data to userspace but then only print the first bit?

This revision is now accepted and ready to land.Mon, Jan 27, 6:13 PM

does sysctl -o still pass all the data to userspace but then only print the first bit?

Yeah, the only difference is in how sysctl(8) formats and outputs the data.