Hey All, does somebody know of projects that use code generators to generate kernel modules? I'm thinking about using a strongly typed language like haskell with a code generator to generate kernel C-Code. I want to achieve more secure kernel modules this way. Is this a silly idea? or had someone already done that. hope for answers? greetings mosta
Hi ... On Tue, Sep 13, 2011 at 04:04, mosta <mosta.me@googlemail.com> wrote:
Hey All,
does somebody know of projects that use code generators to generate kernel modules? I'm thinking about using a strongly typed language like haskell with a code generator to generate kernel C-Code. I want to achieve more secure kernel modules this way. Is this a silly idea? or had someone already done that.
I'm not sure, but are you referring to what SystemTap uses in its "scripting"? or more over, dtrace? -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
On Mon, Sep 12, 2011 at 5:04 PM, mosta <mosta.me@googlemail.com> wrote:
Hey All,
does somebody know of projects that use code generators to generate kernel modules? I'm thinking about using a strongly typed language like haskell with a code generator to generate kernel C-Code. I want to achieve more secure kernel modules this way. Is this a silly idea? or had someone already done that.
hope for answers?
greetings mosta
I'm not aware of any code generators, but there are a few static code scanners that are routinely run against the kernel. Coverity used to be one. I don't know if they still run it or not. Also, some people run other static code analysis tools looking for optimizations or bugs. Hopefully someone else can help you out if that is related to your question. Greg
On Mon, Sep 12, 2011 at 3:04 PM, mosta <mosta.me@googlemail.com> wrote:
Hey All,
does somebody know of projects that use code generators to generate kernel modules? I'm thinking about using a strongly typed language like haskell with a code generator to generate kernel C-Code. I want to achieve more secure kernel modules this way. Is this a silly idea? or had someone already done that.
hope for answers?
So you want to write a haskell program to write source code : foo.c for a kernel module, maybe write a makefile for an out-of-tree module, then make, install that module. if you post a hello-world.ko generator, Id read the email ( haskell curiosity ) But I imagine youre looking towards more complex stuff. what advantages are you anticipating ? - correct-by-construction ? similar but different is coccinelle. it uses caml -> SmPL (the similar part) code to parse C code, looks for sequences matched by semantic patches, and rewrites that code. Its been used to find and repair numerous kernel programming errors, many with security ramifications. dozens of cocci scripts are in the kernel tree: ./scripts/coccinelle/*/*.cocci to detect newly committed errors. If security per se is your main motivation, then you should probably use coccinelle. If the haskell part is important too, maybe write an spatch generator. (Id read that too :)
participants (4)
-
Greg Freemyer -
Jim Cromie -
mosta -
Mulyadi Santosa