if (__glibc_unlikely (do_audit))
{
struct link_map *head = ns->_ns_loaded;
- /* Do not call the functions for any auditing object. */
- if (head->l_auditing == 0)
+ /* If head is NULL, the namespace has become empty, and the
+ audit interface does not give us a way to signal
+ LA_ACT_CONSISTENT for it because the first loaded module is
+ used to identify the namespace.
+
+ Furthermore, do not notify auditors of the cleanup of a
+ failed audit module loading attempt. */
+ if (head != NULL && head->l_auditing == 0)
{
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)