Re: does access_ok() even care about the READ/WRITE type anymore?

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

 



On Tue, Sep 22, 2009 at 3:36 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
>
>  as a followup to my earlier note, i was checking on the
> implementation of the access_ok() routine which checks the validity of
> user-space access from the kernel and, for x86_64, it's defined as:
>
> #define access_ok(type, addr, size) \
>   (likely(__range_not_ok(addr, size) == 0))
>
> as you can see, the "type" arg is unused in the macro definition, and
> that's normally where you would expect to find either VERIFY_READ or
> VERIFY_WRITE.
>
>  i perused that macro for all other architectures and it seems that
> that first argument is entirely unused these days.  is that just
> historical leftovers?  or am i missing something?

I am confused too and I just realized that after reading your posting.

I could only guess that whoever write this access_ok() for x86 thinks
or assumes that most of the time, the user space program rarely do
write protection on its allocated memory area. So to shorten the code,
it simply focus whether the accessor access a valid address.

Or probably in the past it is decided that the coder must implement
his/her own logic to deal with write protected user space memory area
-- 
regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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