Understanding of write file operation in char driver
me.storage126 at gmail.com
Sat Jan 3 10:53:22 EST 2015
Thanks Valdis for your nice explanation. After practising i got another
if read from my driver as below
for this how many times read function will call because some times it is
executing only once but some times it is executing infinite times.
Like for write also
echo "hello" > /dev/myDev
for that particular call it is executing 1 or 2 times.
So can one please clarify my doubts
Thanks & Regards
On 2 January 2015 at 21:32, <Valdis.Kletnieks at vt.edu> wrote:
> On Fri, 02 Jan 2015 07:50:55 +0530, me storage said:
> > Can any one please tell me difference between kernal space & user space
> > code perspective
> Two biggies:
> 1) Kernel space pages are usually nailed down and not paging in and out,
> this is *not* true for userspace pages (so special tap-dancing in
> copy_(to/from)_user() is needed to make sure no page faults happen).
> 2) Data inside the kernel can usually be trusted from a security
> Data in userspace *MUST NOT* be trusted. Also, beware of TOCTOU (time of
> check / time of use) bugs - that's why we should copy the user-supplied
> to an internal buffer *first*, and then validity-check the buffer - if we
> the value in userspace and then later copy it, there's a race condition
> the userspace value can be changed after the check but before the copy.
> Also, keep in mind that a userspace pointer needs to be translated before
> using it to dereference data from kernel space....
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Kernelnewbies