public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
@ 2021-02-20 22:45 Takashi Yano
  2021-02-22  9:51 ` Corinna Vinschen
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Yano @ 2021-02-20 22:45 UTC (permalink / raw)
  To: cygwin-patches

- After commit 253352e796ff9ec9a447e5375f5bc3e2b92b5293, mc (midnight
  commander) crashes with segfault if the shell is bash. This is due
  to NULL pointer access in read(). This patch fixes the issue.
  Addresses::
    https://cygwin.com/pipermail/cygwin/2021-February/247870.html
---
 winsup/cygwin/fhandler_tty.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index d30041af1..3fcaa8277 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1474,8 +1474,11 @@ wait_retry:
 out:
   termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
   len = (size_t) totalread;
-  bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
-  mask_switch_to_pcon_in (false, saw_eol);
+  if (ptr0)
+    { /* Not tcflush() */
+      bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
+      mask_switch_to_pcon_in (false, saw_eol);
+    }
 }
 
 int
-- 
2.30.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-20 22:45 [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called Takashi Yano
@ 2021-02-22  9:51 ` Corinna Vinschen
  2021-02-22 11:41   ` Takashi Yano
  0 siblings, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2021-02-22  9:51 UTC (permalink / raw)
  To: cygwin-patches

On Feb 21 07:45, Takashi Yano via Cygwin-patches wrote:
> - After commit 253352e796ff9ec9a447e5375f5bc3e2b92b5293, mc (midnight
>   commander) crashes with segfault if the shell is bash. This is due
>   to NULL pointer access in read(). This patch fixes the issue.
>   Addresses::
>     https://cygwin.com/pipermail/cygwin/2021-February/247870.html
> ---
>  winsup/cygwin/fhandler_tty.cc | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index d30041af1..3fcaa8277 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -1474,8 +1474,11 @@ wait_retry:
>  out:
>    termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
>    len = (size_t) totalread;
> -  bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
> -  mask_switch_to_pcon_in (false, saw_eol);
> +  if (ptr0)
> +    { /* Not tcflush() */
> +      bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
> +      mask_switch_to_pcon_in (false, saw_eol);
> +    }
>  }
>  
>  int
> -- 
> 2.30.0

Pushed.

So, what do you think is the state of the console code, Takashi?
Shall we start a release cycle next week?


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-22  9:51 ` Corinna Vinschen
@ 2021-02-22 11:41   ` Takashi Yano
  2021-02-22 13:28     ` Takashi Yano
  2021-02-22 13:57     ` Corinna Vinschen
  0 siblings, 2 replies; 10+ messages in thread
From: Takashi Yano @ 2021-02-22 11:41 UTC (permalink / raw)
  To: cygwin-patches

On Mon, 22 Feb 2021 10:51:19 +0100
Corinna Vinschen wrote:
> So, what do you think is the state of the console code, Takashi?
> Shall we start a release cycle next week?

I think all the fixes and improvements that come to mind at this
point have been completed. As for releasing, I believe I've done
enough testing, but honestly I'm not without anxiety because total
amount of changes for pty and console code is relatively large
since the beginning of this year.

On the other hand, I also want people to use new features as soon
as possible.

I would like to leave the final decision to you.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-22 11:41   ` Takashi Yano
@ 2021-02-22 13:28     ` Takashi Yano
  2021-02-22 13:57       ` Corinna Vinschen
  2021-02-22 13:57     ` Corinna Vinschen
  1 sibling, 1 reply; 10+ messages in thread
From: Takashi Yano @ 2021-02-22 13:28 UTC (permalink / raw)
  To: cygwin-patches

On Mon, 22 Feb 2021 20:41:00 +0900
Takashi Yano wrote:
> On Mon, 22 Feb 2021 10:51:19 +0100
> Corinna Vinschen wrote:
> > So, what do you think is the state of the console code, Takashi?
> > Shall we start a release cycle next week?
> 
> I think all the fixes and improvements that come to mind at this
> point have been completed. As for releasing, I believe I've done
> enough testing, but honestly I'm not without anxiety because total
> amount of changes for pty and console code is relatively large
> since the beginning of this year.

Sure enough, I found a problem in the console code...

I will submit a patch for that.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-22 11:41   ` Takashi Yano
  2021-02-22 13:28     ` Takashi Yano
@ 2021-02-22 13:57     ` Corinna Vinschen
  2021-02-23 11:24       ` Thomas Wolff
  1 sibling, 1 reply; 10+ messages in thread
From: Corinna Vinschen @ 2021-02-22 13:57 UTC (permalink / raw)
  To: cygwin-patches

On Feb 22 20:41, Takashi Yano via Cygwin-patches wrote:
> On Mon, 22 Feb 2021 10:51:19 +0100
> Corinna Vinschen wrote:
> > So, what do you think is the state of the console code, Takashi?
> > Shall we start a release cycle next week?
> 
> I think all the fixes and improvements that come to mind at this
> point have been completed. As for releasing, I believe I've done
> enough testing, but honestly I'm not without anxiety because total
> amount of changes for pty and console code is relatively large
> since the beginning of this year.
> 
> On the other hand, I also want people to use new features as soon
> as possible.

Then let's do it.  I'll start with the usual test releases...


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-22 13:28     ` Takashi Yano
@ 2021-02-22 13:57       ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2021-02-22 13:57 UTC (permalink / raw)
  To: cygwin-patches

On Feb 22 22:28, Takashi Yano via Cygwin-patches wrote:
> On Mon, 22 Feb 2021 20:41:00 +0900
> Takashi Yano wrote:
> > On Mon, 22 Feb 2021 10:51:19 +0100
> > Corinna Vinschen wrote:
> > > So, what do you think is the state of the console code, Takashi?
> > > Shall we start a release cycle next week?
> > 
> > I think all the fixes and improvements that come to mind at this
> > point have been completed. As for releasing, I believe I've done
> > enough testing, but honestly I'm not without anxiety because total
> > amount of changes for pty and console code is relatively large
> > since the beginning of this year.
> 
> Sure enough, I found a problem in the console code...

:)

> I will submit a patch for that.

No worries,
Corinna

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-22 13:57     ` Corinna Vinschen
@ 2021-02-23 11:24       ` Thomas Wolff
  2021-02-23 13:13         ` Takashi Yano
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Wolff @ 2021-02-23 11:24 UTC (permalink / raw)
  To: cygwin-patches


Am 22.02.2021 um 14:57 schrieb Corinna Vinschen via Cygwin-patches:
> On Feb 22 20:41, Takashi Yano via Cygwin-patches wrote:
>> On Mon, 22 Feb 2021 10:51:19 +0100
>> Corinna Vinschen wrote:
>>> So, what do you think is the state of the console code, Takashi?
>>> Shall we start a release cycle next week?
>> I think all the fixes and improvements that come to mind at this
>> point have been completed. As for releasing, I believe I've done
>> enough testing, but honestly I'm not without anxiety because total
>> amount of changes for pty and console code is relatively large
>> since the beginning of this year.
>>
>> On the other hand, I also want people to use new features as soon
>> as possible.
> Then let's do it.  I'll start with the usual test releases...
I've downloaded yesterday's snapshot (2021-02-22) for some testing.
If I compile mintty (which passes without problem) and try to run it, it 
just exits silently (no window popped up).
After reverting to 3.1.7, it runs just fine (even the one compiled with 
the snapshot).

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-23 11:24       ` Thomas Wolff
@ 2021-02-23 13:13         ` Takashi Yano
  2021-02-23 13:33           ` Takashi Yano
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Yano @ 2021-02-23 13:13 UTC (permalink / raw)
  To: cygwin-patches

Hi Thomas,

On Tue, 23 Feb 2021 12:24:09 +0100
Thomas Wolff wrote:
> I've downloaded yesterday's snapshot (2021-02-22) for some testing.
> If I compile mintty (which passes without problem) and try to run it, it 
> just exits silently (no window popped up).
> After reverting to 3.1.7, it runs just fine (even the one compiled with 
> the snapshot).

Thanks for testing. However, I cannot reproduce your problem.
I downloaded mintty-3.4.6-1-src.tar.xz and extract it.
Then run
cygport mintty-3.4.6-1.cygport prep
cygport mintty-3.4.6-1.cygport compile

The binary in build/bin directory works with cygwin snapshot
2021-02-22. I have tried both 32bit and 64bit build, and both
work without problem.

Could you please provide some more information?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-23 13:13         ` Takashi Yano
@ 2021-02-23 13:33           ` Takashi Yano
  2021-02-23 17:15             ` Thomas Wolff
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Yano @ 2021-02-23 13:33 UTC (permalink / raw)
  To: cygwin-patches

On Tue, 23 Feb 2021 22:13:52 +0900
Takashi Yano wrote:
> Hi Thomas,
> 
> On Tue, 23 Feb 2021 12:24:09 +0100
> Thomas Wolff wrote:
> > I've downloaded yesterday's snapshot (2021-02-22) for some testing.
> > If I compile mintty (which passes without problem) and try to run it, it 
> > just exits silently (no window popped up).
> > After reverting to 3.1.7, it runs just fine (even the one compiled with 
> > the snapshot).
> 
> Thanks for testing. However, I cannot reproduce your problem.
> I downloaded mintty-3.4.6-1-src.tar.xz and extract it.
> Then run
> cygport mintty-3.4.6-1.cygport prep
> cygport mintty-3.4.6-1.cygport compile
> 
> The binary in build/bin directory works with cygwin snapshot
> 2021-02-22. I have tried both 32bit and 64bit build, and both
> work without problem.
> 
> Could you please provide some more information?

Difference of compiler version?
I am using gcc-g++ 10.2.0-1.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called.
  2021-02-23 13:33           ` Takashi Yano
@ 2021-02-23 17:15             ` Thomas Wolff
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Wolff @ 2021-02-23 17:15 UTC (permalink / raw)
  To: cygwin-patches



Am 23.02.2021 um 14:33 schrieb Takashi Yano via Cygwin-patches:
> On Tue, 23 Feb 2021 22:13:52 +0900
> Takashi Yano wrote:
>> Hi Thomas,
>>
>> On Tue, 23 Feb 2021 12:24:09 +0100
>> Thomas Wolff wrote:
>>> I've downloaded yesterday's snapshot (2021-02-22) for some testing.
>>> If I compile mintty (which passes without problem) and try to run it, it
>>> just exits silently (no window popped up).
>>> After reverting to 3.1.7, it runs just fine (even the one compiled with
>>> the snapshot).
>> Thanks for testing. However, I cannot reproduce your problem.
>> I downloaded mintty-3.4.6-1-src.tar.xz and extract it.
>> Then run
>> cygport mintty-3.4.6-1.cygport prep
>> cygport mintty-3.4.6-1.cygport compile
>>
>> The binary in build/bin directory works with cygwin snapshot
>> 2021-02-22. I have tried both 32bit and 64bit build, and both
>> work without problem.
>>
>> Could you please provide some more information?
> Difference of compiler version?
> I am using gcc-g++ 10.2.0-1.
Apologies, I confused this. I *wanted* to try the snapshot but then 
tried a self-compiled dll instead (fresh git pull).
The snapshot works. The git pull doesn't but that may have other 
mysterious reasons.
Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-23 17:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 22:45 [PATCH] Cygwin: pty: Fix segfault caused when tcflush() is called Takashi Yano
2021-02-22  9:51 ` Corinna Vinschen
2021-02-22 11:41   ` Takashi Yano
2021-02-22 13:28     ` Takashi Yano
2021-02-22 13:57       ` Corinna Vinschen
2021-02-22 13:57     ` Corinna Vinschen
2021-02-23 11:24       ` Thomas Wolff
2021-02-23 13:13         ` Takashi Yano
2021-02-23 13:33           ` Takashi Yano
2021-02-23 17:15             ` Thomas Wolff

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).