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

[release/1.6 backport] Revert apparmor_parser regression #8087

Merged

Conversation

neersighted
Copy link
Contributor

@neersighted neersighted commented Feb 10, 2023

This reverts commit 1acca8b.

As stated in the Godoc, this function is intended to check for presence of apparmor_parser. Changing this regressed the public API of containerd, and directly contradicts the way that this function is consumed inside of containerd itself:

This has lead to a number of painful regressions and attempted fixes in Moby:

While reverting this late into the life of 1.6 and at the start of the life of 1.7 is likely painful, I think this is ultimately the best path to take, as containerd is subject to the same failure to start containers with an AppArmor kernel when apparmor_parser is missing as Moby.

Cherry-pick: #8086

This reverts commit 1acca8b.

As stated in the Godoc, this function is intended to check for presence
of `apparmor_parser`. Changing this regressed the public API of
containerd, and directly contradicts the way that this function is
consumed inside of containerd itself:
* https://github.com/containerd/containerd/blob/fdfdc9bfc0f865a43c88171110615d1510fad3bc/pkg/apparmor/apparmor.go#L20
* https://github.com/containerd/containerd/blob/fdfdc9bfc0f865a43c88171110615d1510fad3bc/pkg/cri/sbserver/helpers_linux.go#L85
* https://github.com/containerd/containerd/blob/fdfdc9bfc0f865a43c88171110615d1510fad3bc/pkg/cri/server/helpers_linux.go#L144

This has lead to a number of painful regressions and attempted fixes in
Moby:
* moby/moby#44900
* moby/moby#44902
* moby/moby#44970

While reverting this late into the life of 1.6 and at the start of the
life of 1.7 is likely painful, I think this is ultimately the best path
to take, as containerd is subject to the same failure to start
containers with an AppArmor kernel when `apparmor_parser` is missing as
Moby.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit a326510)
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit d33a43c)
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
@k8s-ci-robot
Copy link

Hi @neersighted. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@neersighted neersighted changed the title [release/1.6 backport] Revert apparmor_parser regression [release/1.6 backport] Revert apparmor_parser regression Feb 10, 2023
@samuelkarp
Copy link
Member

/ok-to-test

@fuweid fuweid merged commit 29cfda4 into containerd:release/1.6 Feb 11, 2023
@neersighted neersighted deleted the apparmor_parser_regression_1.6 branch February 11, 2023 01:51
Mengkzhaoyun pushed a commit to open-beagle/containerd that referenced this pull request Feb 21, 2023
containerd 1.6.18

Welcome to the v1.6.18 release of containerd!

The eighteenth patch release for containerd 1.6 includes fixes for CVE-2023-25153 and CVE-2023-25173
along with a security update for Go.

* **Fix OCI image importer memory exhaustion** ([GHSA-259w-8hf6-59c2](GHSA-259w-8hf6-59c2))
* **Fix supplementary groups not being set up properly** ([GHSA-hmfx-3pcx-653p](GHSA-hmfx-3pcx-653p))
* **Revert removal of `/sbin/apparmor_parser` check** ([#8087](containerd/containerd#8087))
* **Update Go to 1.19.6** ([#8111](containerd/containerd#8111))

See the changelog for complete list of changes

Please try out the release binaries and report any issues at
https://github.com/containerd/containerd/issues.

* Akihiro Suda
* Derek McGowan
* Ye Sijun
* Samuel Karp
* Bjorn Neergaard
* Wei Fu
* Brian Goff
* Iceber Gu
* Kazuyoshi Kato
* Phil Estes
* Swagat Bora
<details><summary>24 commits</summary>
<p>

* [release/1.6] Prepare release notes for v1.6.18 ([#8118](containerd/containerd#8118))
  * [`44e61d764`](containerd/containerd@44e61d7) Add release notes for v1.6.18
* Github Security Advisory [GHSA-hmfx-3pcx-653p](GHSA-hmfx-3pcx-653p)
  * [`286a01f35`](containerd/containerd@286a01f) oci: fix additional GIDs
  * [`301823453`](containerd/containerd@3018234) oci: fix loop iterator aliasing
  * [`0070ab70f`](containerd/containerd@0070ab7) oci: skip checking gid for WithAppendAdditionalGroups
  * [`16d52de64`](containerd/containerd@16d52de) refactor: reduce duplicate code
  * [`b45e30292`](containerd/containerd@b45e302) add WithAdditionalGIDs test
  * [`0a06c284a`](containerd/containerd@0a06c28) add WithAppendAdditionalGroups helper
* Github Security Advisory [GHSA-259w-8hf6-59c2](GHSA-259w-8hf6-59c2)
  * [`84936fd1f`](containerd/containerd@84936fd) importer: stream oci-layout and manifest.json
* [1.6] Add fallback for windows platforms without osversion ([#8106](containerd/containerd#8106))
  * [`b327af6a4`](containerd/containerd@b327af6) Add fallback for windows platforms without osversion
* [release/1.6] Go 1.19.6 ([#8111](containerd/containerd#8111))
  * [`54ead5b7b`](containerd/containerd@54ead5b) Go 1.19.6
* [release/1.6] ctr/run: flags --detach and --rm cannot be specified together ([#8094](containerd/containerd#8094))
  * [`2b4b35ab4`](containerd/containerd@2b4b35a) ctr/run: flags --detach and --rm cannot be specified together
* [release/1.6] Fix retry logic within devmapper device deactivation ([#8088](containerd/containerd#8088))
  * [`d5284157b`](containerd/containerd@d528415) Fix retry logic within devmapper device deactivation
* [release/1.6 backport] Revert `apparmor_parser` regression  ([#8087](containerd/containerd#8087))
  * [`624ff636b`](containerd/containerd@624ff63) pkg/apparmor: clarify Godoc
  * [`3a0a35b36`](containerd/containerd@3a0a35b) Revert "Don't check for apparmor_parser to be present"
* [release/1.6] CI: skip some jobs when `repo != containerd/containerd` ([#8083](containerd/containerd#8083))
  * [`664a938a3`](containerd/containerd@664a938) CI: skip some jobs when `repo != containerd/containerd`
</p>
</details>

This release has no dependency changes

Previous release can be found at [v1.6.17](https://github.com/containerd/containerd/releases/tag/v1.6.17)
@elofu17
Copy link

elofu17 commented Feb 24, 2023

There are many issues and commits for this apparmor regression.
I'm picking this one with my question:

Is this regression really fully resolved?
'cause today I did a full-upgrade of a Debian bullseye machine, and immediately all my containers stopped working.

My 'apt full-upgrade' upgraded this:
Unpacking containerd.io (1.6.18-1) over (1.5.11-1) ...
Unpacking docker-ce-cli (5:23.0.1-1debian.11bullseye) over (5:20.10.143-0debian-bullseye) ...
Unpacking docker-ce (5:23.0.1-1debian.11bullseye) over (5:20.10.143-0debian-bullseye) ...

Log:
Feb 24 14:44:39 foobar-113 systemd[1]: Starting Docker Application Container Engine...
Feb 24 14:44:39 foobar-113 dockerd[3939003]: time="2023-02-24T14:44:39.354260681+01:00" level=info msg="Starting up"
Feb 24 14:44:39 foobar-113 dockerd[3939003]: time="2023-02-24T14:44:39.355179584+01:00" level=warning msg="AppArmor enabled on system but "apparmor_parser" binary is missing, so profile can't be loaded"
...
Feb 24 14:44:40 foobar-113 kernel: [2765359.942397] audit: type=1400 audit(1677246280.031:2): apparmor="DENIED" operation="change_onexec" info="label not found" error=-2 profile="unconfined" name="docker-default" pid=3939548 comm="runc:[2:INIT]"

My workaround was to 'apt install apparmor' + reboot.
...but I still don't think apparmor should be required. If so, it should not be a mere apt-recommends but a real dependency.

@neersighted
Copy link
Contributor Author

This pull request is not in a tagged version yet.

@elofu17
Copy link

elofu17 commented Feb 24, 2023

Ah! Thanks! Sorry!

PS:
Can I ask you: Is there an easy way for me to see when this has been fixed and deployed all the way to the official Debian repos? I.e. when it is "safe" to continue upgrading the other machines...

@neersighted
Copy link
Contributor Author

neersighted commented Feb 24, 2023

Does "official Debian repos" mean the Docker CE repos, or the ones provided by Debian themselves?

In either case, this is a change in containerd and not Moby (Docker) as shown in your logs. The fix is in a tagged version of containerd (so the version of this issue in containerd is fixed); but in Moby, we use containerd as a library.

You can click on the linked pull request in moby/moby: moby/moby#44982
From there, you can see that the PR was to master, which will not be released for some time. However, one of the linked ports is a [23.0 backport]: moby/moby#45043

You can look at the backport milestone and see 23.0.2. If you click on the milestone you will be able to see it is still open. You can also click on the merge commit (moby/moby@9f49691) and see below the commit message that it is merged into the 23.0 branch, but has no 23.0.x tag.

In short, we're preparing another release; if you use Docker CE, it should show up in Docker CE 23.0.2. If you are depending on the official Debian repos (which from your comment, you are not), you are at the mercy of Debian to release new versions or backport fixes (but again, that appears not to apply here).

@elofu17
Copy link

elofu17 commented Feb 24, 2023

Thanks!

Ah, yes, the Debian machine has an apt-source to download.docker.com.

nkinkade added a commit to m-lab/epoxy-images that referenced this pull request Apr 24, 2023
flannel was failing to start on sandbox nodes, causing the node to be
ina NotReady state because networking was not ready.  The pod
description had this event:

"Error: failed to create containerd container: get apparmor_parser
version: exec: "apparmor_parser": executable file not found in $PATH"

This appears to be related to some changes going on in containerd:

containerd/containerd#8087
nkinkade added a commit to m-lab/epoxy-images that referenced this pull request May 9, 2023
* Replaces old epoxy extension services with new server

The token-server and bmc-store-password ePoxy extensions are now
replaced by a new ePoxy "extension server." Instead of individual
extension container images, they are now all combined into a single
binary and container image that listens on a single port.

* Uses date string versions for images not in mlab-oti

See long comment in change set for details

* Deploys a single ePoxy extension server

Previously there were separate token-server and bmc-store-password
containers and systemd units. These have now been combined into a single
extension server that listens on a single port.

* Fixes nameing violation for virtual images

* Installs apparmor package

flannel was failing to start on sandbox nodes, causing the node to be
ina NotReady state because networking was not ready.  The pod
description had this event:

"Error: failed to create containerd container: get apparmor_parser
version: exec: "apparmor_parser": executable file not found in $PATH"

This appears to be related to some changes going on in containerd:

containerd/containerd#8087

* Fixes a syntax error in mount-data-api.sh

* Fixes ordering of control plane services

The create-control-plane.service is supposed to run _after_
mount-data-api, but that ordering was broken because the name of the
service changed and I failed to update the "After" block with the new
name.

* Don't fail the build when cluster vesion not available

If the query to the live cluster for its version fails, then don't
bother doing any version checking. The live cluster may not even exist,
and possibly needs the images from this build so that it can be created.

* Redundant check for working cluster before init

Adds an additional, redundant check for the existence of
/etc/kubernetes/admin.conf before initializing the cluster. A bug in our
config caused the service unit to run even though that file existed, and
kubeadm overwrote numerous things before finally erroring out. Can't
hurt to add the additional check in this file.

For nodes joining the cluster, wait for 90s (up from 60s) before trying
to join to give the primary control plane node time to finish setting
everything up. I discovered that 60s was not quite enough, and nodes
joining the control plane might get a connection refused from the
primary API endpoint.

* Don't mkdir /etc/kubernetes/manifests on API machines

On control plane machines, /etc/kubernetes is supposed to be a symlink
to /mnt/cluster-data/kubernetes. When /etc/kubernetes already exists as
a regular dir, then ln creates a symlink inside /etc/kubernetes,
breaking the configuration and breakage of the create-control-plane
service. Anyway, on control plane nodes that directory will be created
automatically by kubeadm.

* Makes setup_k8s.sh parse allocate_k8s_token v2 data

ePoxy extension allocate_k8s_token V2 returns all the data needed to
join the cluster. This commit removes all templating from setup_k8s.sh
and moves it into the physical image filesystem. It is now a static
script which can fetch everything it needs from allocate_k8s_token V2.

* Makes setup_k8s.sh executable

* Refactors the join-cluster.sh script

Previously, the script assumed that all VMs were going to be part of a
MIG. We have decided to have a hybrid approach with both MIGs and
standard VMs, which required a few changes.

Additionally, configure the script to the V2 allocate_k8s_token ePoxy
extension, which returns all the data needed to join the cluster, not
just the token. This also required some refactoring of the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants