Re: generic uaccess.h

From: Arnd Bergmann
Date: Mon Jul 27 2009 - 14:18:44 EST


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 <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/