go: expose rulesets - #392
Open
nicholasberlin wants to merge 1 commit into
Open
Conversation
nicholasberlin
force-pushed
the
go-rulesets
branch
2 times, most recently
from
August 14, 2026 19:52
64d546f to
dba82f0
Compare
QueueAttr.RuleText installs a ruleset on the queue. It's parsed with quark_ruleset_parse() inside OpenQueue() -- before any privileged operation, so parse errors surface without root -- via an fmemopen shim borrowed from quark-test's ruleset_from_string1(). The C ruleset is owned by the Queue and released on Close(). Processes matched by poison rules carry the tag in the new Process.PoisonTag. TestRuleText covers parse success/failure without root; TestQuark gains RulePoison, a Go port of t_rule_poison.
nicholasberlin
force-pushed
the
go-rulesets
branch
from
August 14, 2026 20:17
dba82f0 to
41ffb06
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #386; this carries only the rule DSL exposure.
QueueAttr.RuleTextinstalls a ruleset on the queue. It's parsed withquark_ruleset_parse()insideOpenQueue()— before any privileged operation, so parse errors surface without root — via an fmemopen shim borrowed from quark-test'sruleset_from_string1(). The C ruleset is owned by theQueueand released onClose()(the queue only borrows the pointer). Processes matched by poison rules carry the tag in the newProcess.PoisonTag(set unconditionally, zero = no match, same semantics asquark_process.poison_tag). Until now the DSL — includingfile.exec_change— was unusable from Go.Tests:
TestRuleTextcovers parse success/failure without root;TestQuarkgainsRulePoison, a Go port oft_rule_poison(poison children by ppid, pass only poisoned, drop the rest — every surviving event must carry the tag). RulePoison uses/bin/truerather than/bin/echoso it also runs in the initramfs VM.Code identical to #386, where the full Go suite passed as root on real hardware and under krun; gofmt, go vet and a test-binary link re-checked here.
Note: the go/quark PRs split out of #372/#386 each append a CHANGES bullet, so whichever merges later needs a trivial rebase.