Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Guest ITIMER_REAL never fires in pause() or a spin loop

オープン
#477 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c

調査の方向性

Start with sys_ppoll in src/syscall/poll.c and the timer checks in src/syscall/io.c, then trace how the vCPU watchdog and RLIMIT_CPU sampler kick a guest vCPU in src/syscall/proc.c and issue #475. Add coverage for the reported alarm(1) cases: pause() and a spin loop. Done means both guest processes terminate from SIGALRM near the timer expiry.

索引モデルが issue の本文から書いたものです。

説明

A guest alarm() or setitimer(ITIMER_REAL) does not deliver SIGALRM while the guest sleeps in pause() or runs a loop with no syscalls. On Linux both end with SIGALRM when the timer expires.

elfuse keeps the guest ITIMER_REAL in guest_itimer (src/syscall/signal.c) instead of the host timer, since its own vCPU watchdog uses the host setitimer(ITIMER_REAL). The guest timer becomes a pending SIGALRM only when signal_check_timer or signal_check_timer_real runs: after a vCPU exit in src/syscall/proc.c, and inside the fd, futex and retry waits in src/syscall/io.c and src/runtime/futex.c. Two paths reach neither:

  • sys_ppoll in src/syscall/poll.c waits in host poll() slices and checks signal_pending_interruption, but never calls signal_check_timer_real. glibc's pause() is ppoll(NULL, 0, NULL, NULL), so it waits forever.
  • A guest spinning at EL0 takes no exit, so nothing checks the timer until the 10 s vCPU watchdog ends the process with a TIMEOUT crash report.

Reproduction, static aarch64 glibc:

#include <unistd.h>

int main(int argc, char **argv)
{
    alarm(2);
    if (argc > 1)
        for (volatile unsigned long n = 0;; n++)
            ;
    for (;;)
        pause();
}

On Linux both ./a.out and ./a.out spin die of SIGALRM after 2 s. Under elfuse on main at e9fdbbb, both were still running when killed at 12 s, with the pause() case parked in sys_ppoll. The result is the same in a fork child and with a second thread that spins or sleeps.

Follow-ups

  • Call signal_check_timer_real in the sys_ppoll wait loop and size the slice to the next guest timer expiry, as the fd wait in src/syscall/io.c does.
  • Have the guest timer kick a spinning vCPU when it expires, the way the RLIMIT_CPU sampler in #475 raises attention, so a compute loop sees SIGALRM on time.
  • Add a test: alarm(1) then pause(), and alarm(1) then a spin loop, each expected to die of SIGALRM.
主要言語
C
スター
278
フォーク
31
平均マージ
2日 22時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/elfuse のほかの issue

sysprog21/elfuse の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。