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

AppArmor Profile Loading on GKE COS failed with "open /proc/1/sched: no such file or directory" #2462

Closed
jindijamie opened this issue Sep 24, 2024 · 2 comments · Fixed by #2541
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@jindijamie
Copy link

What happened:

I was installing SPO and trying the AppArmor support on a GKE cluster with COS(Container-Optimized OS) nodes.
I applied the profile with
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/security-profiles-operator/refs/heads/main/examples/apparmorprofile.yaml

It failed with
E0924 21:11:54.292028 17496 apparmorprofile.go:116] "node \"gke-apparmor3-default-pool-1d3cb74c-fr7d\" does not support apparmor" err="profile not added" logger="apparmor-spod" apparmorprofile="test-profile" namespace="default"
And there is an error message at first
E0924 21:11:53.983973 17496 apparmorprofile.go:292] "mounting host" err="identifying pid namespace: open /proc/1/sched: no such file or directory" logger="apparmor-spod"
And I checked on the node, the file doesn't exist.

What you expected to happen:

The profile should be installed

How to reproduce it (as minimally and precisely as possible):

On a GKE COS cluster, install SPO.
kubectl -n security-profiles-operator patch spod spod --type=merge -p '{"spec":{"enableAppArmor":true}}'
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/security-profiles-operator/refs/heads/main/examples/apparmorprofile.yaml
Check the logs of the daemonset.

Anything else we need to know?:

I think it is similar to freeipa/freeipa#6453 and related to systemd/systemd#8153

Environment:

  • Cloud provider or hardware configuration: GCP,
  • OS (e.g: cat /etc/os-release): "Container-Optimized OS" VERSION_ID=109 BUILD_ID=17800.309.13
  • Kernel (e.g. uname -a): Linux gke-apparmor2-default-pool-1a912e31-hlt3 6.1.100+ Implement minimal valuable implementation  #1 SMP PREEMPT_DYNAMIC Sat Aug 10 14:21:56 UTC 2024 x86_64 Intel(R) Xeon(R) CPU @ 2.20GHz GenuineIntel GNU/Linux
  • Others:
@jindijamie jindijamie added the kind/bug Categorizes issue or PR as related to a bug. label Sep 24, 2024
@jindijamie jindijamie changed the title AppArmor Profile Loading on GKE COS failed with AppArmor Profile Loading on GKE COS failed with "open /proc/1/sched: no such file or directory" Sep 24, 2024
@mhils
Copy link
Contributor

mhils commented Sep 25, 2024

E0924 21:11:53.983973   17496 apparmorprofile.go:292] "mounting host" err="identifying pid namespace: open /proc/1/sched: no such file or directory" logger="apparmor-spod"

This one is from here. Building the host kernel with CONFIG_SCHED_DEBUG=y is a workaround (but not a fix).

@ccojocar
Copy link
Contributor

The spo currently unshare the fs namespace of the pid 1 from the container in order to reach the filesystem of the host, because it needs to convert the text based apparmor profile into the binary format and to load it into the kernel.

I think there are two possibilities here, either pid 1 is not accessible or is not available. For instance, in init containers this strategy doesn't work because they are not spawned as long running process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants