php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4143 Using SysV shared memory leads to crash.
Submitted: 2000-04-14 03:12 UTC Modified: 2000-04-14 09:18 UTC
From: kir at astrive dot ru Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.16 OS: Sun Solaris 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kir at astrive dot ru
New email:
PHP Version: OS:

 

 [2000-04-14 03:12 UTC] kir at astrive dot ru
This problem didn't exists in 3.0.15. But in 3.0.15 shared memory didn't work on Solaris 7 x86 (Bug #3621)
Configure line:
./configure  \
--with-oracle=/opt/oracle/product/8.0.4 \
--with-config-file-path=/usr/local/apache/conf \
--with-apxs=/usr/local/apache/bin/apxs \
--enable-magic-quotes=yes --disable-debug \
--enable-memory-limit=yes --enable-url-fopen-wrapper=no \
--enable-sysvsem=yes --enable-sysvshm=yes  \
--enable-track-vars=yes --with-system-regex

With this configuration code like this:
<?php
$semid = sem_get(0x123754);
sem_acquire($semid);
Echo "aaa";
sem_release($semid);
?>
gives "Document contains no data" and Bus error in error_log.

After some investigation, I've found the following:

From the man page for semctl on Solaris:
-------------------------------------------------------------
 The semctl() function provides a variety of  semaphore  con-
     trol  operations as specified by cmd. The fourth argument is
     optional,  depending  upon  the  operation   requested.   If
     required,  it  is of type  union semun, which must be expli-
     citly declared by the application program.

      union semun {
             int             val;
             struct semid_ds *buf;
             ushort_t        *array;
     } arg ;
-------------------------------------------------------------

There is already definition of this structure in semvsem.c:

#if !HAVE_SEMUN && defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ == 6
union semun {
    int val;                    /* value for SETVAL */
    struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */
    unsigned short int *array;  /* array for GETALL, SETALL */
    struct seminfo *__buf;      /* buffer for IPC_INFO */
};
#undef HAVE_SEMUN
#define HAVE_SEMUN 1
#endif

  So, I changed the line

#if !HAVE_SEMUN && defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ == 6
with
#if !HAVE_SEMUN

 and recompiled php with union semun defined - it compiled smoothly,
and worked on Solaris 7 [Sun|x86].

  The same problem exists in PHP4 tree.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-14 09:18 UTC] rasmus at cvs dot php dot net
Applied - thanks
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 20:01:35 2025 UTC