mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH v2] pass AT_NO_AUTOMOUNT when emulating fstatat via statx
@ 2023-10-07 18:02 Alexey Izbyshev
  2023-10-07 21:09 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Izbyshev @ 2023-10-07 18:02 UTC (permalink / raw)
  To: musl

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 affects only arches which use 32-bit seconds in struct kstat,
as well as out-of-tree/future ports to arches which lack SYS_fstatat.

[1] https://git.kernel.org/torvalds/c/b6c8069d3577481390b3f24a8434ad72a3235594
---
Fixed the wrong statement about affected arches in the commit message.
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-07 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07 18:02 [musl] [PATCH v2] pass AT_NO_AUTOMOUNT when emulating fstatat via statx Alexey Izbyshev
2023-10-07 21:09 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).