RE: Why system call need to copy the date from the userspace before using it

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

 



> Catalin Marinas wrote:

> >Tomko <[email protected]> wrote:

> >>Inside the system call , the kernel often copy the data by calling
> >>copy_from_user() rather than just using strcpy(), is it because the
> >>memory mapping in kenel space is different from user space?

> >No, it is because this function checks whether the access to the user
> >space address is OK. There are situations when it can also sleep (page
> >not present).

> what u means "OK"?  kernel space should have right to access any memory
> address , can u expained in details what u means "OK"?

	Kernel space does have the right to access any memory but user space
doesn't, so the kernel can't just take an address from user space and use
it. Consider:

int i=open("/dev/null", O_RDWR);
write(i, NULL, 4);

	Are you seriously suggesting the kernel should just read from address zero
because a user-space program asked it to?

	DS


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux