On 14-Oct-2003 Kiran Kumar wrote: > --- Pedro Bados <pedrobados@eresmas.net> wrote: >> - "current>uid" is always 1 indepently the process >> uid (current->euid works!) >> >> - "current->user" is always NULL. >> >> - "current->files" pointer seems ok but even after >> having an open socket, >> (intercepting sys_connect), the >> "current->files->fd[fd]" remains NULL. > > Could you post your full code, that might help find > the issue. Sure, here it goes a simple non-working example: int my_socketcall(int call,unsigned long *args){ #define nargs 3*sizeof(unsigned long) struct sockaddr saddr; unsigned long my_arg[nargs]; /* Same wrong results using current directly */ struct task_struct* curr=get_current(); if (call==SYS_CONNECT){ if (copy_from_user(my_arg,args,nargs)) { printk("Error copying arguments\n"); goto end; } if(copy_from_user(&saddr, \ (struct sockaddr*) my_arg[1],\ sizeof(struct sockaddr))) { printk("Error copying sockaddr\n"); goto end; } if((family=(unsigned int)saddr.sa_family)==PF_INET) printk("<0>uid:%d puser:%p pfile:%p",\ curr->uid,curr->user,curr->files->fd); } end: return old_socketcall(call,args); } --EOF I get : "uid:0 puser:00000000 pfile:0000000x" for any user. Since x is a small integer value as 1 or 2 instead of a proper pointer, attempting to read curr->files->fd[my_arg[0]] produces a violation. Thanks a lot. Best regards. Pedro. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/