Bug #52312 [Fbk]: PHP lstat problem

2010-07-12 Thread rasmus
Edit report at http://bugs.php.net/bug.php?id=52312edit=1

 ID:   52312
 Updated by:   ras...@php.net
 Reported by:  v dot damore at gmail dot com
 Summary:  PHP lstat problem
 Status:   Feedback
 Type: Bug
 Package:  Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:  5.2.13

 New Comment:

I don't see that here.  Attach gdb and set a breakpoint on lstat and see
who is 

calling them.


Previous Comments:

[2010-07-12 18:21:50] v dot damore at gmail dot com

I have already tried with 5.3 and I was thinking to open an new bug
because I have same behavior, there is only a change in the order of
execution of lstat from fullpath to /usr :



7339  chdir(/usr/local/myspace/webspace/httpdocs) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) =
16

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000

7339  munmap(0x2adfec195000, 19)= 0

7339  close(16) = 0

7339  chdir(/)= 0


[2010-07-12 18:03:54] paj...@php.net

Can you try with 5.3 please?


[2010-07-12 17:51:24] v dot damore at gmail dot com

I tried again with a simple script test.php '? echo Ciao ?'

realpath_cache_size=1024k

realpath_cache_ttl=600



I have always same behavior (also second and following times I try to
call curl http://damorealt.xoom.it/test.php:



13692 chdir(/usr/local/myspace/webspace/httpdocs) = 0

13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

13692 lstat(/usr/local/myspace/webspace, 

Bug #52312 [Fbk]: PHP lstat problem

2010-07-12 Thread rasmus
Edit report at http://bugs.php.net/bug.php?id=52312edit=1

 ID:   52312
 Updated by:   ras...@php.net
 Reported by:  v dot damore at gmail dot com
 Summary:  PHP lstat problem
 Status:   Feedback
 Type: Bug
 Package:  Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:  5.2.13

 New Comment:

5.3.  I haven't looked at 5.2 in 2+ years.


Previous Comments:

[2010-07-12 19:07:06] v dot damore at gmail dot com

where I have attach gdb, on 5.2.13 or on 5.3.2 ?


[2010-07-12 19:00:40] ras...@php.net

I don't see that here.  Attach gdb and set a breakpoint on lstat and see
who is 

calling them.


[2010-07-12 18:21:50] v dot damore at gmail dot com

I have already tried with 5.3 and I was thinking to open an new bug
because I have same behavior, there is only a change in the order of
execution of lstat from fullpath to /usr :



7339  chdir(/usr/local/myspace/webspace/httpdocs) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) =
16

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000

7339  munmap(0x2adfec195000, 19)= 0

7339  close(16) = 0

7339  chdir(/)= 0


[2010-07-12 18:03:54] paj...@php.net

Can you try with 5.3 please?


[2010-07-12 17:51:24] v dot damore at gmail dot com

I tried again with a simple script test.php '? echo Ciao ?'

realpath_cache_size=1024k

realpath_cache_ttl=600



I have always same behavior (also second and following times I try to
call curl http://damorealt.xoom.it/test.php:



13692 chdir(/usr/local/myspace/webspace/httpdocs) = 0

13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

13692 lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

13692 

Bug #52312 [Fbk]: PHP lstat problem

2010-07-12 Thread rasmus
Edit report at http://bugs.php.net/bug.php?id=52312edit=1

 ID:   52312
 Updated by:   ras...@php.net
 Reported by:  v dot damore at gmail dot com
 Summary:  PHP lstat problem
 Status:   Feedback
 Type: Bug
 Package:  Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:  5.2.13

 New Comment:

It seems like your realpath cache isn't working at all.



Could you set a breakpoint on realpath_cache_find and step into it the
second time 

it hits those stat calls.  Does it go into the while(bucket) loop there
at all?


Previous Comments:

[2010-07-12 23:48:10] v dot damore at gmail dot com

gdb reproduce the behavior reported in my comments, I have uploaded
result of your request at 

http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt


[2010-07-12 19:09:00] ras...@php.net

5.3.  I haven't looked at 5.2 in 2+ years.


[2010-07-12 19:07:06] v dot damore at gmail dot com

where I have attach gdb, on 5.2.13 or on 5.3.2 ?


[2010-07-12 19:00:40] ras...@php.net

I don't see that here.  Attach gdb and set a breakpoint on lstat and see
who is 

calling them.


[2010-07-12 18:21:50] v dot damore at gmail dot com

I have already tried with 5.3 and I was thinking to open an new bug
because I have same behavior, there is only a change in the order of
execution of lstat from fullpath to /usr :



7339  chdir(/usr/local/myspace/webspace/httpdocs) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs/test.php,
{st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  lstat(/usr/local/myspace/webspace/httpdocs,
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0

7339  lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

7339  lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

7339  lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

7339  open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) =
16

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0

7339  mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000

7339  munmap(0x2adfec195000, 19)= 0

7339  close(16) = 0

7339  chdir(/)= 0




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=52312


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1


Bug #52312 [Fbk]: PHP lstat problem

2010-07-12 Thread rasmus
Edit report at http://bugs.php.net/bug.php?id=52312edit=1

 ID:   52312
 Updated by:   ras...@php.net
 Reported by:  v dot damore at gmail dot com
 Summary:  PHP lstat problem
 Status:   Feedback
 Type: Bug
 Package:  Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:  5.2.13

 New Comment:

Actually, try this simple test.php script:



pre

?php

var_dump(realpath_cache_get());

?

/pre





That should tell you what is getting cached.


Previous Comments:

[2010-07-13 00:17:16] ras...@php.net

It seems like your realpath cache isn't working at all.



Could you set a breakpoint on realpath_cache_find and step into it the
second time 

it hits those stat calls.  Does it go into the while(bucket) loop there
at all?


[2010-07-12 23:48:10] v dot damore at gmail dot com

gdb reproduce the behavior reported in my comments, I have uploaded
result of your request at 

http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt


[2010-07-12 19:09:00] ras...@php.net

5.3.  I haven't looked at 5.2 in 2+ years.


[2010-07-12 19:07:06] v dot damore at gmail dot com

where I have attach gdb, on 5.2.13 or on 5.3.2 ?


[2010-07-12 19:00:40] ras...@php.net

I don't see that here.  Attach gdb and set a breakpoint on lstat and see
who is 

calling them.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=52312


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1


Bug #52312 [Fbk]: PHP lstat problem

2010-07-12 Thread rasmus
Edit report at http://bugs.php.net/bug.php?id=52312edit=1

 ID:   52312
 Updated by:   ras...@php.net
 Reported by:  v dot damore at gmail dot com
 Summary:  PHP lstat problem
 Status:   Feedback
 Type: Bug
 Package:  Safe Mode/open_basedir
 Operating System: Linux
 PHP Version:  5.2.13

 New Comment:

Set a bp and step through tsrm_realpath_r and figure out why it isn't
getting to 

the realptath_cache_find() call there.  Seems like it should be getting
there from 

the backtraces.


Previous Comments:

[2010-07-13 00:52:21] v dot damore at gmail dot com

Please also note that realpath_cache_size and realpath_cache_ttl are
currently set to following values:



[r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep
real



trtd class=erealpath_cache_size/tdtd class=v1024k/tdtd
class=v1024k/td/tr

trtd class=erealpath_cache_ttl/tdtd class=v600/tdtd
class=v600/td/tr


[2010-07-13 00:47:13] v dot damore at gmail dot com

I have executed script:



pre

?php

var_dump(realpath_cache_get());

?

/pre



[r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php

pre

array(0) {

}

/pre


[2010-07-13 00:38:32] v dot damore at gmail dot com

Please note, gdb output I sent is related to third time I have called
curl http://damorealt.xoom.it/test.php



I have set break point as requested:



(gdb) break realpath_cache_find

Breakpoint 1 at 0x2b0b3c9f254d: file
/usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c,
line 560.

(gdb) bt

#0  0x00391760db00 in __accept_nocancel () from
/lib64/libpthread.so.0

#1  0x2b0b3c1f4544 in apr_socket_accept () from
/usr/lib64/libapr-1.so.0

#2  0x004562e5 in unixd_accept ()

#3  0x00454006 in child_main ()

#4  0x0045416c in make_child ()

#5  0x00454701 in ap_mpm_run ()

#6  0x004220ef in main ()

(gdb) continue

Continuing.



During test call gdb as not broken execution.

Function realpath_cache_find is not called.


[2010-07-13 00:33:12] ras...@php.net

Actually, try this simple test.php script:



pre

?php

var_dump(realpath_cache_get());

?

/pre





That should tell you what is getting cached.


[2010-07-13 00:17:16] ras...@php.net

It seems like your realpath cache isn't working at all.



Could you set a breakpoint on realpath_cache_find and step into it the
second time 

it hits those stat calls.  Does it go into the while(bucket) loop there
at all?




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=52312


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1