sysfs: pass function pointers to kernel (not just a value through attribute)
Yann Droneaud
ydroneaud at opteya.com
Mon Dec 17 10:32:13 EST 2012
Le lundi 17 décembre 2012 à 10:11 -0500, Terry Hsu a écrit :
> Hello everyone,
>
>
> I am looking for some mechanism for userspace tasks to pass certain
> functions to kernel and let the kernel execute these functions on
> behalf of userspace tasks. I know that sysfs can be used with kobject
> embedded into internal kernel structure to access kernel variables.
> But is there anyway for userspace tasks to pass a function to kernel
> to execute through sysfs?
>
>From a security point of view: what a crazy idea !
And difficult to implement as you described it:
A pointer to userspace is of no interest for the kernel.
A pointer to userspace memory is tied the process that "generate" it.
So without any reference to the process, a pointer has no meaning for
the kernel.
Then, this pointer must point to something, eg. what's going to happen
when your process exit while the kernel is going to execute code on its
behalf ...
>
> PS: adding syscall in the kernel can certainly satisfy my needs but it
> is less favorable because the new kernel service I want to add is not
> that general to be added as a new syscall.
>
You might want to describe the problem you're trying to fix or at least
a use case.
Regards.
--
Yann Droneaud
OPTEYA
More information about the Kernelnewbies
mailing list