Skip to content

rootfs: handle github.com/moby/sys/mountinfo deficiency#2655

Closed
cyphar wants to merge 2 commits intoopencontainers:masterfrom
cyphar:fixup-proc-nopivot-masking
Closed

rootfs: handle github.com/moby/sys/mountinfo deficiency#2655
cyphar wants to merge 2 commits intoopencontainers:masterfrom
cyphar:fixup-proc-nopivot-masking

Conversation

@cyphar
Copy link
Copy Markdown
Member

@cyphar cyphar commented Oct 21, 2020

github.com/moby/sys/mountinfo doesn't fill the Root field of
mountinfo.Info when calling filter functions, meaning that the change in
commit b8bf572 ("rootfs: handle nested procfs mounts for MS_MOVE")
regressed the security hardening.

While this is being fixed upstream in 1, just remove this info.Root
optimisation because the ENOENT check is actually sufficient to fix the
original issue.

Closes #2654
Reported-by: Akihiro Suda akihiro.suda.cz@hco.ntt.co.jp
Signed-off-by: Aleksa Sarai cyphar@cyphar.com

github.com/moby/sys/mountinfo doesn't fill the Root field of
mountinfo.Info when calling filter functions, meaning that the change in
commit b8bf572 ("rootfs: handle nested procfs mounts for MS_MOVE")
regressed the security hardening.

While this is being fixed upstream in [1], just remove this info.Root
optimisation because the ENOENT check is actually sufficient to fix the
original issue.

[1]: moby/sys#50

Reported-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
For preventing regression like #2647

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
@AkihiroSuda AkihiroSuda added this to the 1.0.0-rc93 milestone Oct 21, 2020

runc run --no-pivot test_no_pivot
[ "$status" -eq 1 ]
[[ ${lines[*]} == *"mount: permission denied"* ]]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
[[ ${lines[*]} == *"mount: permission denied"* ]]
[[ "$output" == *"mount: permission denied"* ]]

Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

a nit in the test case, otherwise lgtm

@AkihiroSuda
Copy link
Copy Markdown
Member

closing as suggsted in #2657 (comment)

@kolyshkin kolyshkin removed this from the 1.0.0-rc93 milestone Feb 3, 2021
@cyphar cyphar deleted the fixup-proc-nopivot-masking branch May 20, 2021 04:36
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.

3 participants