On Sat, Aug 29, 2009 at 9:49 AM, Manish Katiyar<mkati...@gmail.com> wrote:
> Hi,
>
> I am trying to write a module in which I have an ioctl through which I
> pass a userspace structure. The handler for the ioctl looks like
> below.
>
> 203 int
> 204 ohsm_enable(unsigned long arg)
> 205 {
> 206
> 207   int ret = 0;
> 208   struct ohsm_instance *instance;
> 209   struct ohsm_userspace ohsm_user_info;
> 210
> 211   if (copy_from_user((void *)&ohsm_user_info,
> 212                 (struct ohsm_userspace __user *)arg,
> sizeof(ohsm_user_info)))
> 213         return -EFAULT;
> 214
> 215   return 0;
>
> But this crashes every time and UML gets killed with memory fault. Are
> there any known issues with UML and copy_from_user ?? Any guesses what
> could be going wrong ?? I am not able to put a breakpoint in
> copy_from_user() because it gets called way too much of time.

No clue...

What happens if you try access_ok(VERIFY_READ, ..) before using the
"user space" pointer?

What does it return?

http://oss.org.cn/ossdocs/gnu_linux/kernel-api/r4122.html

I know copy_from_user does some checks...

You should also PRINTK the pointer (%p) in the module and compare it
with the pointer you send from the userspace program...

Nelson.-

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to