Thread (4 messages) 4 messages, 4 authors, 2011-09-16

Code Generator

From: jim.cromie@gmail.com (Jim Cromie)
Date: 2011-09-16 03:52:33

On Mon, Sep 12, 2011 at 3:04 PM, mosta [off-list ref] 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 :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help