Samba 3.6.4 tdb question

Rusty Russell rusty at rustcorp.com.au
Tue Jun 19 20:38:06 MDT 2012


On Tue, 19 Jun 2012 10:31:05 -0700, Herb Lewis <hlewis at panasas.com> wrote:
> The file lib/tdb/common/tdb.c has a comment before the function 
> tdb_parse_record
> 
> * DON'T CALL OTHER TDB CALLS FROM THE PARSER, THIS MIGHT LEAD TO SEGFAULTS.
> 
> can someone explain exactly what this means? Exactly what calls are not 
> allowed?

Hi Herb,

        Thanks for the bug report.  Any call which touches the database
can trigger a remap (and hence a segfault).

Obviously adding a new record could extend the database, but a simple
fetch could traverse a record outside our current mmap, which will cause
a remap.

We should fail any db access attempts from parse_record, to catch this
case, since it will *usually* work fine and thus the bug is quite
subtle.

> I've run into a case where I get a segfault because tdb_parse_record 
> ends up calling
> tdb_lock_list which then calls tdb_needs_recovery which tries to do a 
> tdb_read which
> then gets a segfault. So it looks like I've hit this condition.

Something is badly wrong here then!

tdb_parse_record already holds a lock, so tdb_lock_list won't check the
database.

Please post the actual backtrace so we can see how this happened.

Thanks,
Rusty.


More information about the samba-technical mailing list