From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19301 invoked from network); 7 Oct 2023 21:09:37 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 7 Oct 2023 21:09:37 -0000 Received: (qmail 22202 invoked by uid 550); 7 Oct 2023 21:09:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 22161 invoked from network); 7 Oct 2023 21:09:32 -0000 Date: Sat, 7 Oct 2023 17:09:27 -0400 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20231007210927.GJ4163@brightrain.aerifal.cx> References: <20231007180218.231638-1-izbyshev@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231007180218.231638-1-izbyshev@ispras.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH v2] pass AT_NO_AUTOMOUNT when emulating fstatat via statx On Sat, Oct 07, 2023 at 09:02:18PM +0300, Alexey Izbyshev wrote: > 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. Indeed, statx is always used on 32-bit archs. 32-bit archs with no legacy 32-bit kernel timespec struct (i.e. rv32) don't have the legacy stat syscalls either. > --- > 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 I think this is ok. I recall noticing something about this when initially adding it but not being sure what behavior the legacy stat syscall would give or whether it's "right". But short of a very good reason to differ from the kernel default (which would then require changing other archs to match), I think we just need to make it consistent with what happens on other archs. Rich