Я пишу простой код LSM в версии ядра 3.14.17.Ошибка register_security undefined
Код сниппета:
#include <linux/module.h> // included for all kernel modules
#include <linux/kernel.h> // included for KERN_INFO
#include <linux/init.h> // included for __init and __exit macros
#include <linux/security.h>
#include <linux/tracehook.h>
static int blabbermouth_inode_alloc_security(struct inode *inode)
{
return 0;
}
static void blabbermouth_inode_free_security(struct inode *inode)
{
}
static struct security_operations blabbermouth_ops = {
.inode_alloc_security = blabbermouth_inode_alloc_security,
.inode_free_security = blabbermouth_inode_free_security,
};
static int __init hello_init(void)
{
if (register_security(&blabbermouth_ops))
panic("blabbermouth: Unable to register blabbermouth with kernel.\n");
else
printk("blabbermouth: registered with the kernel\n");
return 0;
}
static void __exit hello_cleanup(void)
{
printk("Exit \n");
return;
}
module_init(hello_init);
module_exit(hello_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Lakshmanan");
MODULE_DESCRIPTION("A Simple Hello World module");
Выход:
register_security неопределенного
Я понятие не имею, почему он показывает register_security не определен? Любые предложения, как я могу использовать register_security. Примечание: Я не хочу, чтобы редактировать существующие заголовки ядра, как security.h
Кажется, что LSMs запекаются в ядро, и вы не можете их менять. Другими словами, вы не можете просто написать для него модуль. – tangrs