lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 1 May 2009 14:36:04 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Michal Simek <monstr@...str.eu>
Cc:	linux-arch@...r.kernel.org,
	Remis Lima Baima <remis.developer@...glemail.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 12/27] asm-generic: add a NOMMU uaccess.h

On Friday 01 May 2009, Michal Simek wrote:
> > +#ifndef __put_user
> > +#define __put_user(x, ptr)                             \
> > +({                                                     \
> > +       int __pu_err = 0;                               \
> > +       typeof(*(ptr)) __pu_val = (x);                  \
> > +       switch (sizeof (*(ptr))) {                      \
> > +       case 1:                                         \
> > +       case 2:                                         \
> > +       case 4:                                         \
> > +               *(ptr) = (__pu_val);                    \
> > +               break;                                  \
> > +       case 8:                                         \
> > +               memcpy(ptr, &__pu_val, sizeof (*(ptr)));\
> 
> 
> potential cast problem

Yes, I'm looking into this already, probably will do something
based on the s390 code, which seems to do this correctly.

> > +#define put_user(x, ptr) (                             \
> > +       access_ok(VERIFY_WRITE, ptr, sizeof (*ptr)) ?   \
> > +               __put_user(x, ptr) :                    \
> > +               -EFAULT)
> 
> 
> IMHO write it as inline function with type checking.

Unfortunately, this doesn't work because of the callin
conventions: __put_user needs to know the type of ptr,
so it has to be a macro.

	Arnd <><

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ