Skip to content
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

feat(core) : reducing locks coverage to avoid potential deadlocks #1883

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Prateeknandle
Copy link
Collaborator

Purpose of PR?:

Fixes #

Does this PR introduce a breaking change?

If the changes in this PR are manually verified, list down the scenarios covered::

Additional information for reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs

Checklist:

  • Bug fix. Fixes #
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • PR Title follows the convention of <type>(<scope>): <subject>
  • Commit has unit tests
  • Commit has integration tests

Copy link
Member

@daemon1024 daemon1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial overview

KubeArmor/core/kubeUpdate.go Outdated Show resolved Hide resolved
KubeArmor/core/kubeUpdate.go Show resolved Hide resolved
daemon1024
daemon1024 previously approved these changes Oct 30, 2024
@daemon1024 daemon1024 changed the title Enhancement : reducing locks coverage feat(core) : reducing locks coverage to avoid potential deadlocks Oct 30, 2024
rootxrishabh
rootxrishabh previously approved these changes Nov 13, 2024
Copy link
Member

@rootxrishabh rootxrishabh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic sanity successful -

rootxrishabh@fedora:~/KubeArmor/KubeArmor/build$ karmor logs 
local port to be used for port forwarding kubearmor-relay-66999cb886-scthr: 32785 
Created a gRPC client (localhost:32785)
Checked the liveness of the gRPC server
Started to watch alerts
== Alert / 2024-11-13 14:50:33.957179 ==
ClusterName: default
HostName: gke-rishabh-cluster-default-pool-7ceba30f-fpcc
NamespaceName: default
PodName: nginx-bf5d5cf98-2s97v
Labels: app=nginx
ContainerName: nginx
ContainerID: d74ce140d48a586c5d6c55b5586356a635d6d3975e15ebe7a7aa86e0d238544d
ContainerImage: docker.io/library/nginx:latest@sha256:bc5eac5eafc581aeda3008b4b1f07ebba230de2f27d47767129a6a905c84f470
Type: MatchedPolicy
PolicyName: block-pkg-mgmt-tools-exec
Severity: 1
Source: /usr/bin/bash
Resource: /usr/bin/apt
Operation: Process
Action: Block
Data: lsm=SECURITY_BPRM_CHECK
Enforcer: BPFLSM
Result: Permission denied
Cwd: /
HostPID: 99824
HostPPID: 99799
Owner: map[Name:nginx Namespace:default Ref:Deployment]
PID: 43
PPID: 99799
ParentProcessName: /usr/bin/bash
ProcessName: /usr/bin/apt
UID: 0


rootxrishabh@fedora:~/KubeArmor/KubeArmor/build$ k exec -it nginx-bf5d5cf98-2s97v -n default  -- bash
root@nginx-bf5d5cf98-2s97v:/# apt
bash: /usr/bin/apt: Permission denied

Containers:
  kubearmor:
    Container ID:  containerd://7c30be7cf790666a4bb38648d71c0544712066dbf6d6164b382a0dafe336ab47
    Image:         rootxrishabh/kubearmor:deadlock
    Image ID:      docker.io/rootxrishabh/kubearmor@sha256:310790aa69a419da76e16a4a09d0d2e779a3ed0082df6fb4068058db5c25f5c9

Environment -

  • K8s -> GKE
  • Container Runtime -> containerd://1.7.22
  • Kernel Version -> 6.1.100+
  • Operating system -> Container-Optimized OS from Google

@rksharma95
Copy link
Collaborator

race conditions found, @Prateeknandle can you check again?
kubearmor_race.log

@DelusionalOptimist
Copy link
Member

@Prateeknandle this is a must for stable release. Can you please check @rksharma95's comments?
cc @daemon1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants