Skip to content

Commit

Permalink
[CWS] do not request OffsetInode[CM]time constant outside of kernel…
Browse files Browse the repository at this point in the history
… range
  • Loading branch information
paulcacheux committed Dec 19, 2024
1 parent baa23e0 commit b28e28b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/security/ebpf/kernel/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ var (
Kernel6_5 = kernel.VersionCode(6, 5, 0)
// Kernel6_6 is the KernelVersion representation of kernel version 6.6
Kernel6_6 = kernel.VersionCode(6, 6, 0)
// Kernel6_7 is the KernelVersion representation of kernel version 6.7
Kernel6_7 = kernel.VersionCode(6, 7, 0)
// Kernel6_10 is the KernelVersion representation of kernel version 6.10
Kernel6_10 = kernel.VersionCode(6, 10, 0)
// Kernel6_11 is the KernelVersion representation of kernel version 6.11
Expand Down
6 changes: 4 additions & 2 deletions pkg/security/probe/probe_ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2526,8 +2526,10 @@ func AppendProbeRequestsToFetcher(constantFetcher constantfetch.ConstantFetcher,
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeIno, "struct inode", "i_ino", "linux/fs.h")
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeGid, "struct inode", "i_gid", "linux/fs.h")
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeNlink, "struct inode", "i_nlink", "linux/fs.h")
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeMtime, "struct inode", "__i_mtime", "linux/fs.h")
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeCtime, "struct inode", "__i_ctime", "linux/fs.h")
if kv.IsInRangeCloseOpen(kernel.Kernel6_7, kernel.Kernel6_11) {
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeMtime, "struct inode", "__i_mtime", "linux/fs.h")
constantFetcher.AppendOffsetofRequest(constantfetch.OffsetInodeCtime, "struct inode", "__i_ctime", "linux/fs.h")
}
}

// HandleActions handles the rule actions
Expand Down

0 comments on commit b28e28b

Please sign in to comment.