Skip to content

Commit 3f9c94f

Browse files
committed
fixup kmods logic
1 parent 0c04d86 commit 3f9c94f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyplugins/interventions/kmods.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def init_module(self, regs, proto, syscall, module_image, size, param_values):
199199
kmod_path = matching_ko[-1]
200200
elif any(arg for arg in args if arg.endswith('modprobe')):
201201
self.logger.info(f"modprobe detected, cannot determine module path from args: {args}")
202+
return
202203
else:
203204
# Check open fds for .ko file
204205
fds = yield from plugins.osi.get_fds()
@@ -209,7 +210,7 @@ def init_module(self, regs, proto, syscall, module_image, size, param_values):
209210
break
210211

211212
if not kmod_path:
212-
self.logger.info(f"Could not determine kernel module path from args: {args} or fds: {fds}")
213+
self.logger.info(f"Could not determine kernel module path from args: {args}")
213214

214215
# Track the module
215216
if kmod_path:
@@ -253,6 +254,9 @@ def finit_module(self, regs, proto, syscall, fd, param_values, flags):
253254
"""
254255
# Analyze information to determine the module path
255256
fdname = yield from plugins.osi.get_fd_name(fd)
257+
if not fdname:
258+
self.logger.error(f"Could not determine kernel module path from fd: {fd}")
259+
return
256260
self.track_kmod(fdname)
257261

258262
# Check if module is explicitly denied (denylist takes precedence)

0 commit comments

Comments
 (0)