spdm: Limit memory consumed by log of received signatures
The SPDM library has just been amended to keep a log of received
signatures and expose it in sysfs.
Limit the log's memory footprint subject to a sysctl parameter. Purge
old signatures when adding a new signature which causes the limit to be
exceeded. Likewise purge old signatures when the sysctl parameter is
reduced.
The latter requires keeping a list of all struct spdm_state and
protecting it with a mutex. It will come in handy when further global
sysctl parameters are added to the SPDM library. Unfortunately an
xarray is not a better option in this case as the xarray-integrated
xa_lock() is a spinlock but purging signatures from sysfs may sleep
(due to kernfs_rwsem).
This functionality is introduced in a separate commit on top of basic
signature exposure to split the code into digestible, reviewable chunks.
Signed-off-by: Lukas Wunner <lukas@wunner.de>
7 files changed