Weird module problem.

From: airot@lazir.toya.net.pl
Date: Wed Sep 04 2002 - 12:55:00 EST


Heya,

I`ve got some weird problem in one of my linux machines. I`m writing
simple module, that should catch some syscall which isn`t too hard.
My linux kernel version is 2.2.21 without any patches. The main problem is
that whenever i call the right syscall from user, my uid is always = 0.
The current is not NULL, but all current variables are.

the code is easy, and looks like this(for example of course)

extern void *sys_call_table[];

uid_t (*o_getuid) (void)

uid_t n_getuid(void)
{
printk("User uid: %d\n", current->uid);
return o_getuid();
}

int
init_module()
{
        unsigned long flags;
        save_flags(flags);
        cli();
        o_getuid = sys_call_table[__NR_getuid];
        sys_call_table[__NR_getuid] = n_getuid;
        restore_flags(flags);
        return 0;
}

void
cleanup_module()
{
        unsigned long flags;
        save_flags(flags);
        cli();
        sys_call_table[__NR_getuid] = o_getuid;
        restore_flags(flags);
}

Basicly the above example is trivial, and should work. But it doesn`t on
my linux box. The machine is smp. The module works on every other linux
that i`ve tested(all were single processors).

Any hints about this?

Best Regards,

airot...

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



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:22 EST