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

Do not add powercap mask if no paths are masked #20510

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

mheon
Copy link
Member

@mheon mheon commented Oct 27, 2023

This solves --security-opt unmask=ALL still masking the path.

[NO NEW TESTS NEEDED] Can't easily test this as we do not have access to it in CI.

Does this PR introduce a user-facing change?

NONE

@openshift-ci openshift-ci bot added release-note-none approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 27, 2023
@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

We'll also need this in 4.7.2 @lsm5

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

@giuseppe @Luap99 PTAL

@mheon mheon force-pushed the powercap_2 branch 2 times, most recently from aa0d0f9 to 0568cdc Compare October 27, 2023 13:04
@@ -31,6 +31,6 @@ Note: Labeling can be disabled for all <<|pods/>>containers by setting label=fal
for the possible mount options are specified in the **proc(5)** man page.

- **unmask**=_ALL_ or _/path/1:/path/2_, or shell expanded paths (/proc/*): Paths to unmask separated by a colon. If set to **ALL**, it unmasks all the paths that are masked or made read-only by default.
The default masked paths are **/proc/acpi, /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_debug, /proc/scsi, /proc/timer_list, /proc/timer_stats, /sys/firmware, and /sys/fs/selinux**. The default paths that are read-only are **/proc/asound**, **/proc/bus**, **/proc/fs**, **/proc/irq**, **/proc/sys**, **/proc/sysrq-trigger**, **/sys/fs/cgroup**.
The default masked paths are **/proc/acpi, /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_debug, /proc/scsi, /proc/timer_list, /proc/timer_stats, /sys/firmware, and /sys/fs/selinux**. The default paths that are read-only are **/proc/asound**, **/proc/bus**, **/proc/fs**, **/proc/irq**, **/proc/sys**, **/proc/sysrq-trigger**, **/sys/fs/cgroup**, **/sys/devices/virtual/powercap**.
Copy link
Member

Choose a reason for hiding this comment

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

this is not a readonly path, it should go after /sys/fs/selinux in the sentence before.

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

This solves `--security-opt unmask=ALL` still masking the path.

[NO NEW TESTS NEEDED] Can't easily test this as we do not have
access to it in CI.

Signed-off-by: Matthew Heon <[email protected]>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 27, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, Luap99, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Luap99,giuseppe,mheon]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

/cherry-pick v4.7

@openshift-cherrypick-robot
Copy link
Collaborator

@mheon: once the present PR merges, I will cherry-pick it on top of v4.7 in a new PR and assign it to you.

In response to this:

/cherry-pick v4.7

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.

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2023
@openshift-ci openshift-ci bot merged commit 6ec458d into containers:main Oct 27, 2023
99 checks passed
@openshift-cherrypick-robot
Copy link
Collaborator

@mheon: #20510 failed to apply on top of branch "v4.7":

Applying: Do not add powercap mask if no paths are masked
Using index info to reconstruct a base tree...
M	libpod/container_internal_linux.go
Falling back to patching base and 3-way merge...
Auto-merging libpod/container_internal_linux.go
CONFLICT (content): Merge conflict in libpod/container_internal_linux.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Do not add powercap mask if no paths are masked
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick v4.7

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.

@rhatdan
Copy link
Member

rhatdan commented Oct 27, 2023

Should this be masked in podman build?

In buildah, we have

func setupMaskedPaths(g *generate.Generator) {
	for _, mp := range []string{
		"/proc/acpi",
		"/proc/kcore",
		"/proc/keys",
		"/proc/latency_stats",
		"/proc/timer_list",
		"/proc/timer_stats",
		"/proc/sched_debug",
		"/proc/scsi",
		"/sys/firmware",
		"/sys/fs/selinux",
		"/sys/dev",
	} {
		g.AddLinuxMaskedPaths(mp)
	}
}

Seems like these should be centralized somewhere.

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

Yeah, it should also be masked in Buildah, Good point.

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

/cherry-pick v4.7

@openshift-cherrypick-robot
Copy link
Collaborator

@mheon: new pull request created: #20514

In response to this:

/cherry-pick v4.7

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.

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

containers/buildah#5110 for buildah

@rhatdan
Copy link
Member

rhatdan commented Oct 27, 2023

I am not seeing this masked by default?

$ podman run alpine ls /sys/devices/virtual/powercap/
intel-rapl
intel-rapl-mmio

@mheon
Copy link
Member Author

mheon commented Oct 27, 2023

Works over here.

Upstream Podman (4.7.1):

podman run -t -i --rm fedora ls -al /sys/devices/virtual/powercap
total 0
drwxr-xr-x.  3 nobody nobody 0 Oct 27 16:13 .
drwxr-xr-x. 25 nobody nobody 0 Oct 27 16:13 ..
drwxr-xr-x.  4 nobody nobody 0 Oct 27 16:13 intel-rapl

My branch, with both Powercap patches:

./bin/podman run -t -i --rm fedora ls -al /sys/devices/virtual/powercap
total 0
drwxrwxrwt.  2 root   root   40 Oct 27 16:13 .
drwxr-xr-x. 25 nobody nobody  0 Oct 27 16:13 ..

@TomSweeneyRedHat
Copy link
Member

Partially addresses https://issues.redhat.com/browse/RHEL-12098 and https://issues.redhat.com/browse/RHEL-12097. A vendor of Buildah with the fix is needed to complete the fix.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Feb 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants