@@ -156,85 +156,32 @@ impl EderaPlugin {
156156 self . with_zone_syscall_evt_ctx ( & mut req, |zone_evt| Ok ( zone_evt. cpuid as u64 ) )
157157 }
158158
159- pub fn extract_latency ( & mut self , mut req : ExtractRequest < Self > ) -> Result < u64 > {
160- let ctx = self . get_or_cache_evt_ctx ( & mut req) ;
161-
162- let enter_ts = self
163- . threadstate
164- . with_zoneinfo ( & ctx. decoded_evt . zone_id , |zinfo| {
165- zinfo
166- . get_enter_event ( & ctx. decoded_evt )
167- . map ( |enter_evt| enter_evt. timestamp )
168- } ) ;
169- let Some ( enter_t) = enter_ts else {
170- return Ok ( 0 ) ;
171- } ;
172-
173- Ok ( ctx. decoded_evt . timestamp - enter_t)
159+ // Latency fields are deprecated in Falco 0.43+ because modern_bpf only captures
160+ // exit events. Like libsinsp, we hardcode to 0 to avoid breaking changes.
161+ // See: libs/userspace/libsinsp/sinsp_filtercheck_event.cpp lines 859-867
162+ pub fn extract_latency ( & mut self , _req : ExtractRequest < Self > ) -> Result < u64 > {
163+ Ok ( 0 )
174164 }
175165
176- pub fn extract_latency_s ( & mut self , mut req : ExtractRequest < Self > ) -> Result < u64 > {
177- let ctx = self . get_or_cache_evt_ctx ( & mut req) ;
178-
179- let enter_ts = self
180- . threadstate
181- . with_zoneinfo ( & ctx. decoded_evt . zone_id , |zinfo| {
182- zinfo
183- . get_enter_event ( & ctx. decoded_evt )
184- . map ( |enter_evt| enter_evt. timestamp )
185- } ) ;
186- let Some ( enter_t) = enter_ts else {
187- return Ok ( 0 ) ;
188- } ;
189-
190- Ok ( ctx. decoded_evt . timestamp - enter_t / 1_000_000_000 )
166+ // Latency fields are deprecated in Falco 0.43+ because modern_bpf only captures
167+ // exit events. Like libsinsp, we hardcode to 0 to avoid breaking changes.
168+ // See: libs/userspace/libsinsp/sinsp_filtercheck_event.cpp lines 859-867
169+ pub fn extract_latency_s ( & mut self , _req : ExtractRequest < Self > ) -> Result < u64 > {
170+ Ok ( 0 )
191171 }
192172
193- pub fn extract_latency_ns ( & mut self , mut req : ExtractRequest < Self > ) -> Result < u64 > {
194- let ctx = self . get_or_cache_evt_ctx ( & mut req) ;
195-
196- let enter_ts = self
197- . threadstate
198- . with_zoneinfo ( & ctx. decoded_evt . zone_id , |zinfo| {
199- zinfo
200- . get_enter_event ( & ctx. decoded_evt )
201- . map ( |enter_evt| enter_evt. timestamp )
202- } ) ;
203- let Some ( enter_t) = enter_ts else {
204- return Ok ( 0 ) ;
205- } ;
206-
207- Ok ( ctx. decoded_evt . timestamp - enter_t % 1_000_000_000 )
173+ // Latency fields are deprecated in Falco 0.43+ because modern_bpf only captures
174+ // exit events. Like libsinsp, we hardcode to 0 to avoid breaking changes.
175+ // See: libs/userspace/libsinsp/sinsp_filtercheck_event.cpp lines 859-867
176+ pub fn extract_latency_ns ( & mut self , _req : ExtractRequest < Self > ) -> Result < u64 > {
177+ Ok ( 0 )
208178 }
209179
210- pub fn extract_latency_human ( & mut self , mut req : ExtractRequest < Self > ) -> Result < CString > {
211- let ctx = self . get_or_cache_evt_ctx ( & mut req) ;
212-
213- let enter_ts = self
214- . threadstate
215- . with_zoneinfo ( & ctx. decoded_evt . zone_id , |zinfo| {
216- zinfo
217- . get_enter_event ( & ctx. decoded_evt )
218- . map ( |enter_evt| enter_evt. timestamp )
219- } ) ;
220-
221- let Some ( enter_t) = enter_ts else {
222- return Ok ( CString :: new ( "0s" ) ?) ;
223- } ;
224-
225- let latency_ns = ctx. decoded_evt . timestamp - enter_t;
226-
227- let formatted = if latency_ns < 1_000 {
228- format ! ( "{}ns" , latency_ns)
229- } else if latency_ns < 1_000_000 {
230- format ! ( "{:.1}us" , latency_ns as f64 / 1_000.0 )
231- } else if latency_ns < 1_000_000_000 {
232- format ! ( "{:.1}ms" , latency_ns as f64 / 1_000_000.0 )
233- } else {
234- format ! ( "{:.1}s" , latency_ns as f64 / 1_000_000_000.0 )
235- } ;
236-
237- Ok ( CString :: new ( formatted) ?)
180+ // Latency fields are deprecated in Falco 0.43+ because modern_bpf only captures
181+ // exit events. Like libsinsp, we hardcode to "0ns" to avoid breaking changes.
182+ // See: libs/userspace/libsinsp/sinsp_filtercheck_event.cpp lines 869-874
183+ pub fn extract_latency_human ( & mut self , _req : ExtractRequest < Self > ) -> Result < CString > {
184+ Ok ( CString :: new ( "0ns" ) ?)
238185 }
239186
240187 pub fn extract_args ( & mut self , mut req : ExtractRequest < Self > ) -> Result < CString > {
@@ -598,9 +545,10 @@ impl EderaPlugin {
598545
599546 let zid = & context. decoded_evt . zone_id ;
600547 if matches ! ( context. fdinfo, Cached :: NotFetched ) {
601- context. fdinfo = match self . threadstate . with_zoneinfo ( zid, |zinfo| {
602- zinfo. get_enterexit_event_fdinfo ( & context. decoded_evt )
603- } ) {
548+ context. fdinfo = match self
549+ . threadstate
550+ . with_zoneinfo ( zid, |zinfo| zinfo. get_event_fdinfo ( & context. decoded_evt ) )
551+ {
604552 Some ( t) => Cached :: Found ( t) ,
605553 None => Cached :: NotFound ,
606554 } ;
@@ -2836,33 +2784,19 @@ impl EderaPlugin {
28362784 }
28372785
28382786 fn get_fs_path_nameraw ( & mut self , event : & ZoneKernelSyscallEvent ) -> Result < CString > {
2839- // OPENAT_X is specialcased to get the path from the ENTER event in libsinsp.
2840- // For all others, it's pulled from the exit event.
2841- if event. event_type == event_codes:: PPME_SYSCALL_OPENAT_X as u32 {
2842- Ok ( self
2843- . threadstate
2844- . with_zoneinfo ( & event. zone_id , |zinfo| {
2845- zinfo. get_enter_event ( event) . and_then ( |enter_evt| {
2846- enter_evt
2847- . event_params
2848- . iter ( )
2849- . find ( |param| param. name == "name" )
2850- . and_then ( |param| CString :: new ( param. param_pretty . clone ( ) ) . ok ( ) )
2851- } )
2852- } )
2853- . unwrap_or ( CString :: new ( "NA" ) . expect ( "default value must parse" ) ) )
2854- } else {
2855- Ok ( Self :: get_paths_from_evt_params ( event)
2856- . into_iter ( )
2857- . find_map ( |path_type| {
2858- if let EventPathType :: Singular ( path) = path_type {
2859- CString :: new ( path) . ok ( )
2860- } else {
2861- None
2862- }
2863- } )
2864- . unwrap_or ( CString :: new ( "NA" ) . expect ( "default value must parse" ) ) )
2865- }
2787+ // With modern_bpf (exit-only events), all paths are in the exit event params.
2788+ // The old libsinsp code that retrieved openat paths from enter events is obsolete.
2789+ // See: libs/driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/openat.bpf.c
2790+ Ok ( Self :: get_paths_from_evt_params ( event)
2791+ . into_iter ( )
2792+ . find_map ( |path_type| {
2793+ if let EventPathType :: Singular ( path) = path_type {
2794+ CString :: new ( path) . ok ( )
2795+ } else {
2796+ None
2797+ }
2798+ } )
2799+ . unwrap_or ( CString :: new ( "NA" ) . expect ( "default value must parse" ) ) )
28662800 }
28672801
28682802 fn get_fs_path_sourceraw ( & mut self , event : & ZoneKernelSyscallEvent ) -> Result < CString > {
0 commit comments