/* * Flag to indicate whether a key can be processed * right away or should be queued for processing later.
*/ staticbool ima_process_keys;
/* * To synchronize access to the list of keys that need to be measured
*/ static DEFINE_MUTEX(ima_keys_lock); static LIST_HEAD(ima_keys);
/* * If custom IMA policy is not loaded then keys queued up * for measurement should be freed. This worker is used * for handling this scenario.
*/ staticlong ima_key_queue_timeout = 300000; /* 5 Minutes */ staticvoid ima_keys_handler(struct work_struct *work); static DECLARE_DELAYED_WORK(ima_keys_delayed_work, ima_keys_handler); staticbool timer_expired;
/* * This worker function frees keys that may still be * queued up in case custom IMA policy was not loaded.
*/ staticvoid ima_keys_handler(struct work_struct *work)
{
timer_expired = true;
ima_process_queued_keys();
}
/* * This function sets up a worker to free queued keys in case * custom IMA policy was never loaded.
*/ void ima_init_key_queue(void)
{
schedule_delayed_work(&ima_keys_delayed_work,
msecs_to_jiffies(ima_key_queue_timeout));
}
/* * ima_process_queued_keys() - process keys queued for measurement * * This function sets ima_process_keys to true and processes queued keys. * From here on keys will be processed right away (not queued).
*/ void ima_process_queued_keys(void)
{ struct ima_key_entry *entry, *tmp; bool process = false;
if (ima_process_keys) return;
/* * Since ima_process_keys is set to true, any new key will be * processed immediately and not be queued to ima_keys list. * First one setting the ima_process_keys flag to true will * process the queued keys.
*/
mutex_lock(&ima_keys_lock); if (!ima_process_keys) {
ima_process_keys = true;
process = true;
}
mutex_unlock(&ima_keys_lock);
if (!process) return;
if (!timer_expired)
cancel_delayed_work_sync(&ima_keys_delayed_work);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.