Skip to contentSkip to conversation

Never mind. Re: Signal left blocked after signal handler.

DISCUSSION Albert Cahalan 3 participants 4 messages Nov 26, 2003 – Nov 27, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines

One difference in 2.4.x and 2.6.x is the signal blocking wrt blocked signals that are _forced_ (ie anything that is thread-synchronous, like a SIGSEGV/SIGTRAP/SIGBUS that happens as a result of a fault):

- in 2.4.x they will just punch through the block
- in 2.6.x they will refuse to punch through a blocked signal, but since they can't be delivered they will cause the process to be killed.

...

Quoted 5 lines

and in 2.4.x this will cause infinte SIGSEGV's (well, they'll be caught by the stack size eventually, but you see the problem: do a "strace" to see what's going on). In 2.6.x the second SIGSEGV will just kill the program immediately.

How about making the process sleep in a killable state?

This is as if the blocking was obeyed, but doesn't burn CPU time. Only a debugger should be able to tell the difference.

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 26 November 2003 22:53, Albert Cahalan wrote:
[2.4 vs. 2.6 wrt. thread synchronous signals]

Quoted 5 lines

How about making the process sleep in a killable state?

This is as if the blocking was obeyed, but doesn't burn CPU time. Only a debugger should be able to tell the difference.

This has 2 problems:

1) Servers and PID files or servers and simple monitoring software.
2) Processes spawned from init, which will not respawn.

Regards

Ingo Oeser

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/xb/mU56oYWuOrkARAmNaAKCL1uojbOpMtMdSvAl6B9rBW51CTgCgypP8 NlbaIac25oefxcHL9WlzxyE=
=h6UI
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 5 lines · Ingo Oeser

On Wednesday 26 November 2003 22:53, Albert Cahalan wrote:

[2.4 vs. 2.6 wrt. thread synchronous signals]

Quoted 2 lines

How about making the process sleep in a killable state?

Quoted 8 lines
Quoted 3 lines

This is as if the blocking was obeyed, but doesn't burn CPU time. Only a debugger should be able to tell the difference.

This has 2 problems:

1) Servers and PID files or servers and simple monitoring software.
2) Processes spawned from init, which will not respawn.

It has benefits:

1. Continuous respawning is no good.
2. If the processes sleeps, you can attach a debugger.

The obviously correct behavior is to go back into user space, likely to take the signal again. The only thing wrong with this is that it eats CPU time. So _pretend_ to do that. Have the process sleep, ideally with an "R" state as seen in /proc, and maybe even go back to the crazy loop if someone attaches a debugger.

The crazy loop is most correct though. It's what the user asked for. It perfectly handles the case of a repeating SIGFPE (blocked) followed by some other thread unmapping a page of instructions or data that turns the SIGFPE into a SIGSEGV.

#3 lore raw
Quoted 4 lines · Albert Cahalan

It has benefits:

1. Continuous respawning is no good.

But trivial to notice. :)

Quoted 1 line

2. If the processes sleeps, you can attach a debugger.

If aunt Tilly has a core dump, her son can extract it and send it to some developer. No need for you to drive over to aunt Tilly.

Quoted 8 lines

The obviously correct behavior is to go back into user space, likely to take the signal again. The only thing wrong with this is that it eats CPU time. So _pretend_ to do that. Have the process sleep, ideally with an "R" state as seen in /proc, and maybe even go back to the crazy loop if someone attaches a debugger.

Quoted 5 lines

The crazy loop is most correct though. It's what the user asked for. It perfectly handles the case of a repeating SIGFPE (blocked) followed by some other thread unmapping a page of instructions or data that turns the SIGFPE into a SIGSEGV.

"It just what you asked for, but not what you wanted."

I am a firm non-believer in the trust-the-programmer paradigm. How many people actually intend to do NULL-pointer dereferences, etc? To make this possible "if you really really want to" is ok, but at least make the bad behaviour hard to trigger by accident.

What Linux did in 2.5.7x is not exacly what I would have done, but it makes it hard to do the Wrong Thing (tm) by accident, while allowing it for those who really want it. Good enough for most users.

Jörn

Signature · 2 lines
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu