public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: monstr@monstr.eu
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	LTP <ltp-list@lists.sourceforge.net>
Subject: Re: access_ok macor
Date: Tue, 14 Jul 2009 15:21:47 +0200	[thread overview]
Message-ID: <200907141521.47719.arnd@arndb.de> (raw)
In-Reply-To: <4A5C8068.6020203@monstr.eu>

On Tuesday 14 July 2009, Michal Simek wrote:
> I found that I can setup text base in binutils/ld/emulparam/elf32mb_linux.sh
> 
> The problem which I have is that if I run socketpair, getsockname, getpeername LTP
> tests with invalid salen pointer there are addresses close to 0x0. Microblaze
> has no text there and the sigsegv fault is generated.

This sounds like a classic NULL pointer dereference that is handled correctly
by the kernel. The question is where the address came from.

> This fault could be fixed by changed access_ok macro where I check bottom limit
> at 0x1000 0000 too. After this change the LTP program not failed but I am not sure
> if is the right solution because none arch do it. All archs just check upper limit
> not lower.
> 
> What is the correct solution for it? Moving .text base to 0x0 or is there any other
> elegant solution?

Moving .text is not the right solution, because it only papers over real bugs.
access_ok() is also not the right place to check this, the only purpose it has
is to make sure that the argument is not a valid kernel address but either a
valid user address or possibly invalid address. Also, access_ok() is only used
together with the copy_from/to_user and get/put_user function families. These
need to catch invalid addresses with a fixup table entry in the kernel.

I briefly looked at your implementation but could not find any problems in
this area. Could you use gdb to find out whether the sigsegv happens in the
kernel at all, or in user space?

	Arnd <><

  reply	other threads:[~2009-07-14 13:22 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 [this message]
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

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=200907141521.47719.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=monstr@monstr.eu \
    /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