#21822 [Com]: unaligned access installing PEAR

From: Date: Fri, 21 Feb 2003 16:18:01 +0000
Subject: #21822 [Com]: unaligned access installing PEAR
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13572@lists.php.net to get a copy of this message
ID: 21822 Comment by: ddhill at zk3 dot dec dot com Reported By: mtr at media dot mit dot edu Status: Open Bug Type: PEAR related Operating System: Tru64 PHP Version: 4.3.0 New Comment: This bug has the same root problem as is described in bug 20268. Previous Comments: ------------------------------------------------------------------------ [2003-02-21 10:00:54] ddhill at _nospamplease_ dot zk3 dot dec dot com I have encountered this problem and know where the problem lies. The problem lies in the use of OnUpdateInt by the zlib extension, and by grep anyway in a half dozen other extensions. Despite the name, OnUpdateInt requires that the target be a long and not an int. If you modify ext/zlib/php_zlib.h and change int output_compression; int output_compression_level; to longs the problem will go away. The reason for this is that OnUpdateInt casts the pointer passed to it as a long* which on Tru64 is 64 bits vs. a 32 bit value for an int. When zlib is initialized, the first value is ok because it happend to be 64 aligned, but the second value is not, and so generates the unaligned warning. This is *not* a trivial problem as the assignment to the long* means the 64 bits gets written into a 32 bit space which means whatever follows in memory get trashed. Given the endian of the machine, the value appears correct if the int is checked though, but you get this apparently "random" data corruption of the next member of the structure. ------------------------------------------------------------------------ [2003-01-27 02:58:39] spamhole at gmx dot at forgot to mention - the compiler used is gcc 2.95.3! ------------------------------------------------------------------------ [2003-01-27 02:56:55] spamhole at gmx dot at We have the 99% same problem on OpenBSD 3.1. Below is the output of 'make install': root@quenati(php-4.3.0)$ make install Installing PHP CLI binary: /usr/local/bin/ Installing PHP SAPI module [activating module `php4' in /var/www/conf/httpd.conf] cp libs/libphp4.so /usr/lib/apache/modules/libphp4.so chmod 755 /usr/lib/apache/modules/libphp4.so cp /var/www/conf/httpd.conf /var/www/conf/httpd.conf.bak cp /var/www/conf/httpd.conf.new /var/www/conf/httpd.conf rm /var/www/conf/httpd.conf.new Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ Installing PEAR environment: /usr/local/lib/php/ pid 15270 (php): unaligned access: va=0x12021df34 pc=0x120181c10 ra=0x120181c08 op=stq Bus error (core dumped) *** Error code 138 Stop in /usr/src/php-4.3.0 (line 196 of Makefile). *** Error code 1 Stop in /usr/src/php-4.3.0 (line 202 of Makefile). any suggestions how we can fix this asap? thanks! ------------------------------------------------------------------------ [2003-01-22 12:09:33] mtr at media dot mit dot edu Installing php-4.3.0 with php-4.3.0RC2-stat+onupdateint+zendparam.patch applied on Tru64 5.0A using gcc-3.0.4 results in two unaligned access errors as follows: ./configure --with-apxs=/usr/local/apache_1.3.27/bin/apxs --enable-trans-sid --with-zlib=/usr/local --with-openssl=/usr/local/ssl --with-imap=../imap-2001a --with-mysql=/usr/local/mysql-3.23.53 --with-gettext=/usr/local bash-2.05b# gmake install Installing PHP CLI binary: /usr/local/bin/ Installing PHP SAPI module [activating module `php4' in /usr/local/apache/conf/httpd.conf] . . . Installing PEAR environment: /usr/local/lib/php/ Unaligned access pid=213250 <php> va=0x14005c8e4 pc=0x12019e658 ra=0x12019db68 inst=0xb4290000 [PEAR] Archive_Tar - already installed: 0.9 [PEAR] Console_Getopt - already installed: 1.0 [PEAR] PEAR - already installed: 1.0b3 Unaligned access pid=213308 <php> va=0x14005c8e4 pc=0x12019e658 ra=0x12019db68 inst=0xb4290000 [PEAR] DB - already installed: 1.3 . . . etc ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21822&edit=1

« previous php.pear.dev (#13572) next »