-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling BPFLSM based KSP protection on Kubearmor itself #1831
base: main
Are you sure you want to change the base?
Changes from all commits
1a64ed3
5ae9b37
d72f58a
9758166
cdf6ac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -193,13 +193,13 @@ func (ch *ContainerdHandler) GetContainerInfo(ctx context.Context, containerID s | |||||
|
||||||
pid := strconv.Itoa(int(taskRes.Processes[0].Pid)) | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/pid"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/pid"); err == nil { | ||||||
if _, err := fmt.Sscanf(data, "pid:[%d]\n", &container.PidNS); err != nil { | ||||||
kg.Warnf("Unable to get PidNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
} | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/mnt"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/mnt"); err == nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if _, err := fmt.Sscanf(data, "mnt:[%d]\n", &container.MntNS); err != nil { | ||||||
kg.Warnf("Unable to get MntNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -130,15 +130,15 @@ func (ch *CrioHandler) GetContainerInfo(ctx context.Context, containerID string, | |||||
|
||||||
pid := strconv.Itoa(containerInfo.Pid) | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/pid"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/pid"); err == nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if _, err := fmt.Sscanf(data, "pid:[%d]\n", &container.PidNS); err != nil { | ||||||
kg.Warnf("Unable to get PidNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
} else { | ||||||
return container, err | ||||||
} | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/mnt"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/mnt"); err == nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if _, err := fmt.Sscanf(data, "mnt:[%d]\n", &container.MntNS); err != nil { | ||||||
kg.Warnf("Unable to get MntNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -144,13 +144,13 @@ func (dh *DockerHandler) GetContainerInfo(containerID string, OwnerInfo map[stri | |||||
|
||||||
pid := strconv.Itoa(inspect.State.Pid) | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/pid"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/pid"); err == nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if _, err := fmt.Sscanf(data, "pid:[%d]\n", &container.PidNS); err != nil { | ||||||
kg.Warnf("Unable to get PidNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
} | ||||||
|
||||||
if data, err := os.Readlink("/proc/" + pid + "/ns/mnt"); err == nil { | ||||||
if data, err := os.Readlink(cfg.GlobalCfg.ProcFsMount + "/" + pid + "/ns/mnt"); err == nil { | ||||||
if _, err := fmt.Sscanf(data, "mnt:[%d]\n", &container.MntNS); err != nil { | ||||||
kg.Warnf("Unable to get MntNS (%s, %s, %s)", containerID, pid, err.Error()) | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.