Skip to contentSkip to conversation

kernel/cfg: add CONFIG_CGROUP_BPF to docker config

PATCH In review Xiangyu Chen 2 participants 5 messages Mar 6, 2024 – Mar 8, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/cfg: add CONFIG_CGROUP_BPF to docker config

From: Xiangyu Chen <[email protected]>

Add CONFIG_CGROUP_BPF to ensure docker can be started under cgroup v2, otherwise it would report the following error:

Error: for ... error setting cgroup config for procHooks process:
bpf_prog_query(BPF_CGROUP_DEVICE) failed: invalid argument: unknown

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag.

---
 recipes-kernel/linux/linux-yocto/docker.cfg | 2 ++
 1 file changed, 2 insertions(+)
recipes-kernel/linux/linux-yocto/docker.cfg +2 -0
index eeeaa242..4d8d7e04 100644
@@ -11,3 +11,5 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
 CONFIG_NETFILTER_XT_MATCH_IPVS=m
 
 CONFIG_OVERLAY_FS=y
+
+CONFIG_CGROUP_BPF=y
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

Add CONFIG_CGROUP_BPF to ensure docker can be started under cgroup v2, otherwise it would report the following error:

Quoted 7 lines

Error: for ... error setting cgroup config for procHooks process:
bpf_prog_query(BPF_CGROUP_DEVICE) failed: invalid argument: unknown

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag.

related to this, check out my latest push to master-next. I've not taken tweaks to the fragments in meta-virt lately, as I really want to get rid of the duplicate
fragments between the main kernel-cache and the layer.

So I finally took the time to do the sync and removal in meta-virt.

See what you get when building against meta-virt with that change, and then we can do this same change in the kernel-cache and bump the yocto-cfg-fragments SRCREV in meta-virt.

Bruce

Quoted 28 lines
---
 recipes-kernel/linux/linux-yocto/docker.cfg | 2 ++
 1 file changed, 2 insertions(+)
recipes-kernel/linux/linux-yocto/docker.cfg +2 -1
index eeeaa242..4d8d7e04 100644
@@ -11,3 +11,5 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
 CONFIG_NETFILTER_XT_MATCH_IPVS=m
 
 CONFIG_OVERLAY_FS=y
+
+CONFIG_CGROUP_BPF=y
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8603): https://lists.yoctoproject.org/g/meta-virtualization/message/8603
Mute This Topic: https://lists.yoctoproject.org/mt/104758931/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#2 lore raw
Quoted 22 lines · Bruce Ashfield

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 5 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

Add CONFIG_CGROUP_BPF to ensure docker can be started under cgroup v2, otherwise it would report the following error:

Quoted 7 lines

Error: for ... error setting cgroup config for procHooks process:
bpf_prog_query(BPF_CGROUP_DEVICE) failed: invalid argument: unknown

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag.

related to this, check out my latest push to master-next. I've not taken tweaks to the fragments in meta-virt lately, as I really want to get rid of the duplicate
fragments between the main kernel-cache and the layer.

Quoted 5 lines

So I finally took the time to do the sync and removal in meta-virt.

See what you get when building against meta-virt with that change, and then we can do this same change in the kernel-cache and bump the yocto-cfg-fragments SRCREV in meta-virt.

Hi Bruce,

I have synced the meta-virt on master-next branch, tested with the docker package.

No error happens during building and running(with cgroup1).

For cgroup2, docker needs CONFIG_CGROUP_BPF option, it has already exists in features/bpf/bpf.cfg, but we might not

need to turn on all BPF features, so can we move CONFIG_CGROUP_BPF to feature features/cgroup/cgroup.cfg or duplicate it

in to cfg/docker.cfg?

Thanks

Br,

Xiangyu

Quoted 38 lines

Bruce

Quoted 16 lines
---
  recipes-kernel/linux/linux-yocto/docker.cfg | 2 ++
  1 file changed, 2 insertions(+)
recipes-kernel/linux/linux-yocto/docker.cfg +2 -1
index eeeaa242..4d8d7e04 100644
@@ -11,3 +11,5 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
  CONFIG_NETFILTER_XT_MATCH_IPVS=m
 
  CONFIG_OVERLAY_FS=y
+
+CONFIG_CGROUP_BPF=y
--
Quoted 5 lines

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8607): https://lists.yoctoproject.org/g/meta-virtualization/message/8607
Mute This Topic: https://lists.yoctoproject.org/mt/104758931/7175143
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 39 lines · Xiangyu Chen
Quoted 22 lines · Bruce Ashfield

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 5 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

Add CONFIG_CGROUP_BPF to ensure docker can be started under cgroup v2, otherwise it would report the following error:

Quoted 7 lines

Error: for ... error setting cgroup config for procHooks process:
bpf_prog_query(BPF_CGROUP_DEVICE) failed: invalid argument: unknown

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag.

related to this, check out my latest push to master-next. I've not taken tweaks to the fragments in meta-virt lately, as I really want to get rid of the duplicate
fragments between the main kernel-cache and the layer.

Quoted 5 lines

So I finally took the time to do the sync and removal in meta-virt.

See what you get when building against meta-virt with that change, and then we can do this same change in the kernel-cache and bump the yocto-cfg-fragments SRCREV in meta-virt.

Hi Bruce,

I have synced the meta-virt on master-next branch, tested with the docker package.

No error happens during building and running(with cgroup1).

Quoted 7 lines

For cgroup2, docker needs CONFIG_CGROUP_BPF option, it has already exists in features/bpf/bpf.cfg, but we might not

need to turn on all BPF features, so can we move CONFIG_CGROUP_BPF to feature features/cgroup/cgroup.cfg or duplicate it

in to cfg/docker.cfg?

This is exactly the feedback I was looking for! Thanks for running the tests.

I agree that we don't want all those BPF options on every time that docker support is required.

I'd suggest that duplicating it in the docker.cfg is the right thing to do.

If you want to send a patch for that to the kernel-cache, I'll merge it and bump the SRCREVs.

If nothing breaks in the next three weeks of testing of that change, I intend to go to the single source of fragments for the LTS release. If something does break, I'll make sure to get the options into the fragments in the layer.

Bruce

Quoted 50 lines

Thanks

Br,

Xiangyu

Quoted 15 lines

Bruce

Quoted 12 lines
---
  recipes-kernel/linux/linux-yocto/docker.cfg | 2 ++
  1 file changed, 2 insertions(+)
recipes-kernel/linux/linux-yocto/docker.cfg +0 -0
index eeeaa242..4d8d7e04 100644
@@ -11,3 +11,5 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
  CONFIG_NETFILTER_XT_MATCH_IPVS=m
 
Quoted 17 lines
Quoted 9 lines
recipes-kernel/linux/linux-yocto/docker.cfg +2 -1
  CONFIG_OVERLAY_FS=y
+
+CONFIG_CGROUP_BPF=y
--

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8608): https://lists.yoctoproject.org/g/meta-virtualization/message/8608
Mute This Topic: https://lists.yoctoproject.org/mt/104758931/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#4 lore raw
Quoted 48 lines · Bruce Ashfield

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 43 lines · Xiangyu Chen
Quoted 22 lines · Bruce Ashfield

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 5 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

Add CONFIG_CGROUP_BPF to ensure docker can be started under cgroup v2, otherwise it would report the following error:

Quoted 7 lines

Error: for ... error setting cgroup config for procHooks process:
bpf_prog_query(BPF_CGROUP_DEVICE) failed: invalid argument: unknown

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag.

related to this, check out my latest push to master-next. I've not taken tweaks to the fragments in meta-virt lately, as I really want to get rid of the duplicate
fragments between the main kernel-cache and the layer.

Quoted 5 lines

So I finally took the time to do the sync and removal in meta-virt.

See what you get when building against meta-virt with that change, and then we can do this same change in the kernel-cache and bump the yocto-cfg-fragments SRCREV in meta-virt.

Hi Bruce,

I have synced the meta-virt on master-next branch, tested with the docker package.

No error happens during building and running(with cgroup1).

For cgroup2, docker needs CONFIG_CGROUP_BPF option, it has already exists in features/bpf/bpf.cfg, but we might not

need to turn on all BPF features, so can we move CONFIG_CGROUP_BPF to feature features/cgroup/cgroup.cfg or duplicate it

Quoted 7 lines
Quoted 1 line

in to cfg/docker.cfg?

This is exactly the feedback I was looking for! Thanks for running the tests.

I agree that we don't want all those BPF options on every time that docker support is required.

I'd suggest that duplicating it in the docker.cfg is the right thing to do.

Hi Bruce,

Thanks for your suggestion, a patch has been sent to linux-yocto.

Br,

Xiangyu

Quoted 61 lines

If you want to send a patch for that to the kernel-cache, I'll merge it and bump the SRCREVs.

If nothing breaks in the next three weeks of testing of that change, I intend to go to the single source of fragments for the LTS release. If something does break, I'll make sure to get the options into the fragments in the layer.

Bruce

Quoted 38 lines

Thanks

Br,

Xiangyu

Quoted 14 lines

Bruce

Quoted 12 lines
---
   recipes-kernel/linux/linux-yocto/docker.cfg | 2 ++
   1 file changed, 2 insertions(+)
recipes-kernel/linux/linux-yocto/docker.cfg +0 -0
index eeeaa242..4d8d7e04 100644
@@ -11,3 +11,5 @@ CONFIG_IP_NF_TARGET_MASQUERADE=m
   CONFIG_NETFILTER_XT_MATCH_IPVS=m
 
Quoted 16 lines
Quoted 9 lines
recipes-kernel/linux/linux-yocto/docker.cfg +2 -1
   CONFIG_OVERLAY_FS=y
+
+CONFIG_CGROUP_BPF=y
--

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8608): https://lists.yoctoproject.org/g/meta-virtualization/message/8608
Mute This Topic: https://lists.yoctoproject.org/mt/104758931/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II