Skip to content

Commit

Permalink
Merge pull request #3097 from lpirl/proc-1-uid_map-permission-denied
Browse files Browse the repository at this point in the history
suppress false-negative error in templates and nvidia hook
  • Loading branch information
stgraber committed Aug 27, 2019
2 parents 61287e5 + 16a312e commit 44c7d9c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
8 changes: 6 additions & 2 deletions hooks/nvidia
Expand Up @@ -58,8 +58,12 @@ in_userns() {
echo $fields | grep -q " 0 1$" && { echo userns-root; return; } || true
done < /proc/self/uid_map

[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && \
{ echo userns-root; return; }
if [ -e /proc/1/uid_map ]; then
if [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ]; then
echo userns-root
return
fi
fi
echo yes
}

Expand Down
7 changes: 6 additions & 1 deletion templates/lxc-busybox.in
Expand Up @@ -42,7 +42,12 @@ in_userns() {
fi
done < /proc/self/uid_map

[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && { echo userns-root; return; }
if [ -e /proc/1/uid_map ]; then
if [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ]; then
echo userns-root
return
fi
fi
echo yes
}

Expand Down
7 changes: 6 additions & 1 deletion templates/lxc-download.in
Expand Up @@ -179,7 +179,12 @@ in_userns() {
fi
done < /proc/self/uid_map

[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && { echo userns-root; return; }
if [ -e /proc/1/uid_map ]; then
if [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ]; then
echo userns-root
return
fi
fi
echo yes
}

Expand Down
9 changes: 7 additions & 2 deletions templates/lxc-local.in
Expand Up @@ -51,8 +51,13 @@ in_userns() {
fi
done < /proc/self/uid_map

[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && { echo userns-root; return; }
echo yes
if [ -e /proc/1/uid_map ]; then
if [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ]; then
echo userns-root
return
fi
fi
echo yes
}

usage() {
Expand Down
7 changes: 6 additions & 1 deletion templates/lxc-oci.in
Expand Up @@ -62,7 +62,12 @@ in_userns() {
fi
done < /proc/self/uid_map

[ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && { echo userns-root; return; }
if [ -e /proc/1/uid_map ]; then
if [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ]; then
echo userns-root
return
fi
fi
echo yes
}

Expand Down

0 comments on commit 44c7d9c

Please sign in to comment.