Bug 16057 - module fails to init client_rmm and applies too many locks.
Summary: module fails to init client_rmm and applies too many locks.
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_auth_digest (show other bugs)
Version: 2.0.43
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2003-01-14 08:22 UTC by Anthony Howe
Modified: 2016-12-20 21:42 UTC (History)
1 user (show)



Attachments
Replace use of shared memory with socache (35.08 KB, patch)
2009-07-02 07:11 UTC, Dan Poirier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Howe 2003-01-14 08:22:38 UTC
While porting mod_watch to Apache 2.0, I looked at mod_auth_digest as an example
of a module using shared memory and mutexes.  While looking at it I found what I
would consider to be some serious problems with the code:

a) No where in the module is client_rmm initialised before being used.

b) Line 1103 has the following:

    apr_global_mutex_lock(opaque_lock);
    op = (*opaque_cntr)++;
    apr_global_mutex_lock(opaque_lock);

I think the second apr_global_mutex_lock() should be apr_global_mutex_unlock().
Comment 1 Jeff Trawick 2003-01-15 16:52:02 UTC
ugh... that isn't the only massive suckage...  client_shm is initialized
but not used for anything but a flag...  in add_client(), a lock is obtained
but not released on an error path...
Comment 2 Justin Erenkrantz 2003-02-17 05:01:01 UTC
Either we should fix this (ouch, it is soooo broken), or just toss the shmem usage from mod_auth_digest.  It's always disabled now.  If someone wants to add it back, they would probably be better starting off from scratch than trying to sort out the current mess.
Comment 3 Paul Querna 2004-08-30 03:49:44 UTC
We should just remove the shmem code from head, since it has never been used anyways..
Comment 4 Davi Arnaut 2007-06-08 13:49:53 UTC
Seems fairly easy, but nothing yet after three years.
Comment 5 Dan Poirier 2009-05-21 08:15:06 UTC
Still seems fairly easy, only six years since the problem was opened :-)
Comment 6 Dan Poirier 2009-07-02 07:11:30 UTC
Created attachment 23921 [details]
Replace use of shared memory with socache

Here's a first pass at replacing mod_auth_digest's use of shared memory with socache.  The changes are more pervasive than I'd like to make all at once, but the assumptions about use of shared memory went through a lot of the code.

Feedback, criticism, suggestions for improvement welcome.
Comment 7 Dan Poirier 2009-08-26 11:30:11 UTC
Instead of completely re-writing it, I fixed the shared memory,
rmm, and lock usage problems that have been reported or that I
came across while fixing those.

Fixed in trunk rev 808150
Comment 8 Eric Covener 2013-05-30 14:47:34 UTC
Fixed as far back as anyone is probably willing to go (fixed in trunk before 2.4.x branch)
Comment 9 Christophe JAILLET 2014-08-10 06:54:01 UTC
Also see PR51711 ?
Comment 10 William A. Rowe Jr. 2016-12-20 21:42:02 UTC
Users applying this patch to earlier 2.0/2.2 sources should be aware of
r1773069 correcting CVE-2016-2161 - a defect exposed by enabling shm
(which seems to have been effectively impossible before this fix.)