Re: Understanding of write file operation in char driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 02 Jan 2015 07:50:55 +0530, me storage said:

> Can any one please tell me difference between kernal space & user space in
> 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 standpoint.
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 data
to an internal buffer *first*, and then validity-check the buffer - if we check
the value in userspace and then later copy it, there's a race condition where
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....

Attachment: pgpLIuz1azmyX.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux