aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/machine_info_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/host/machine_info_linux.go')
-rw-r--r--pkg/host/machine_info_linux.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/host/machine_info_linux.go b/pkg/host/machine_info_linux.go
index fc3664c42..702b55cb3 100644
--- a/pkg/host/machine_info_linux.go
+++ b/pkg/host/machine_info_linux.go
@@ -127,15 +127,20 @@ func readKVMInfo(buffer *bytes.Buffer) error {
func getModulesInfo() ([]KernelModule, error) {
var modules []KernelModule
modulesText, _ := os.ReadFile("/proc/modules")
- re := regexp.MustCompile(`(\w+) .*(0[x|X][a-fA-F0-9]+)[^\n]*`)
+ re := regexp.MustCompile(`(\w+) ([0-9]+) .*(0[x|X][a-fA-F0-9]+)[^\n]*`)
for _, m := range re.FindAllSubmatch(modulesText, -1) {
- addr, err := strconv.ParseUint(string(m[2]), 0, 64)
+ addr, err := strconv.ParseUint(string(m[3]), 0, 64)
if err != nil {
return nil, fmt.Errorf("address parsing error in /proc/modules: %v", err)
}
+ size, err := strconv.ParseUint(string(m[2]), 0, 64)
+ if err != nil {
+ return nil, fmt.Errorf("module size parsing error in /proc/modules: %v", err)
+ }
modules = append(modules, KernelModule{
Name: string(m[1]),
Addr: addr,
+ Size: size,
})
}
return modules, nil