[SSSD] [PATCH] mmap_cache: Check if slot and name_ptr are not invalid.

Simo Sorce simo at redhat.com
Mon Aug 5 19:30:43 UTC 2013


On Mon, 2013-08-05 at 21:13 +0200, Michal Židek wrote:
> This is very ugly hotfix for ticket:
> https://fedorahosted.org/sssd/ticket/2018
> 
> So far we were not able to find out why the slot or name_ptr
> values were corrupted, but this should at least prevent segfaults.

NACK, (but close)

Please do not add all those comments about removing checks, those checks
are good to stay forever, the cache may be corrupted by a bad disk
sector or whatever, so they should never be removed.

Also please do not just return ENOENT, and pretend nothing happened.
If the cache is corrupted we want to take immediate corrective action.
I suggest we return a new SSSD error and in the topmost nsscache caller
we invalidate the current cache and reinit.

Optional (may be should be a separate ticket)
We currently reinit by closing the file and creating a new one. We
should not do that, we should rather reset the header and then just zero
all the data and reinitialize all the various areas. The reason is that
if we have some bad bug and we keep creating new files we might run out
of space because clients may have old files open and mmapped, and unless
they perform a new operations, they may not release them. Note we should
*not* use ftruncate() here, just write the appropriate initialization
values everywhere needed.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list