Re: kmod fix ... ksystem()

Jacques Gelinas (jack@solucorp.qc.ca)
Thu, 12 Mar 1998 15:38:40 -0500 (EST)


On Thu, 12 Mar 1998, Kirk Petersen wrote:

> > > Now, anyone know how correct the above analysis is? I didn't
> > > have a chance to look at the "offending" modules much (but will certainly
> > > be doing that tonight).
> >
> > With kerneld, we had the ability to do ksystem() from a module. Have we
> > lost this ability ?
>
> Well, ksystem() passed a message to kerneld, so yes, we lost this
> ability. Now, could someone tell me what ksystem() did? I did a search
> through 2.1.89 and nothing used it. I read through the kerneld source
> (because all ksystem() did was pass a message to kerneld) and it didn't
> help much.

ksystem does the equivalent of the libc system() in the kernel. It allows
a driver to trigger something if needed. This has not been used in any
official module I know. But I feel it is a valuable feature. For example,
I had in mind a concept of "super" device such as a generic /dev/modem. On
one side, you have a client (say minicom) which open /dev/modem and this
load the super driver which does a request using ksystem to a system
utility which will locate an available modem (either locally, or on the
net using some remote serial software available for linux) and instruct
the super driver to establish the link.

The only other way to achieve this kind of service is by using a daemon
which open a connection to the super driver and wait for some request.
Annoying to have all these daemons waiting and having to preload them at
boot time.

Personnally, I have used ksystem() to do a prototype of "Just in time"
debugging. ksystem() was hook in the logic that handle core dump.
Basically, a ksystem() call is done to a utility which is finding out if a
this process is candidate to JITD by looking at the environnement
variables of the dying process. If the process is candidate, it starts gdb
or whatever debugger specified in the environnent variable (well for sure
there are security issue related to that).

If the process is not candidate to JITD, it just return a failure to the
kernel which continue with the core dump logic.

ksystem() inserted only 3-4 lines in the kernel to achieve this
functionnality and there were no need for a listening daemon.

I never completed this project though. Some may argue that a completly
userland solution is possible for this project. Not sure!

So this is the kind of things you can do with ksystem().

--------------------------------------------------------
Jacques Gelinas (jacques@solucorp.qc.ca)
Linuxconf: The ultimate administration system for Linux.
see http://www.solucorp.qc.ca/linuxconf
new developments: remote GUI admin, multiple machines admin, wu-ftpd

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu