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 Thu, 24 Sep 2009, Mulyadi Santosa wrote:

> 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

  but note that this isn't just for x86.  i did a scan of the whole
tree, and i didn't find a single architecture that checked that first
argument.  at least not anymore.  unless i somehow screwed up my
search command.

  can you tell if any arch actually checks that first arg?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

[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