Bug Fix for SYSV semaphores.

2000-12-12 Thread Jeff Roberson
Title: Bug Fix for SYSV semaphores.





I noticed that sysv semaphores initialize the otime member of the semid_ds structure to 0, but they never update it afterwards. This field is supposed to be the last operation time. ie the last time a semctl was done. In UNIX Network Programming, Stevens suggests using this variable to detect races between multiple processes creating/accessing a sysv semaphore. Anyway, I looked through the code and came up with the following trivial patch. Could some one review it and perhaps commit it? This patch was made against current, but I noticed the bug is there in 4.1.1 and most likely everything before that.

Thanks,
Jeff


(Pardon the revision numbers, they are from my own repository)


*** sysv_sem.c 2000/09/15 11:11:48 1.1.1.1
--- sysv_sem.c 2000/12/12 23:44:28
***
*** 543,548 
--- 543,550 
 return(EINVAL);
 }
 
+ semaptr-sem_otime = time_second;
+ 
 if (eval == 0)
 p-p_retval[0] = rval;
 return(eval);





Re: Bug Fix for SYSV semaphores.

2000-12-12 Thread Peter Jeremy

On 2000-Dec-12 14:45:37 -0800, Jeff Roberson [EMAIL PROTECTED] wrote:
I noticed that sysv semaphores initialize the otime member of the semid_ds
structure to 0, but they never update it afterwards.  This field is supposed
to be the last operation time.  ie the last time a semctl was done.

See kern/12014, which fixes this and a variety of other bugs.

Peter


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message