Re: [CHECKER] potential dereference of user pointer errors

From: David S. Miller (davem@redhat.com)
Date: Mon Mar 24 2003 - 19:44:48 EST


On Mon, 2003-03-24 at 14:28, Raja R Harinath wrote:
> Something like
>
> /* struct user_space should never be defined. */
> typedef struct user_space user_space;
>
> int copy_to_user (user_space *to, char *from, size_t len);
> int copy_from_user (char *to, user_space *from, size_t len);
> /* ... */
>
> #define TREAT_AS_USER_SPACE_POINTER(p) \
> ({ \
> BUG_ON(get_fs() != get_gs()); \
> (user_space *)p; \
> })

A great idea, we'd need to use this struct user_space at every
system call, and it doesn't work to well when pointers are
embedded inside of a structure.

This is why a GCC attribute of some sort would be more useful.
But I don't see the GCC folks offering a user-definable attribute
+ checking system any time soon.

-- 
David S. Miller <davem@redhat.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:18 EST