From cedae8170d6aadb76eed3bc9b2b411a3e012463e Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 12 May 2022 15:50:10 -0500 Subject: [PATCH] EX-5260 pumount: use O_PATH for mount point In pumount, use O_PATH when opening the mount point to try to avoid RPCs from permission or atomic_open. Test-Parameters: trivial testlist=sanity-pumount clientextra_install_params="--packages pumount" Signed-off-by: John L. Hammond Change-Id: Ibd66579d9b5ecef724334c01d90367af4bd93179 Reviewed-on: https://review.whamcloud.com/47323 Tested-by: jenkins Tested-by: Maloo --- pumount/pumount.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pumount/pumount.c b/pumount/pumount.c index bba34af..747f6cb 100644 --- a/pumount/pumount.c +++ b/pumount/pumount.c @@ -944,7 +944,10 @@ int main(int argc, char *argv[]) PU_FATAL("cannot open '%s': %s\n", "/proc", strerror(errno)); if (do_open) { - mount_dirfd = open(mount_point, O_RDONLY|O_DIRECTORY); + /* We open the mount point to prevent a mount ID reuse + * race. Use O_PATH to avoid invoking permission or + * atomic_open. */ + mount_dirfd = open(mount_point, O_RDONLY|O_DIRECTORY|O_PATH); if (mount_dirfd < 0) PU_FATAL("cannot open '%s': %s\n", mount_point, strerror(errno)); -- 1.8.3.1