[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: give_terminal_to() / maybe_give_terminal_to() race
From: |
Chet Ramey |
Subject: |
Re: give_terminal_to() / maybe_give_terminal_to() race |
Date: |
Wed, 30 Aug 2023 10:39:39 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 |
On 8/25/23 9:38 PM, Earl Chew wrote:
A newly created process of a foreground job races the
parent shell to configure the controlling terminal. This
can result in the parent shell stealing the controlling
terminal from a grandchild, and giving it to the child.
I think stop_pipeline() needs to be fixed to be more
cautious. What might be the right approach?
OK, so there is a potential race condition here. What do you suggest the
right approach might be? It seems to me we can do one of two things:
rearrange and extend the PGRP_PIPE code to make sure the child process
doesn't proceed until the parent sets the terminal process group; or
change stop_pipeline() (and audit its callers, of course) so it does not
set the terminal process group.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/