[Maverick] request: CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
Leann Ogasawara
leann.ogasawara at canonical.com
Fri Jul 16 22:40:12 UTC 2010
On Thu, 2010-07-15 at 15:35 -0700, Kees Cook wrote:
> Hi!
Hi Kees,
> Could we enable this test, just to be safer during compiles? It won't
> affect run-time, it just forces the build to be safer, IIUC:
I wouldn't be opposed to enabling this, but at the moment doing so
results in build failures. If you have time, care to send a patch to
fix up this build failures? Otherwise, can you file a bug for us to
track this request.
Thanks,
Leann
> arch/x86/include/asm/uaccess_32.h:
>
> extern void copy_from_user_overflow(void)
> #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
> __compiletime_error("copy_from_user() buffer size is not provably correct")
> #else
> __compiletime_warning("copy_from_user() buffer size is not provably correct")
> #endif
>
> static inline unsigned long __must_check copy_from_user(void *to,
> const void __user *from,
> unsigned long n)
> {
> int sz = __compiletime_object_size(to);
>
> if (likely(sz == -1 || sz >= n))
> n = _copy_from_user(to, from, n);
> else
> copy_from_user_overflow();
>
> return n;
> }
>
>
> --
> Kees Cook
> Ubuntu Security Team
>
More information about the kernel-team
mailing list