public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: John Williams <jwilliams@itee.uq.edu.au>,
	monstr@monstr.eu,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	LTP <ltp-list@lists.sourceforge.net>
Subject: Re: access_ok macor
Date: Wed, 15 Jul 2009 15:27:07 +0200	[thread overview]
Message-ID: <200907151527.08341.arnd@arndb.de> (raw)
In-Reply-To: <20090715120512.GA2752@linux-mips.org>

On Wednesday 15 July 2009, Ralf Baechle wrote:
 
> > I think in step 4. AFIACT, the kernel must do a number of checks on accesses
> > to random pointers.
>
> Yes; but the checks that unaligned.c does on MIPS are no different from
> any other get_user(), that is it ensures that the entire 8/16/32/64-bit
> access is in userspace.  That's done using access_ok().

Well, access_ok() plus the fixup code for unmapped or write-protected user
pages, I guess. But I agree, there are no checks beyond what get/put_user
does. In particular, the access_ok() check should only be needed for
faults from user space, while any fault coming from kernel space is
either some kernel code accessing its own data (as you mention below) or
a __get_user/__put_user that has already checked access permissions.

In my example, I got the case from kernel space wrong, it should not
check access_ok() if !user_space(regs), or it needs to do set_fs(KERNEL_DS)
first, like the mips code does.

> We've moved on.  Handling miss-alignment is no longer a very relavent part
> of the syscall interface.  So I think for the definition of the Linux
> ABI this should just be left as implementation defined behaviour but
> whatever an architecture does, it should be done consistently for all
> system interfaces.

Ok, thanks, for explanation.

I guess for the microblaze unaligned handler, both cases mean that
it needs to do a fixup table lookup for the original fault and
it needs to handle fixups on its own emulation code. The only difference
between disallowing unaligned accesses in the ABI and allowing them
is which of the two ways (check fixup table, emulate instruction) it
tries first.

	Arnd <><

      reply	other threads:[~2009-07-15 13:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 12:56 access_ok macor Michal Simek
2009-07-14 13:21 ` Arnd Bergmann
2009-07-14 13:45   ` Michal Simek
2009-07-14 14:45     ` Arnd Bergmann
2009-07-14 15:06       ` Michal Simek
     [not found] ` <200907141652.59049.arnd@arndb.de>
     [not found]   ` <4A5CAEFF.9080206@monstr.eu>
2009-07-14 16:43     ` Arnd Bergmann
2009-07-14 16:56       ` Michal Simek
2009-07-14 17:13         ` Arnd Bergmann
2009-07-14 17:45           ` Michal Simek
2009-07-15  9:21           ` Paul Mundt
2009-07-15 10:03             ` Michal Simek
     [not found]       ` <9e6f3dfd0907141811p512b4edp3f9dd0fdeae1123e@mail.gmail.com>
2009-07-15 10:14         ` Arnd Bergmann
2009-07-15 11:39           ` Michal Simek
2009-07-15 12:05           ` Ralf Baechle
2009-07-15 13:27             ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200907151527.08341.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=jwilliams@itee.uq.edu.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=monstr@monstr.eu \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox