#include <errno.h>
int getpath (int pid, int *array, int size) {
long __res;
__asm__ volatile (
"movl $243, %%eax;"
"movl %1, %%ebx;"
"movl %2, %%ecx;"
"movl %3, %%edx;"
"int $0x80;"
"movl %%eax, %0"
: "=m" (__res)
: "m" (pid), "m" ((long)array), "m" (size)
: "%eax", "%ebx", "%ecx", "%edx"
);
if ((unsigned long)(__res)>=(unsigned long)(-125)) {
errno = -(__res);
__res = -1;
}
return (int)(__res);
}
As you can see I pass a pointer to an int array, named array.
I need to verify inside sys_getpath (which the interrupt will call) if the pointer of the array, passed to it as a parameter, doesnt belong to the calling process address space.
How do I check this?
Is there a specific function/macro that does that?
Please help.
Thanks in advance.
Detecting invalid pointer in system call of calling process
I have the following wrapper code:
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
I have found __adr_ok and __range_ok inside uaccess.h, but I need some reference on those.
Where can I find reference for these two macros?
Where can I find reference for these two macros?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
The specific rules for how each UNIX kernel does argument checking vary by what flavor of UNIX you're using. Is it Solaris? Linux? FreeBSD? NetBSD? Your own?
Also, for kernel development, I suggest asking the kernel development list for the flavor you're using, as those typically have more kernel hackers on them than this particular forum (although we get 'em here, too :-)
Also, for kernel development, I suggest asking the kernel development list for the flavor you're using, as those typically have more kernel hackers on them than this particular forum (although we get 'em here, too :-)
enum Bool { True, False, FileNotFound };
Quote: Original post by hplus0603
The specific rules for how each UNIX kernel does argument checking vary by what flavor of UNIX you're using. Is it Solaris? Linux? FreeBSD? NetBSD? Your own?
Also, for kernel development, I suggest asking the kernel development list for the flavor you're using, as those typically have more kernel hackers on them than this particular forum (although we get 'em here, too :-)
What is the kernel developer list?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:
Original post by Toolmaker
Quote:
Original post by The C modest godHow is my improoved signature?It sucks, just like you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement