Re: [BUG] commit fails with 'bus error' when working directory is on an NFS share
- From
- Dmitriy Panteleyev <dpantel@gmail.com>
- Date
- Dec 5, 2024, 03:59 UTC
- Message-ID
- <CAJ-DG_BdAiFk_2eV=JDF7Lth9+Ay=86w-VT26Rt+T5fdN1vd_w@mail.gmail.com>
- In-Reply-To
- <20241205032246.GA2573761@coredump.intra.peff.net>
On Wed, Dec 4, 2024 at 8:22 PM Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> > 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.
Show 10 quoted lines
> > 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