From: Chris Hofstaedtler <zeha@debian.org>
To: util-linux@vger.kernel.org
Cc: "Marc Lehmann" <debian-reportbug@plan9.de>,
1141670@bugs.debian.org, наб <nabijaczleweli@nabijaczleweli.xyz>
Subject: Re: Bug#1141670: util-linux: very slow code and undefined behaviour in handle_interrupt
Date: Sat, 11 Jul 2026 19:34:41 -0300 [thread overview]
Message-ID: <alLEV6xOOwA1RzU_@zeha.at> (raw)
In-Reply-To: <178350371646.36377.6056214111743171473.reportbug@cerebro.laendle>
Hi util-linux maintainers,
the following was reported to Debian, regarding the hardlink
utility. It appears to be an upstream issue. Maybe someone can look
at it. CC:ing наб who seems to have touched the relevant function
last.
Thanks,
Chris
* Marc Lehmann <debian-reportbug@plan9.de> [260708 07:23]:
>Version: 2.41-5
>
>Dear Maintainer,
>
>while strace'ing to find out why hardlink is so slow, IO found it does this sequence between every fstatat call:
>
> gettid() = 36482
> getpid() = 36482
> tgkill(36482, 36482, 0) = 0
>
>this seems to be a pretty weird thing to do in a tighht scanning
>loop. Looking at the code, handle_interrupt is responsible:
>
> /**
> * handle_interrupt - Handle a signal
> */
> static void handle_interrupt(void)
> {
> switch (last_signal) {
> case SIGUSR1:
> print_stats();
> putchar('\n');
> break;
> default:
> signal(last_signal, SIG_DFL);
> raise(last_signal);
> break;
> }
> last_signal = 0;
> }
>
>this is already a weird function to begin with, but crucially, it calls signal(0,... and raise(0).
>
>it seems to me the former is likely undefined behaviour and the latter is
>just unnecessartily slow.
>
>most likely, handle_interrupt simply should not be called after every fstatat, or at all, without last_signal bering set beforehand.
>
next parent reply other threads:[~2026-07-11 22:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <178350371646.36377.6056214111743171473.reportbug@cerebro.laendle>
2026-07-11 22:34 ` Chris Hofstaedtler [this message]
2026-07-12 9:02 ` Bug#1141670: util-linux: very slow code and undefined behaviour in handle_interrupt Dirk Gouders
2026-07-13 11:19 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alLEV6xOOwA1RzU_@zeha.at \
--to=zeha@debian.org \
--cc=1141670@bugs.debian.org \
--cc=debian-reportbug@plan9.de \
--cc=nabijaczleweli@nabijaczleweli.xyz \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.