git/list[1] front-page[2] threads[3] people[4] search[5] about
 

ignored signals are not reset on execve

From
RVRasmus Villemoes <rasmus.villemoes@prevas.dk>
Date
Apr 5, 2022, 09:08 UTC
Message-ID
<420575be-1e0d-2c3b-ca5e-f9084688dcbb@prevas.dk>
Hi,
run-command.c has
		for (sig = 1; sig < NSIG; sig++) {
			/* ignored signals get reset to SIG_DFL on execve */
			if (signal(sig, SIG_DFL) == SIG_IGN)
				signal(sig, SIG_IGN);
		}

introduced by commit 45afb1ca9c28 (run-command: block signals between fork and execve).

However, 'man 7 signal' says
       A child created via fork(2) inherits a copy of its parent's
signal dispositions.  During an execve(2),  the  dispositions  of
       handled signals are reset to the default; the dispositions of
ignored signals are left unchanged.

So at least the comment is wrong, and the child is actually run with those signals ignored. Whether that's the intent I cannot say, but I doubt it; programs generally don't expect to be run with any signals ignored.

Rasmus
Message 1 of 1 in “ignored signals are not reset on execve”
  1. Rasmus VillemoesApr 5, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.