[krbdev.mit.edu #8651] kinit -kt KDB: Cannot find/read stored master key

Greg Hudson via RT rt-comment at KRBDEV-PROD-APP-1.mit.edu
Sun Mar 18 16:05:25 EDT 2018


The profile library is designed to automatically pick up changes to 
the profile each time a profile_get_* call is made.  This feature is 
of dubious usefulness, because our code base is inconsistent about 
how long it caches profile results for, but I've been reluctant to 
simplify it out.

To do this, it calls stat() and compares the mtime to the mtime from 
the previous stat() result.  It does compare fractional timestamps, 
so you would think the double-read would happen all the time (since 
stat() on /dev/fd/NN appears to just give the current time).  
However, there is also a guard against issuing too many stat() system 
calls; at prof_file.c:316 we compare the current time to the last 
time we read the filed or called stat(), and only issue a new stat() 
call if the second has ticked over.

So I think in your scenario a failure only happens if the second 
ticks over between the initial profile open and the profile read to 
get the stash filename.

I think we could fix this scenario from our side by disabling the 
stat-and-reread behavior for things that aren't regular files as 
determined by S_ISREG().  From your side, you could of course work 
around the issue by using a regular file.


More information about the krb5-bugs mailing list