public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* php 7 upgrade -- segmentation fault
@ 2016-11-29 18:11 59yfvs+f4bkzvgzw
  0 siblings, 0 replies; 5+ messages in thread
From: 59yfvs+f4bkzvgzw @ 2016-11-29 18:11 UTC (permalink / raw)
  To: cygwin

I just updated from php5.6.27-1 to php7.0.13-1 .  A previously working script now segfaults and the stackdump isn't terribly helpful in tracing the issue:

$ cat php.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=FFBC0008
eax=80155DA0 ebx=80165AC8 ecx=00289080 edx=00000004 esi=FFBC0008 edi=80165598
ebp=00000004 esp=0028905C program=D:\cygwin\bin\php.exe, pid 8504, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args

The script in question creates a persistent SSL socket to a server (not http), sets socket blocking to false, then enters into a while loop to process messages and respond.  I can tell that it is able to establish the connection.  The segmentation fault is happening somewhere in the loop.

NOW REMEMBER, this script has been working fine for months under the old php5.x branch.  Only with this change to php7 am I getting segfaults.  Also this script runs perfectly fine on a linux server using the same version of php7.

There is clearly a problem with this new php7 build for cygwin. I am happy to help gather more data on the issue if you direct me to the steps to undertake. It seems likely the problem revolves around the socket functions.

Some other details:
* 32 bit cygwin on a 64 bit Windows 7 machine
* php -v works
* php -a works
* basic php scripts work





----
Sent using Guerrillamail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=QlhzEgQOY7cMjxm9%2FjAcfRk%3D



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: php 7 upgrade -- segmentation fault
@ 2016-11-30  2:38 5a1dvi+28lxtut1an
  0 siblings, 0 replies; 5+ messages in thread
From: 5a1dvi+28lxtut1an @ 2016-11-30  2:38 UTC (permalink / raw)
  To: cygwin

Ahh!  I disabled pcre.jit in the new php.ini, and now it's working fine without the DEP exception.  Thanks for that tip. I can live with the performance hit vs the security.

Thanks again for working through it with me.





----
Sent using Guerrillamail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=QlhzEgQOY7cMjxm9%2FjAcfRk%3D



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: php 7 upgrade -- segmentation fault
  2016-11-29 20:14 59yfvs+f4bkzvgzw
@ 2016-11-30  1:08 ` Yaakov Selkowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Yaakov Selkowitz @ 2016-11-30  1:08 UTC (permalink / raw)
  To: cygwin

On 2016-11-29 12:22, 59yfvs+f4bkzvgzw@guerrillamail.com wrote:
> I can revert to php5 (insecure) and the problem is gone.  I just performed
> a full rebase which did nothing for this problem. Are you saying that on a
> Windows 7 64 bit Home system with 32 bit cygwin you are not having any issues?

I was testing on Windows 10 Pro.

> I found a solution that is not really satisfying.  If I go into Windows
> System Advanced Settings - Data Execution Prevention tab, and I explicitly
> add php.exe to the list of DEP exceptions, I no longer have errors with preg_match().

Ah, that explains it.  PHP 7 uses pcre's JIT functionality where 5.6 did 
not.  I guess you'd have the same problem with anything using a JIT. 
You will have to handle such issues with DEP on your end.

-- 
Yaakov

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: php 7 upgrade -- segmentation fault
  2016-11-29 18:21 59yfvs+f4bkzvgzw
@ 2016-11-29 18:25 ` Yaakov Selkowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Yaakov Selkowitz @ 2016-11-29 18:25 UTC (permalink / raw)
  To: cygwin

On 2016-11-29 11:50, 59yfvs+f4bkzvgzw at guerrillamail.com wrote:
> I've isolated the issue to a regular expression match!
>
> This line:
> $command = ( preg_match('#^(?:\:.*? )?(.*?) #', $buffer, $matches) ) ? $matches[1] : '';
>
> causes the segfaulting.  BUT WHY? Again this worked fine in php5.x . There is
> something broken with PCRE in this build.

I don't think so.  I tried the preg_match() examples in the manual and 
they worked fine.  Are you sure there isn't something else in your 
script that needs to updated for 7.0?  Otherwise, please provide an STC 
which replicates this.

-- 
Yaakov

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: php 7 upgrade -- segmentation fault
@ 2016-11-29 18:21 59yfvs+f4bkzvgzw
  2016-11-29 18:25 ` Yaakov Selkowitz
  0 siblings, 1 reply; 5+ messages in thread
From: 59yfvs+f4bkzvgzw @ 2016-11-29 18:21 UTC (permalink / raw)
  To: cygwin

I've isolated the issue to a regular expression match!

This line:
$command = ( preg_match('#^(?:\:.*? )?(.*?) #', $buffer, $matches) ) ? $matches[1] : '';

causes the segfaulting.  BUT WHY? Again this worked fine in php5.x . There is something broken with PCRE in this build.





----
Sent using Guerrillamail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=QlhzEgQOY7cMjxm9%2FjAcfRk%3D



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2016-11-29 19:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-29 18:11 php 7 upgrade -- segmentation fault 59yfvs+f4bkzvgzw
2016-11-29 18:21 59yfvs+f4bkzvgzw
2016-11-29 18:25 ` Yaakov Selkowitz
2016-11-29 20:14 59yfvs+f4bkzvgzw
2016-11-30  1:08 ` Yaakov Selkowitz
2016-11-30  2:38 5a1dvi+28lxtut1an

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