This content has been marked as final. Show 6 replies
Can you post your code where you access the user-space address? In general, you should be using ddi_copyin()/ddi_copyout() to copy the data between kernel- and user-space buffers.
This thread has been moved from the General Solaris 10 Discussion subforum,
to the Driver Development subforum, for closer topic alignment.
hi actually i am not using ddi_copyin or out.
i read the man for ddi_copyin but couldnt find to how to match parameters of read/write entry points, e.g struct uio to ddi_copyin.
for pwrite i am using uiomove to copy user data to kernel space, then copy data to device by ddi_put32. and for pread i am using the opposite way.
uiomove is the point where kernel panics i guess.
i tried uwritec and ureadc instead of uiomove nothing different...
This warning from the uiomove() man page seems relevant:
If uio_segflg is set to UIO_SYSSPACE and address is selected
from user space, the system may panic.
no actually that is not the case. in my seg_flg is UIO_USERSPACE which is set by system(transfer between user and kernel). no conflict on that. the problem is if user space buffer is an invalid address uiomove panics system.
i guess nothing to do with that. i will have to rewrite my read/write over ioctl entry point and hope that ddi_copyin/out wont panic the kernel. or just live with that weird situation and be careful while calling pread/pwrite on application side :)
ok problem solved. problem was nothing to do with wrong address. apparently my driver mistakenly re-call mutex_exıt and kernel panic for that matter.
i have related question. for passing data to kernel space i tried uiomove and ddi_copyin and saw that ddi_copyin is much more slower than uimove (20 microsecond vs 150 microsecond). Is this normal?