Conversation
We garbage collect things after 4 seconds, this is to allow lookups from the user to still work. Previously we were garbage collecting after the cycle, meaning we could theoretically end up doing a lookup for a quark_process mid-quark_queue_get_event(), then stash it into qev->process, and then free the memory in gc_collect(). This would be very unlikely since we would need an event that references the soon-to-be-collected process to arrive 4 seconds later. Give me back my sleep, make it impossible by collecting everything before we have a chance of referencing it.
I don't love this, the problem is that const and quark_ makes our function prototypes too long, try to improve things a little.
845ed44 to
b101612
Compare
Collaborator
Author
|
I've added simple * matching in pathnames, once I profile this and realize it's good enough, I'll switch to fnmatch(3) and see if it's still good enough, than we can have "full" glob matching. |
This implements the barebones of a rule system for filtering events. A ruleset is a collection of rules. A rule has zero or more rule_fields. Each rule_field expresses one attribute that must match, for example process.pid is one field, and file.path is another. A rule matches when _all_ its fields match. A rule with no fields always matches (can be a catch-all as the last rule). A ruleset matches the first rule it matches, meaning this is a match-first scheme. Currently we have only two actions RA_PASS and RA_DROP, if nothinig matches, it's PASS. For now, only 4 rule_fields, process.pid, process.ppid, process.filename and file.path. The next step is to design a proper DSL ala pf.conf(5), that then compiles an ascii line-based ruleset into a quark_ruleset. Co-authored-by: Nicholas Berlin <56366649+nicholasberlin@users.noreply.github.com>
nicholasberlin
approved these changes
Nov 21, 2025
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.
Note that two minor changes were piggy backed in different commits (gc_collect + re-align)