libmount: Fix access check for utab in context
authorKarel Zak <kzak@redhat.com>
Mon, 22 Apr 2024 11:09:04 +0000 (13:09 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Sat, 27 Apr 2024 12:23:31 +0000 (14:23 +0200)
commit46579fe1ef21d58a3879e6d504368e981c4e2671
tree21944feb2d9c49bbce2b20ffa958114a3999fde7
parent2f7a24cb164ab517d4c27498cdb2892c259b172c
libmount: Fix access check for utab in context

The function mnt_has_regular_utab() properly detects that the utab is
not writable, but this is ignored by the high-level context API. As a
result, the library later attempts to update the file and ends up with
a warning in mount(8):

 $ mkdir sys
 $ unshare --map-root-user --mount
 $ mount --rbind /sys sys
 $ umount --lazy sys; echo $?
 umount: /home/user/sys: filesystem was unmounted, but failed to update userspace mount table.
 16

In this case, the utab should be ignored.

Fixes: https://github.com/util-linux/util-linux/issues/2981
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 97f7bfc0fdf74b6a6e220ba9d2f620386e660b29)

Gbp-Pq: Topic upstream
Gbp-Pq: Name libmount-Fix-access-check-for-utab-in-context.patch
libmount/src/context.c