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>,
	John Williams <john.williams@petalogix.com>
Subject: Re: generic uaccess.h
Date: Mon, 27 Jul 2009 20:18:33 +0200	[thread overview]
Message-ID: <200907272018.33516.arnd@arndb.de> (raw)
In-Reply-To: <4A6D76DB.1050902@monstr.eu>

On Monday 27 July 2009, Michal Simek wrote:
> I am getting any short write error. It is caused with adding access_ok macro.
> It is weird.

Your implementation of access_ok() is minimal, but should be ok
in theory. Note that even on nommu, it might make sense
to check for kernel addresses here and implement get_fs/set_fs,
e.g.

int access_ok(int type, unsigned long addr, size_t len)
{
	/* check wraparound */
	if (addr + len < addr)
		return 0;

	if (addr < memory_start || addr + len > memory_start)
		return 0;

	/* don't allow access to kernel memory */
	if (get_fs() == USER_DS) {
		if (is_kernel(addr) || is_kernel(addr + len))
			return 0;
	}

	return 1;
}

> I have more important work in front of me - I take a look at it later.

ok. When you get to debug this, I guess the easiest way is to stick
some printk into your access_ok() function.

	Arnd <><

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24  7:39 generic uaccess.h Michal Simek
2009-07-24  9:20 ` Arnd Bergmann
2009-07-24  9:44   ` Michal Simek
2009-07-27  9:43   ` Michal Simek
2009-07-27 18:18     ` 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=200907272018.33516.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=john.williams@petalogix.com \
    --cc=linux-kernel@vger.kernel.org \
    --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