From 0b5bff5930cecf6cd3ac5f5fc280f677bc734550 Mon Sep 17 00:00:00 2001 From: Nick Gregory Date: Thu, 8 Feb 2024 16:05:03 -0500 Subject: [PATCH 1/2] hmm --- Source/santad/ProcessTree/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/santad/ProcessTree/BUILD b/Source/santad/ProcessTree/BUILD index 29801aeab..50e8e7e31 100644 --- a/Source/santad/ProcessTree/BUILD +++ b/Source/santad/ProcessTree/BUILD @@ -53,6 +53,7 @@ objc_library( srcs = ["process_tree_test_helpers.mm"], hdrs = ["process_tree_test_helpers.h"], deps = [ + ":process", ":process_tree", "@com_google_absl//absl/synchronization", ], From cd825f72e30db1a89f982fa9818ef4ef9119eae4 Mon Sep 17 00:00:00 2001 From: Nick Gregory Date: Thu, 8 Feb 2024 16:26:09 -0500 Subject: [PATCH 2/2] more lint and add another dep --- Source/santad/ProcessTree/BUILD | 9 +++++---- Source/santad/ProcessTree/process_tree.h | 12 +++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Source/santad/ProcessTree/BUILD b/Source/santad/ProcessTree/BUILD index 50e8e7e31..a002f93a6 100644 --- a/Source/santad/ProcessTree/BUILD +++ b/Source/santad/ProcessTree/BUILD @@ -1,16 +1,16 @@ -load("//:helper.bzl", "santa_unit_test") load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("//:helper.bzl", "santa_unit_test") cc_library( name = "process", hdrs = ["process.h"], + visibility = ["//:santa_package_group"], deps = [ "//Source/santad/ProcessTree/annotations:annotator", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/synchronization", ], - visibility = ["//:santa_package_group"], ) objc_library( @@ -23,6 +23,7 @@ objc_library( sdk_dylibs = [ "bsm", ], + visibility = ["//:santa_package_group"], deps = [ ":process", "//Source/santad/ProcessTree:process_tree_cc_proto", @@ -33,7 +34,6 @@ objc_library( "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/synchronization", ], - visibility = ["//:santa_package_group"], ) proto_library( @@ -44,8 +44,8 @@ proto_library( cc_proto_library( name = "process_tree_cc_proto", - deps = [":process_tree_proto"], visibility = ["//:santa_package_group"], + deps = [":process_tree_proto"], ) objc_library( @@ -66,5 +66,6 @@ santa_unit_test( ":process", ":process_tree_test_helpers", "//Source/santad/ProcessTree/annotations:annotator", + "@com_google_absl//absl/synchronization", ], ) diff --git a/Source/santad/ProcessTree/process_tree.h b/Source/santad/ProcessTree/process_tree.h index 6bf4cf62d..6c132883d 100644 --- a/Source/santad/ProcessTree/process_tree.h +++ b/Source/santad/ProcessTree/process_tree.h @@ -56,9 +56,8 @@ class ProcessTree { // N.B. new_pid is required as the "pid version" will have changed. // It is a programming error to pass a new_pid such that // p.pid_.pid != new_pid.pid. - void HandleExec(uint64_t timestamp, const Process &p, - struct Pid new_pid, struct Program prog, - struct Cred c); + void HandleExec(uint64_t timestamp, const Process &p, struct Pid new_pid, + struct Program prog, struct Cred c); // Inform the tree of a process exit. void HandleExit(uint64_t timestamp, const Process &p); @@ -98,8 +97,7 @@ class ProcessTree { void Iterate(std::function)> f) const; // Get the Process for the given pid in the tree if it exists. - std::optional> Get( - struct Pid target) const; + std::optional> Get(struct Pid target) const; // Traverse the tree from the given Process to its parent. std::shared_ptr GetParent(const Process &p) const; @@ -120,8 +118,8 @@ class ProcessTree { // updated with the results of the event. bool Step(uint64_t timestamp); - std::optional> GetLocked( - struct Pid target) const ABSL_SHARED_LOCKS_REQUIRED(mtx_); + std::optional> GetLocked(struct Pid target) const + ABSL_SHARED_LOCKS_REQUIRED(mtx_); void DebugDumpLocked(std::ostream &stream, int depth, pid_t ppid) const;