Re: access_ok inside kernelspace -- part II --

Alan Cox (alan@lxorguk.ukuu.org.uk)
Thu, 21 Oct 1999 16:05:08 +0100 (BST)


> work for, by using set_fs()/get_fs() to be able to call sys_open(),
> sys_write(), sys_read() and sys_close.=20
> At the beginning all seems ok, but after unloading at some time I get
> segmantation faults. The seq. faults came from processes like sendmail o=
> r
> cron, and I wandered why.=20

It normally means your driver scribbled on memory it didnt own.

> I have to say, that my driver is programmed in C++ and I created a Class =
> for
> FileAccess. To be sure that it has nothing to do with C++ I wrote a litle

be very careful not to put too much on the stack, also remember that
new/delete need their own helpers in kernel space and exceptions dont work

> An other problem is that the file descriptor cannot be createt ones and u=
> sed in
> different functions. I tryed getting the file descr. in init_module with

You can't use file descriptors easily in kernel space. Unless you are doing
accesses specifically in one process context you will cause grief

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/