You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Chia-liang Kao <cl...@CirX.ORG> on 2000/02/20 13:00:57 UTC

[PATCH] 2.0 builds, but dumps core on FreeBSD 3.3 (ap_lock)

Hi,

I just played with apache-2.0 on FreeBSD 4.0-current, and it coredumped on
ap_lock. This is because (in prefork mpm) setup_lock() is called in 
ap_initialize(), and ap_init_alloc is called before ap_initialize.
The ap_lock() causing segfault missed the proper op_on setting for semop.

I don't know if sysv sem strictly require implementations to follow the order
in struct sembuf. If so, the follow in patch would help.

Cheers,
CLK

On Thu, Feb 17, 2000 at 11:47:42AM -0500, rbb@apache.org wrote:
> I need to know which call to ap_lock is causing the seg fault.
> Unfortunately, I do not currently have access to a FreeBSD machine that I
> can do any testing on.  I am hoping to get access to a FreeBSD machine in
> a few weeks.  If you can get me either an account on a FreeBSD machine or
> a complete trace of the seg fault, I will see what I can do.

Index: crossproc.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/locks/unix/crossproc.c,v
retrieving revision 1.12
diff -u -r1.12 crossproc.c
--- crossproc.c	2000/01/25 23:04:27	1.12
+++ crossproc.c	2000/02/20 12:01:21
@@ -57,16 +57,10 @@
 
 #if defined (USE_SYSVSEM_SERIALIZE)  
 
-static struct sembuf op_on;
-static struct sembuf op_off;
+static struct sembuf op_on = {0, -1, SEM_UNDO};
+static struct sembuf op_off = {0, 1, SEM_UNDO};
 
 void setup_lock() {
-    op_on.sem_num = 0;
-    op_on.sem_op = -1;
-    op_on.sem_flg = SEM_UNDO;
-    op_off.sem_num = 0;
-    op_off.sem_op = 1;
-    op_off.sem_flg = SEM_UNDO;
 }
 
 ap_status_t lock_cleanup(void *lock_)

Re: [PATCH] 2.0 builds, but dumps core on FreeBSD 3.3 (ap_lock)

Posted by Jeff Trawick <tr...@ibm.net>.
Note that is the same problem I had a different fix for an hour or
so ago (subject="need ap_initialize() before create_process()->...->lock_inter()-
semop()"), not seeing your post until now.