avc_cache_stats(3)

✨ NAME ✨

okay bestie, say hi to avc_cache_stats, avc_av_stats, and avc_sid_stats β€” the little trio that lets you obtain userspace SELinux AVC statistics. πŸ’… This page lives in the SELinux API documentation and it's literally called avc_cache_stats(3). 🫢


🌸 SYNOPSIS 🌸

       #include <selinux/selinux.h>
       #include <selinux/avc.h>

       void avc_av_stats(void);

       void avc_sid_stats(void);

       void avc_cache_stats(struct avc_cache_stats *stats);

πŸ‘‘ DESCRIPTION πŸ‘‘

The userspace AVC maintains two internal hash tables, bestie: one to store security ID's and one to cache access decisions. ✨

avc_av_stats() and avc_sid_stats() produce log messages indicating the status of the access decision and SID tables, respectively. Those messages contain the number of entries in the table, number of hash buckets and number of buckets used, and maximum number of entries in a single bucket. πŸ’–

avc_cache_stats() populates a structure whose fields reflect cache activity:

              struct avc_cache_stats {
                  unsigned  entry_lookups;
                  unsigned  entry_hits;
                  unsigned  entry_misses;
                  unsigned  entry_discards;
                  unsigned  cav_lookups;
                  unsigned  cav_hits;
                  unsigned  cav_probes;
                  unsigned  cav_misses;
              };
  • entry_lookups β€” Number of queries made. πŸ”
  • entry_hits β€” Number of times a decision was found in the aeref argument. βœ…
  • entry_misses β€” Number of times a decision was not found in the aeref argument. ❌
  • entry_discards β€” Number of times a decision was not found in the aeref argument and the aeref argument was non-NULL. πŸ’€
  • cav_lookups β€” Number of cache lookups. πŸ‘€
  • cav_hits β€” Number of cache hits. 🎯
  • cav_misses β€” Number of cache misses. 😭
  • cav_probes β€” Number of entries examined while searching the cache. πŸ•΅οΈβ™€οΈ

πŸ’– NOTES πŸ’–

When the cache is flushed as a result of a call to avc_reset() or a policy change notification, the statistics returned by avc_cache_stats() are reset to zero. The SID table, however, is left unchanged. 🚫

When a policy change notification is received, a call to avc_av_stats() is made before the cache is flushed. ⏳


🫢 AUTHOR 🫢

Eamon Walsh <ewalsh@tycho.nsa.gov> β€” iconic. πŸ‘‘


🌈 SEE ALSO 🌈


mwah πŸ’‹ this page was served fresh on 27 May 2004, and it's literally avc_cache_stats(3) β€” periodt. ✨

πŸ“¦ where this page comes from