TASK_SIZE related query.

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

 



hi all,

this code is from namei.c -> do_getname which is called from getname()
--> which is from sys_open()..

static inline int do_getname(const char *filename, char *page)
{
 int retval;
 unsigned long len = PATH_MAX;

 if ((unsigned long) filename >= TASK_SIZE) {
  if (!segment_eq(get_fs(), KERNEL_DS))
   return -EFAULT;

Here , TASK_SIZE has been #defined as :

#define TASK_SIZE            (PAGE_OFFSET)

and PAGE_OFFSET as :

#define PAGE_OFFSET      ((unsigned long)__PAGE_OFFSET)

/*
 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
 * a virtual address space of one gigabyte, which limits the
 * amount of physical memory you can use to about 950MB.
 *
  */

#define __PAGE_OFFSET  (0xC0000000)

Now, refering to the code above :
if ((unsigned long) filename >= TASK_SIZE)

why is this if() for ?
and why is it checking  filename >= TASK_SIZE  ?

i beleive filename is still in userspace right ?  is it checking for the
same ?
and also please explain what this TASK_SIZE stands for - i'am confused.

cheers,
Amith


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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