xsm: move FLASK_AVC_STATS to Kconfig

Have Kconfig set CONFIG_FLASK_AVC_STATS and prefix all uses with CONFIG_
to use the Kconfig variable.

Note that will preserve the original behavior - which is that you
cannot disable FLASK_AVC_STATS. Enterprising users can disable
it without any compilation issues.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
This commit is contained in:
Doug Goldstein authored and Konrad Rzeszutek Wilk committed 2016-03-25 11:37:31 -04:00
1 parent 0640eaf552
commit a67e68c631
5 files changed
+11 -10

No files matched your search

+6
View File
@@ -23,6 +23,12 @@ config FLASK
If unsure, say N.
config FLASK_AVC_STATS
def_bool y
depends on FLASK
---help---
Maintain statistics on the access vector cache
# Select HAS_DEVICE_TREE if device tree is supported
config HAS_DEVICE_TREE
bool
-5
View File
@@ -78,11 +78,6 @@
#define __STR(...) #__VA_ARGS__
#define STR(...) __STR(__VA_ARGS__)
#ifdef CONFIG_FLASK
/* Maintain statistics on the access vector cache */
#define FLASK_AVC_STATS 1
#endif
/* allow existing code to work with Kconfig variable */
#define NR_CPUS CONFIG_NR_CPUS
+2 -2
View File
@@ -56,7 +56,7 @@ const struct selinux_class_perm selinux_class_perm = {
#define AVC_DEF_CACHE_THRESHOLD 512
#define AVC_CACHE_RECLAIM 16
#ifdef FLASK_AVC_STATS
#ifdef CONFIG_FLASK_AVC_STATS
#define avc_cache_stats_incr(field) \
do { \
__get_cpu_var(avc_cache_stats).field++; \
@@ -101,7 +101,7 @@ struct avc_callback_node {
/* Exported via Flask hypercall */
unsigned int avc_cache_threshold = AVC_DEF_CACHE_THRESHOLD;
#ifdef FLASK_AVC_STATS
#ifdef CONFIG_FLASK_AVC_STATS
DEFINE_PER_CPU(struct avc_cache_stats, avc_cache_stats);
#endif
+2 -2
View File
@@ -469,7 +469,7 @@ static int flask_security_make_bools(void)
return ret;
}
#ifdef FLASK_AVC_STATS
#ifdef CONFIG_FLASK_AVC_STATS
static int flask_security_avc_cachestats(struct xen_flask_cache_stats *arg)
{
@@ -761,7 +761,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op)
rv = avc_get_hash_stats(&op.u.hash_stats);
break;
#ifdef FLASK_AVC_STATS
#ifdef CONFIG_FLASK_AVC_STATS
case FLASK_AVC_CACHESTATS:
rv = flask_security_avc_cachestats(&op.u.cache_stats);
break;
+1 -1
View File
@@ -108,7 +108,7 @@ struct xen_flask_hash_stats;
int avc_get_hash_stats(struct xen_flask_hash_stats *arg);
extern unsigned int avc_cache_threshold;
#ifdef FLASK_AVC_STATS
#ifdef CONFIG_FLASK_AVC_STATS
DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats);
#endif
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.