cap_ptrace_access_check undefined

2012-03-19 Thread Joxean Koret
Hi all!

I'm writing a kernel module that needs to check if the current process
is attached (via ptrace) to some other process. So I do something like
this:

...
  // verify pid
  p = find_vpid(child_pid);
  if ( p == NULL )
...
  // get the task
  task = pid_task(p, PIDTYPE_PID);
  if ( task == NULL )
..
  // check ptrace privs
  int ret = cap_ptrace_access_check(task, PTRACE_MODE_READ);

When compiling it generates an error:

WARNING: cap_ptrace_access_check [$PATH/$MOD.ko] undefined!

I tried with ptrace_access_check, ptrace_may_check,
security_ptrace_access_check, ptrace_may_access, etc... but none of them
works for me. I'm building the module against a 2.6.35 kernel.

Any idea about what am I doing wrong?

Thanks in advance!
Joxean Koret



signature.asc
Description: This is a digitally signed message part
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to use uio_pci_generic driver.

2012-03-19 Thread Dmitriy Tochansky
Hello!
I have a problem writing application using uio subsystem.
As described at
http://www.kernel.org/doc/htmldocs/uio-howto.html#uio_pci_generic, I bind
my device to uio. Files in /sys/class/uio/uio0/ appears, dmesg say no
problems.
But when I trying to mmap regions of device file
/sys/class/uio/uio0/.../mapX not created.
A mmap part of code:

uint32_t UioMap(int devnum, int map_num)
{
char *u = (char *) calloc(64, 1);
sprintf(u, /sys/class/uio/uio%d/device/resource%d, devnum, map_num);
int fd = open(u, O_RDONLY);
if(fd  0)
{
fprintf(stderr,Error on open!\n);
return NULL;
}
else fprintf(stderr,fd = %d\n, fd);
void* map_addr = mmap(NULL,
0x80,
PROT_READ,
MAP_SHARED,
fd,
map_num * getpagesize());
if(map_addr == MAP_FAILED)
{
perror(mmap);
}
free(u);
return (uint32_t *) map_addr;
}

Is there any examples of usage uio_pci_generic in realworld?

-- 
Dmitriy
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Question about JUMP and LINK

2012-03-19 Thread bill4carson


On 2012年03月16日 23:23, Dave Hylands wrote:
 Hi Bill,

 On Thu, Mar 15, 2012 at 11:52 PM, bill4carsonbill4car...@gmail.com  wrote:
 Hi, All

 The question is simple.

 func_a {

 call func_b
 }

 func_b {

 call func_c
 }

 func_c {

 return to func_a
 }


 The compiler I use let func_c to return func_a directly, IOW when func_b
 calls func_c, it use JUMP, other JUMP and LINK, and it's definitely not
 a question about inline or noinline.

 So can I ask why how to let the compiler use JUMP and LINK when func_b
 calls func_c?

 This is called Tail Optimization. See
 http://c2.com/cgi/wiki?TailCallOptimization

 gcc (I'm using 4.4.4) with -O3 does this.

Thanks for the information.


 If it's not the right place to post this, sorry for the noise.

 The kernel newbies list is probably not the right place (since this
 has nothing to do with the kernel). It also has nothing to do with
 binutils. It's a gcc optimization, so picking a gcc list would
 probably be more appropriate.


-- 
I am a slow learner
but I will keep trying to fight for my dreams!

--bill

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies