When calling shutdown, shutdown sends a signal to init and exits. This
causes a race condition for the waitpid function. If the signal wins the
race, wpid will be set to -1 and init calls death_single. If shutdown
wins the race, wpid will be set to the pid of the shutdown process and
the requested_transition will be ignored.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
The single_user function checks for requested_transition in it's while condition:
do { ... } while (wpid != pid && !requested_transition); if (requested_transition) return (state_funct_t) requested_transition
Does it make sense to use it here too?
Comment Actions
The race is still there. However, it's not an issue any more. This patch checks requested_transition on each exit of waitpid and not only when the signal wins the race (wpid == -1).
Comment Actions
Ah, it makes the race not matter. I think I understand and I agree that the change is good.