About mounting and umounting inherited mounts inside a newly-created mount namespaceWhy can't I bind-mount...
Explaining intravenous drug abuse to a small child
Convert Numbers To Emoji Math
How did the Apollo guidance computer handle parity bit errors?
Why would a military not separate its forces into different branches?
Do Jedi mind tricks work on Ewoks?
What does the coin flipping before dying mean?
What happens if I accidentally leave an app running and click "Install Now" in Software Updater?
How to speed up large double sums in a table?
What is more safe for browsing the web: PC or smartphone?
Do quaternary sulfur dications exist?
Some questions about antistatic wrist strap
Lines too long in piece with two sections for different instruments
What do you call a painting painted on a wall?
Is it normal for gliders not to have attitude indicators?
Game artist computer workstation set-up – is this overkill?
Append unique characters read from filecontents to a string
Dimmer switch not connected to ground
How is Pauli's exclusion principle still valid in these cases?
What does the copyright in a dissertation protect exactly?
Efficient deletion of specific list entries
Is there precedent or are there procedures for a US president refusing to concede to an electoral defeat?
Picking a theme as a discovery writer
Python 3 - simple temperature program version 1.3
Does Thanos's ship land in the middle of the battlefield in "Avengers: Endgame"?
About mounting and umounting inherited mounts inside a newly-created mount namespace
Why can't I bind-mount “/” inside a user namespace?Inside a user namespace, why am I not allowed to remount a filesystem I have mounted?Unable to change permissions of file system root“PTY allocation request failed on channel 0 stdin: is not a tty” when SSH'ing into a Debian serverIs Traffic control inside namespace on ports created by OpenvSwitch supported?Recursively unmount Bind mount in both User and Mount namespaceCannot mount newly created Logical VolumeWhy does child with mount namespace affect parent mounts?Freenas iscsi to VMware - Mount newly created disk to UbuntuMounting a file system image inside an unshared namespaceWhy can't I bind-mount “/” inside a user namespace?Running su inside mount namespace
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Experiment 1
From outside the namespace, cat /proc/self/mountinfo
gives
291 34 0:37 / /tmp/IMJUSTTMP rw,relatime shared:152 - tmpfs tmpfs rw,size=102400k
34 23 0:32 / /tmp rw,nosuid,nodev shared:16 - tmpfs tmpfs rw
Then I run unshare -mU --map-root-user --propagation private /usr/bin/zsh
to get a new shell inside a namespace, but inside the newly-created mount namespace, I can't umount /tmp/IMJUSTTMP
, umount
just tell me it's not mounted. While I can check the newly-created mount namespace by cat /proc/self/mountinfo
, which gives private mount
290 263 0:32 / /tmp rw,nosuid,nodev - tmpfs tmpfs rw
302 290 0:37 / /tmp/IMJUSTTMP rw,relatime - tmpfs tmpfs rw,size=102400k
Then why do I get umount: /tmp/IMJUSTTMP: not mounted.
when I try to umount /tmp/IMJUSTTMP
inside the namespace?
I'm using 5.0.9-arch1-1-ARCH, with kernel.unprivileged_userns_clone = 1
.
Experiment 2
After unshare -mU --map-root-user --propagation private /usr/bin/zsh
, trying to create an overlayfs also fail.
mkdir -p /tmp/IMJUSTTMP/work
mkdir /tmp/IMJUSTTEST
mount -t tmpfs -o size=100m tmpfs /tmp/IMJUSTTMP
mount -t tmpfs -o size=200M tmpfs /tmp/IMJUSTTEST
Will all succeed as expected, While all the following would get permission denied
inside the namespace.
mount -t overlay -o "lowerdir=/home/xtricman,upperdir=/tmp/IMJUSTTMP/,workdir=/tmp/IMJUSTTMP/work" overlay /home/xtricman
mount -t overlay -o "lowerdir=/tmp/IMJUSTTEST,upperdir=/tmp/IMJUSTTMP,workdir=/tmp/IMJUSTTMP/work" overlay /mnt
Rough Guess of mine
I found these two questions, Inside a user namespace, why am I not allowed to remount a filesystem I have mounted? and Why can't I bind-mount "/" inside a user namespace? It seems that since I inherit the /tmp/IMJUSTTMP
and /tmp
mount, so I can't umount them even if I got full capabilities in the owning user namespace of the newly-created mount namespace.
Linux kenerl seems to prevent me cancel an overmount by creating a new user and mount namespace like I just did. It seems to regard over mount as a security method to hide some files and prevent me to access overmounted directories.
Creating an overlay mount might also cause the possibility to access overmount-hidden files, so for simplicity, kenerl just refuse to create overlayfs unless I have CAP_SYS_ADMIN in top level user namespace.
Question
Can anyone explain what exactly what's going on of the two experements? Is there any document mentioning detail kernel behavior of mounting and umounting inside a mount namespace? What is the "superblock owner" as mentioned in This Comment and Why can't I bind-mount "/" inside a user namespace? ?
mount linux-kernel namespace
add a comment |
Experiment 1
From outside the namespace, cat /proc/self/mountinfo
gives
291 34 0:37 / /tmp/IMJUSTTMP rw,relatime shared:152 - tmpfs tmpfs rw,size=102400k
34 23 0:32 / /tmp rw,nosuid,nodev shared:16 - tmpfs tmpfs rw
Then I run unshare -mU --map-root-user --propagation private /usr/bin/zsh
to get a new shell inside a namespace, but inside the newly-created mount namespace, I can't umount /tmp/IMJUSTTMP
, umount
just tell me it's not mounted. While I can check the newly-created mount namespace by cat /proc/self/mountinfo
, which gives private mount
290 263 0:32 / /tmp rw,nosuid,nodev - tmpfs tmpfs rw
302 290 0:37 / /tmp/IMJUSTTMP rw,relatime - tmpfs tmpfs rw,size=102400k
Then why do I get umount: /tmp/IMJUSTTMP: not mounted.
when I try to umount /tmp/IMJUSTTMP
inside the namespace?
I'm using 5.0.9-arch1-1-ARCH, with kernel.unprivileged_userns_clone = 1
.
Experiment 2
After unshare -mU --map-root-user --propagation private /usr/bin/zsh
, trying to create an overlayfs also fail.
mkdir -p /tmp/IMJUSTTMP/work
mkdir /tmp/IMJUSTTEST
mount -t tmpfs -o size=100m tmpfs /tmp/IMJUSTTMP
mount -t tmpfs -o size=200M tmpfs /tmp/IMJUSTTEST
Will all succeed as expected, While all the following would get permission denied
inside the namespace.
mount -t overlay -o "lowerdir=/home/xtricman,upperdir=/tmp/IMJUSTTMP/,workdir=/tmp/IMJUSTTMP/work" overlay /home/xtricman
mount -t overlay -o "lowerdir=/tmp/IMJUSTTEST,upperdir=/tmp/IMJUSTTMP,workdir=/tmp/IMJUSTTMP/work" overlay /mnt
Rough Guess of mine
I found these two questions, Inside a user namespace, why am I not allowed to remount a filesystem I have mounted? and Why can't I bind-mount "/" inside a user namespace? It seems that since I inherit the /tmp/IMJUSTTMP
and /tmp
mount, so I can't umount them even if I got full capabilities in the owning user namespace of the newly-created mount namespace.
Linux kenerl seems to prevent me cancel an overmount by creating a new user and mount namespace like I just did. It seems to regard over mount as a security method to hide some files and prevent me to access overmounted directories.
Creating an overlay mount might also cause the possibility to access overmount-hidden files, so for simplicity, kenerl just refuse to create overlayfs unless I have CAP_SYS_ADMIN in top level user namespace.
Question
Can anyone explain what exactly what's going on of the two experements? Is there any document mentioning detail kernel behavior of mounting and umounting inside a mount namespace? What is the "superblock owner" as mentioned in This Comment and Why can't I bind-mount "/" inside a user namespace? ?
mount linux-kernel namespace
Have you tried withumount -f
?
– Stephen Harris
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.umount /tmp/IMJUSTTMP
andumount /tmp/IMJUSTTMP -f
both giveumount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked/proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.
– 炸鱼薯条德里克
3 hours ago
add a comment |
Experiment 1
From outside the namespace, cat /proc/self/mountinfo
gives
291 34 0:37 / /tmp/IMJUSTTMP rw,relatime shared:152 - tmpfs tmpfs rw,size=102400k
34 23 0:32 / /tmp rw,nosuid,nodev shared:16 - tmpfs tmpfs rw
Then I run unshare -mU --map-root-user --propagation private /usr/bin/zsh
to get a new shell inside a namespace, but inside the newly-created mount namespace, I can't umount /tmp/IMJUSTTMP
, umount
just tell me it's not mounted. While I can check the newly-created mount namespace by cat /proc/self/mountinfo
, which gives private mount
290 263 0:32 / /tmp rw,nosuid,nodev - tmpfs tmpfs rw
302 290 0:37 / /tmp/IMJUSTTMP rw,relatime - tmpfs tmpfs rw,size=102400k
Then why do I get umount: /tmp/IMJUSTTMP: not mounted.
when I try to umount /tmp/IMJUSTTMP
inside the namespace?
I'm using 5.0.9-arch1-1-ARCH, with kernel.unprivileged_userns_clone = 1
.
Experiment 2
After unshare -mU --map-root-user --propagation private /usr/bin/zsh
, trying to create an overlayfs also fail.
mkdir -p /tmp/IMJUSTTMP/work
mkdir /tmp/IMJUSTTEST
mount -t tmpfs -o size=100m tmpfs /tmp/IMJUSTTMP
mount -t tmpfs -o size=200M tmpfs /tmp/IMJUSTTEST
Will all succeed as expected, While all the following would get permission denied
inside the namespace.
mount -t overlay -o "lowerdir=/home/xtricman,upperdir=/tmp/IMJUSTTMP/,workdir=/tmp/IMJUSTTMP/work" overlay /home/xtricman
mount -t overlay -o "lowerdir=/tmp/IMJUSTTEST,upperdir=/tmp/IMJUSTTMP,workdir=/tmp/IMJUSTTMP/work" overlay /mnt
Rough Guess of mine
I found these two questions, Inside a user namespace, why am I not allowed to remount a filesystem I have mounted? and Why can't I bind-mount "/" inside a user namespace? It seems that since I inherit the /tmp/IMJUSTTMP
and /tmp
mount, so I can't umount them even if I got full capabilities in the owning user namespace of the newly-created mount namespace.
Linux kenerl seems to prevent me cancel an overmount by creating a new user and mount namespace like I just did. It seems to regard over mount as a security method to hide some files and prevent me to access overmounted directories.
Creating an overlay mount might also cause the possibility to access overmount-hidden files, so for simplicity, kenerl just refuse to create overlayfs unless I have CAP_SYS_ADMIN in top level user namespace.
Question
Can anyone explain what exactly what's going on of the two experements? Is there any document mentioning detail kernel behavior of mounting and umounting inside a mount namespace? What is the "superblock owner" as mentioned in This Comment and Why can't I bind-mount "/" inside a user namespace? ?
mount linux-kernel namespace
Experiment 1
From outside the namespace, cat /proc/self/mountinfo
gives
291 34 0:37 / /tmp/IMJUSTTMP rw,relatime shared:152 - tmpfs tmpfs rw,size=102400k
34 23 0:32 / /tmp rw,nosuid,nodev shared:16 - tmpfs tmpfs rw
Then I run unshare -mU --map-root-user --propagation private /usr/bin/zsh
to get a new shell inside a namespace, but inside the newly-created mount namespace, I can't umount /tmp/IMJUSTTMP
, umount
just tell me it's not mounted. While I can check the newly-created mount namespace by cat /proc/self/mountinfo
, which gives private mount
290 263 0:32 / /tmp rw,nosuid,nodev - tmpfs tmpfs rw
302 290 0:37 / /tmp/IMJUSTTMP rw,relatime - tmpfs tmpfs rw,size=102400k
Then why do I get umount: /tmp/IMJUSTTMP: not mounted.
when I try to umount /tmp/IMJUSTTMP
inside the namespace?
I'm using 5.0.9-arch1-1-ARCH, with kernel.unprivileged_userns_clone = 1
.
Experiment 2
After unshare -mU --map-root-user --propagation private /usr/bin/zsh
, trying to create an overlayfs also fail.
mkdir -p /tmp/IMJUSTTMP/work
mkdir /tmp/IMJUSTTEST
mount -t tmpfs -o size=100m tmpfs /tmp/IMJUSTTMP
mount -t tmpfs -o size=200M tmpfs /tmp/IMJUSTTEST
Will all succeed as expected, While all the following would get permission denied
inside the namespace.
mount -t overlay -o "lowerdir=/home/xtricman,upperdir=/tmp/IMJUSTTMP/,workdir=/tmp/IMJUSTTMP/work" overlay /home/xtricman
mount -t overlay -o "lowerdir=/tmp/IMJUSTTEST,upperdir=/tmp/IMJUSTTMP,workdir=/tmp/IMJUSTTMP/work" overlay /mnt
Rough Guess of mine
I found these two questions, Inside a user namespace, why am I not allowed to remount a filesystem I have mounted? and Why can't I bind-mount "/" inside a user namespace? It seems that since I inherit the /tmp/IMJUSTTMP
and /tmp
mount, so I can't umount them even if I got full capabilities in the owning user namespace of the newly-created mount namespace.
Linux kenerl seems to prevent me cancel an overmount by creating a new user and mount namespace like I just did. It seems to regard over mount as a security method to hide some files and prevent me to access overmounted directories.
Creating an overlay mount might also cause the possibility to access overmount-hidden files, so for simplicity, kenerl just refuse to create overlayfs unless I have CAP_SYS_ADMIN in top level user namespace.
Question
Can anyone explain what exactly what's going on of the two experements? Is there any document mentioning detail kernel behavior of mounting and umounting inside a mount namespace? What is the "superblock owner" as mentioned in This Comment and Why can't I bind-mount "/" inside a user namespace? ?
mount linux-kernel namespace
mount linux-kernel namespace
edited 39 mins ago
炸鱼薯条德里克
asked 3 hours ago
炸鱼薯条德里克炸鱼薯条德里克
6141417
6141417
Have you tried withumount -f
?
– Stephen Harris
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.umount /tmp/IMJUSTTMP
andumount /tmp/IMJUSTTMP -f
both giveumount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked/proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.
– 炸鱼薯条德里克
3 hours ago
add a comment |
Have you tried withumount -f
?
– Stephen Harris
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.umount /tmp/IMJUSTTMP
andumount /tmp/IMJUSTTMP -f
both giveumount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked/proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.
– 炸鱼薯条德里克
3 hours ago
Have you tried with
umount -f
?– Stephen Harris
3 hours ago
Have you tried with
umount -f
?– Stephen Harris
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.
umount /tmp/IMJUSTTMP
and umount /tmp/IMJUSTTMP -f
both give umount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked /proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.– 炸鱼薯条德里克
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.
umount /tmp/IMJUSTTMP
and umount /tmp/IMJUSTTMP -f
both give umount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked /proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.– 炸鱼薯条德里克
3 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f517317%2fabout-mounting-and-umounting-inherited-mounts-inside-a-newly-created-mount-names%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f517317%2fabout-mounting-and-umounting-inherited-mounts-inside-a-newly-created-mount-names%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried with
umount -f
?– Stephen Harris
3 hours ago
@StephenHarris I repeat the experiment, get wierder result.
umount /tmp/IMJUSTTMP
andumount /tmp/IMJUSTTMP -f
both giveumount: /tmp/mountinfo: no mount point specified.
and don't umount that mount point. I double checked/proc/self/mountinfo
, that mountpoint really exist inside the newly-created mount namespace.– 炸鱼薯条德里克
3 hours ago