[prev in list] [next in list] [prev in thread] [next in thread] 

List:       musl
Subject:    [musl] [PATCH] pass AT_NO_AUTOMOUNT when emulating fstatat via statx
From:       Alexey Izbyshev <izbyshev () ispras ! ru>
Date:       2023-10-07 17:30:53
Message-ID: 20231007173053.227170-1-izbyshev () ispras ! ru
[Download RAW message or body]

AT_NO_AUTOMOUNT is implied for stat/lstat/fstatat syscalls since Linux
3.1 [1]. However, this is not the case for statx syscall, which defaults
to automounting, so this flag must be passed explicitly when statx is
used to implement stat-like functions.

This change doesn't affect archs currently supported by musl in-tree
because all of them have SYS_fstatat defined. It does affect out-of-tree
riscv32 and loongarch ports, as well as any potential ports to arches
added to the kernel in the future.

[1] https://git.kernel.org/torvalds/c/b6c8069d3577481390b3f24a8434ad72a3235594
---
 src/stat/fstatat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c
index 04506375d897..9eed063b26bc 100644
--- a/src/stat/fstatat.c
+++ b/src/stat/fstatat.c
@@ -36,6 +36,7 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric
 {
 	struct statx stx;
 
+	flag |= AT_NO_AUTOMOUNT;
 	int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx);
 	if (ret) return ret;
 
-- 
2.39.2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic