Signals from another process carry no siginfo

Open
#541 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, linux, macos

Research direction

Start with signal_queue and signal_enqueue_locked in src/syscall/signal.c, then trace how transport records are created and drained through sig_drain_cb in src/syscall/proc.c. Compare the signal metadata described here with Linux’s do_notify_parent and __send_signal behavior. Done means transported SIGCHLD and kill signals preserve the sender and status details observed through the listed interfaces; verify using the fork and sigtimedwait cases in the issue.

Written by the indexing model from the issue text.

Description

A signal that reaches a guest through the signal transport is queued by
signal_queue in src/syscall/signal.c, which passes no siginfo to
signal_enqueue_locked. The receiver gets the default siginfo instead of the
sender's. Two paths go through the transport:

  • SIGCHLD from proc_process_exit: si_pid is not the child's pid, si_code
    is 0 instead of CLD_EXITED, CLD_KILLED or CLD_DUMPED, and si_status
    is 0 instead of the exit status.
  • kill() from another elfuse process: si_pid is not the sender's pid.

sigtimedwait, sigwaitinfo, signalfd (ssi_pid, ssi_status) and
SA_SIGINFO handlers all see these values. Linux fills them in when it
generates the signal (do_notify_parent and __send_signal in
kernel/signal.c).

Evidence

Block SIGCHLD and SIGUSR1, fork a child that calls _exit(7), and call
sigtimedwait. Then fork a child that calls kill(getppid(), SIGUSR1) and
call sigtimedwait again.

elfuse Linux 7.0
SIGCHLD si_pid=1, si_code=0, si_status=0 child pid, CLD_EXITED, 7
kill si_pid=1, si_code=SI_USER sender pid, SI_USER

Cause

A transport record is "ns target_pid signum". It has no field for the
sender's pid, uid, si_code or status, so the drain (sig_drain_cb in
src/syscall/proc.c) has nothing to pass on and calls signal_queue rather
than signal_queue_info.

Dominant language
C
Stars
287
Forks
33
Avg merge
2d 17h
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sysprog21/elfuse

All issues in sysprog21/elfuse

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.