diff options
| author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2026-03-03 22:18:22 +0900 |
|---|---|---|
| committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2026-03-08 15:55:57 +0900 |
| commit | 699c6892f10371cda7ada5eb68e684363a3d8ee1 (patch) | |
| tree | d04f0231a6938b9d73c6c350f6c8035d3c1ec289 /newlib/libm/fenv/fegetenv.c | |
| parent | 9d74400365809e9dc09804a8630087f1083402be (diff) | |
| download | newlib-github/master.zip newlib-github/master.tar.gz newlib-github/master.tar.bz2 | |
Cygwin: pty: Fix nat pipe hand-over when pcon is disabledHEADgithub/mastergithub/mainmastermain
The nat pipe ownership hand-over mechanism relies on the console
process list - the set of processes attached to a console, enumerable
via `GetConsoleProcessList()`. For non-cygwin process in pcon_activated
case, this list contains all processes attached to the pseudo console.
Otherwise, it contains all processes attached to the invisible console.
04f386e9af (Cygwin: console: Inherit pcon hand over from parent pty,
2024-10-31) added a last-resort fallback in `get_winpid_to_hand_over()`
that hands nat pipe ownership to any process in the console process
list, including Cygwin processes. This fallback is needed when a
Cygwin process on the pseudo console (that might be exec'ed from non-
cygwin process) must take over management of an active pseudo console
after the original owner exits.
When the pseudo console is disabled, this fallback incorrectly finds a
Cygwin process (such as the shell) and assigns it nat pipe ownership,
because both the original nat pipe owner and the shell are assosiated
with the same invisible console. Since there is no console for that
process to manage, ownership never gets released, input stays stuck on
the nat pipe.
Only the third (last-resort) call in the cascade needs guarding: the
first two calls filter for native (non-Cygwin) processes via the `nat`
parameter, and handing ownership to another native process is fine
regardless of pcon state. It is only the fallback to Cygwin processes
that is dangerous without an active pseudo console.
Guard the fallback with a `pcon_activated` check, since handing nat
pipe ownership to a Cygwin process only makes sense when there is an
active pseudo console for it to manage.
Fixes: 04f386e9af99 ("Cygwin: console: Inherit pcon hand over from parent pty")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Diffstat (limited to 'newlib/libm/fenv/fegetenv.c')
0 files changed, 0 insertions, 0 deletions
