Zelta
Zelta

Reputation: 764

Linux kernel module configuration

For my university project I'm doing a module which will allow or disallow a process to perform a system calls (e. g. A little loadable selinux). For now I nave code that controls syscalls. For each process I store a link to the structure which contains permissions config. However, now I've just hardcoded two configs: one is default (allow all) and another one is to allow everything except opening '/testfile'.

My question is how to load configs dynamically?

I have a parser for config files but I've read that accessing files from the kernel is bad idea.

How should I store configs and how should I load them?

Upvotes: 0

Views: 404

Answers (1)

Tsyvarev
Tsyvarev

Reputation: 65860

I've read that reading files from the kernel is bad idea

Description of filp_open function in the kernel sources says:

This is the helper to open a file from kernelspace if you really have to. But in generally you should not do this, so please move along, nothing to see here..

So, if you need to load/store content of the file into/from the kernel module, then do that. But use appropriate functions, as described in that question.

Upvotes: 1

Related Questions