Hello Samuel,

> Yes, that would be useful.
>
> Actually we could have a check target in the Makefile, that mounts some
> filesystem created on the fly, and performs a series of operations.

Good idea, I can do both, as two patches:

1. --enable-mutex-debug: a configure option that force-includes a
   small header making the mutexes PTHREAD_MUTEX_ERRORCHECK, with a
   macro around pthread_mutex_lock/unlock that stops with a backtrace
   when either fails.  (The default htl mutex has no owner, so an
   unbalanced unlock otherwise passes silently.)

2. A check target that creates a filesystem image on the fly, mounts
   it with the freshly built ext2fs.static, runs a series of
   operations, including error paths such as failing renames, EXCL
   creates and lookups through translators, and then checks that the
   translator is still alive and that e2fsck -fn finds the image
   clean.  With --enable-mutex-debug, an unbalanced unlock then shows
   up as a dead translator.

To be sure we mean the same thing: --enable-mutex-debug only changes
the compiler flags, so it works for a native build on the Hurd as well
as for a cross build.  make check always runs inside a Hurd system,
since it mounts the image with settrans; in a cross build it would only
say so and skip.  The two are independent, but used together, a lock
bug that the operations reach fails the check.

Where would you like the new header to live?  Maybe
libshouldbeinlibc/, so that it can apply to the whole tree rather than
only libdiskfs and the filesystems: libports, libpager and the other
translators may have the same kind of bugs.

Thanks,
Milos

On Sun, Nov 1, 2026 at 10:56 AM Samuel Thibault <[email protected]>
wrote:

> Hello,
>
> Milos Nikic, le jeu. 29 oct. 2026 21:26:38 -0700, a ecrit:
> > If you would like, I can send the instrumentation as a patch too, so
> > that these bugs show up quickly in the future, for example behind a
> > configure option such as --enable-mutex-debug.
>
> Yes, that would be useful.
>
> Actually we could have a check target in the Makefile, that mounts some
> filesystem created on the fly, and performs a series of operations.
>
> Samuel
>

Reply via email to