public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix exit code for non-cygwin process.
@ 2024-02-02 5:31 Takashi Yano
2024-02-02 6:27 ` 1dakotaxi
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2024-02-02 5:31 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=aa73e115242612bf8b5f8670c0c7d398693d1d84
commit aa73e115242612bf8b5f8670c0c7d398693d1d84
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Fri Feb 2 13:59:19 2024 +0900
Cygwin: console: Fix exit code for non-cygwin process.
If non-cygwin process is executed in console, the exit code is not
set correctly. This is because the stub process for non-cygwin app
crashes in fhandler_console::set_disable_master_thread() due to NULL
pointer dereference. This bug was introduced by the commit:
3721a756b0d8 ("Cygwin: console: Make the console accessible from
other terminals."), that the pointer cons is accessed before fixing
when it is NULL. This patch fixes the issue.
Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.")
Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/fhandler/console.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index b924a6bf3..6a42b4949 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -4537,9 +4537,6 @@ fhandler_console::need_console_handler ()
void
fhandler_console::set_disable_master_thread (bool x, fhandler_console *cons)
{
- const _minor_t unit = cons->get_minor ();
- if (con.disable_master_thread == x)
- return;
if (cons == NULL)
{
if (cygheap->ctty && cygheap->ctty->get_major () == DEV_CONS_MAJOR)
@@ -4547,6 +4544,9 @@ fhandler_console::set_disable_master_thread (bool x, fhandler_console *cons)
else
return;
}
+ const _minor_t unit = cons->get_minor ();
+ if (con.disable_master_thread == x)
+ return;
cons->acquire_input_mutex (mutex_timeout);
con.disable_master_thread = x;
cons->release_input_mutex ();
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix exit code for non-cygwin process.
2024-02-02 5:31 [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix exit code for non-cygwin process Takashi Yano
@ 2024-02-02 6:27 ` 1dakotaxi
0 siblings, 0 replies; 2+ messages in thread
From: 1dakotaxi @ 2024-02-02 6:27 UTC (permalink / raw)
To: Takashi Yano, cygwin-cvs
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
Stop Sent from my T-Mobile 5G Device
-------- Original message --------From: Takashi Yano via Cygwin-cvs <cygwin-cvs@cygwin.com> Date: 2/1/24 9:31 PM (GMT-08:00) To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix exit code for non-cygwin process. https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=aa73e115242612bf8b5f8670c0c7d398693d1d84commit aa73e115242612bf8b5f8670c0c7d398693d1d84Author: Takashi Yano <takashi.yano@nifty.ne.jp>Date: Fri Feb 2 13:59:19 2024 +0900 Cygwin: console: Fix exit code for non-cygwin process. If non-cygwin process is executed in console, the exit code is not set correctly. This is because the stub process for non-cygwin app crashes in fhandler_console::set_disable_master_thread() due to NULL pointer dereference. This bug was introduced by the commit: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals."), that the pointer cons is accessed before fixing when it is NULL. This patch fixes the issue. Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>Diff:--- winsup/cygwin/fhandler/console.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.ccindex b924a6bf3..6a42b4949 100644--- a/winsup/cygwin/fhandler/console.cc+++ b/winsup/cygwin/fhandler/console.cc@@ -4537,9 +4537,6 @@ fhandler_console::need_console_handler () void fhandler_console::set_disable_master_thread (bool x, fhandler_console *cons) {- const _minor_t unit = cons->get_minor ();- if (con.disable_master_thread == x)- return; if (cons == NULL) { if (cygheap->ctty && cygheap->ctty->get_major () == DEV_CONS_MAJOR)@@ -4547,6 +4544,9 @@ fhandler_console::set_disable_master_thread (bool x, fhandler_console *cons) else return; }+ const _minor_t unit = cons->get_minor ();+ if (con.disable_master_thread == x)+ return; cons->acquire_input_mutex (mutex_timeout); con.disable_master_thread = x; cons->release_input_mutex ();
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-02 6:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 5:31 [newlib-cygwin/cygwin-3_5-branch] Cygwin: console: Fix exit code for non-cygwin process Takashi Yano
2024-02-02 6:27 ` 1dakotaxi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).