tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GPIO revisited

Am 19.07.2009 um 15:36 schrieb Elad Efrat:

On Sun, Jul 19, 2009 at 4:31 PM, Marc Balmer<> wrote:

For (a), this is the relevant diff: (gpio.c)

+       cred = kauth_cred_get();
+ pinset = kauth_authorize_device(cred, KAUTH_DEVICE_GPIO_PINSET,
+           NULL, NULL, NULL, NULL) == KAUTH_RESULT_ALLOW ? 1 : 0;


There is no caching at all, kauth_authorize_device is called for every
ioctl() call.

You authorize an action when you are performing that action.

That is what the code does.

Looking at the above it seems that you call kauth_authorize_device()
once and save its return value in "piset", and then refer to the
latter when deciding if to continue or return EPERM or such. But maybe
you fixed that and forgot to upload a newer version...? :)

of course. for every ioctl I call kauth, i just do it a few cpu cycles before the action. I see no problem with this.



Home | Main Index | Thread Index | Old Index