Files
Ian Bridges c0b6a5b89d selinux: compute the IMA configuration settings string length once at boot
selinux_ima_collect_state() builds a string of the current SELinux
configuration settings. The string lists each setting as a name and
one digit. The length of the string therefore never changes, but is
still recomputed on every call.

Add selinux_ima_config_len_init() to compute the length once during
selinux_init(). Update selinux_ima_collect_state() to use the stored
length.

Suggested-by: Paul Moore <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ian Bridges <[email protected]>
Reviewed-by: Stephen Smalley <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
2026-07-15 21:42:01 -04:00

33 lines
695 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2021 Microsoft Corporation
*
* Author: Lakshmi Ramasubramanian ([email protected])
*
* Measure critical data structures maintained by SELinux
* using IMA subsystem.
*/
#ifndef _SELINUX_IMA_H_
#define _SELINUX_IMA_H_
#include "security.h"
#ifdef CONFIG_IMA
void __init selinux_ima_config_len_init(void);
extern void selinux_ima_measure_state(void);
extern void selinux_ima_measure_state_locked(void);
#else
static inline void selinux_ima_config_len_init(void)
{
}
static inline void selinux_ima_measure_state(void)
{
}
static inline void selinux_ima_measure_state_locked(void)
{
}
#endif
#endif /* _SELINUX_IMA_H_ */