ioctl, copy string from user

Ryan Stone rysto32 at gmail.com
Thu Apr 29 21:19:48 UTC 2010


> Apparently I need to tell ioctl how big is the variable I am
> providing to it ([MAXLEN]). The odd thing is, when I have a structure
> like this:
>
> struct lrfs_attach_info {
>        char *name;
>        int priority;
> };
>
> and I pass the pointer to that structure to the ioctl, it just
> works. I can even use the 'name' string from the structure without
> any problems, apparently it translates the pointer properly, but I
> did not expect this...

I think that you'll find that what actually happens is that you're
reading from the userspace pointer.  That will work as long as the
pointer is mapped, but you'll panic if what it points to gets swapped
out or is invalid.


More information about the freebsd-hackers mailing list