You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2013/06/11 17:24:43 UTC

[Bug 55091] New: DBD, DBM and DSO initialisation variables not properly resetted

https://issues.apache.org/bugzilla/show_bug.cgi?id=55091

            Bug ID: 55091
           Summary: DBD, DBM and DSO initialisation variables not properly
                    resetted
           Product: APR
           Version: HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR-util
          Assignee: bugs@apr.apache.org
          Reporter: rgacogne+asf@aquaray.com

Created attachment 30425
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30425&action=edit
Properly reset DBD, DBM and DSO initialisation variables when the associated
pool is cleared.

Hi,

In apu_dso_init() (apu_dso.c:78), apr_dbd_init() (apr_dbd.c:94) and
dbm_open_type() (apr_dbm.c:122) a static variable named "initialised" is set to
1 during the first call in order to only initialise resources once.

The respective pointers to these resources are set to NULL when the associated
pool is cleaned, in apu_dso_term(), apr_dbd_term() and dbm_term(), with a
comment indicating that it is done "so init can work again".
Unfortunately, the "initialised" variable is not set to 0 in these functions,
and a new call to apu_dso_init(), apr_dbd_init() or dbm_open_type() results in
uninitialised resources and potential segfaults.

For example, calling apr_dbd_init(), apr_dbd_get_driver(), cleaning the
associated pool then later calling apr_dbd_init() and apr_dbd_get_driver()
again results in a SIGSEGV, as the "mutex" resource is NULL :

==6025== Invalid read of size 4
==6025==    at 0x6D42CA4: pthread_mutex_lock (in /usr/lib/libpthread-2.17.so)
==6025==    by 0x547529F: apu_dso_mutex_lock (apu_dso.c:44)
==6025==    by 0x5465BD9: apr_dbd_get_driver (apr_dbd.c:165)
[...]
==6025==  Address 0x18 is not stack'd, malloc'd or (recently) free'd

The attached patch for the APR trunk resets the "initialised" static variables
to 0 when the relevant pool is cleared.

Regards,

Remi Gacogne
Aqua Ray SAS

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 55091] [PATCH] DBD, DBM and DSO initialisation variables not properly resetted

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55091

Remi Gacogne <rg...@aquaray.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DBD, DBM and DSO            |[PATCH] DBD, DBM and DSO
                   |initialisation variables    |initialisation variables
                   |not properly resetted       |not properly resetted

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org