On Wed, Dec 4, 2024 at 8:22 PM Jeff King <peff@xxxxxxxx> wrote: > > On Wed, Dec 04, 2024 at 07:21:16PM -0700, Dmitriy Panteleyev wrote: > > > After trying NO_MMAP=1 with and without SANITIZE, I get: > > "fatal: mmap failed: Permission denied" > > Hmm, that's odd. If you run it under strace, which syscall fails? That > message should be reporting errno from mmap(), which in NO_MMAP mode > should be a pread() call. I'm not sure why that would get EACCES if the > open() call succeeded, but that might explain why the mmap'd version > gets SIGBUS (I don't know much about NFS, but I imagine that under the > hood the client is probably issuing reads for individual pages to > fault in the map). Strace with NO_MMAP=1, I gives: openat(AT_FDCWD, ".git/objects/34/5819b235838e219d66420b536a54ce4cf0624c", O_RDONLY|O_CLOEXEC) = 4 fstat(4, {st_mode=S_IFREG|0444, st_size=154, ...}) = 0 pread64(4, 0x61a0292e15d0, 154, 0) = -1 ESTALE (Stale file handle) write(2, "fatal: mmap failed: Permission d"..., 38) = 38 Weirdly, it's throwing ESTALE not EACCESS... Without NO_MMAP, I get: openat(AT_FDCWD, ".git/objects/51/da8e85661b60d7378b8ac0d896cfc955405fdf", O_RDONLY|O_CLOEXEC) = 4 fstat(4, {st_mode=S_IFREG|0444, st_size=154, ...}) = 0 mmap(NULL, 154, PROT_READ, MAP_PRIVATE, 4, 0) = 0x73ceb860e000 close(4) = 0 --- SIGBUS {si_signo=SIGBUS, si_code=BUS_ADRERR, si_addr=0x73ceb860e000} --- +++ killed by SIGBUS (core dumped) +++ Also, it's odd that the same set of commands -- openat(), fstat(), and pread64() / mmap() -- succeed multiple times before an error is encountered. > > Does your system have AppArmor enabled? Yes, but I don't see any profiles related to git. And I can't image AppArmor would be version-dependent. > > This issue sounds similar to yours: > > https://unix.stackexchange.com/questions/633389/man-cannot-read-manpage-from-nfs-although-the-file-is-readable > > especially the bit where reading the metadata once makes it magically > work for a brief period (which is the only thing I'd expect the commit > you found via bisection to have an effect on). > > -Peff