Re: [patch] 2.3.31: remove some cruft from module.c

Keith Owens (kaos@ocs.com.au)
Mon, 13 Dec 1999 16:45:07 +1100


On Sun, 12 Dec 1999 20:45:54 -0800,
Chris Sears <dbsears@ix.netcom.com> wrote:
>
>This is a simple patch to 2.3.31 to remove some useless cruft
>in kernel/module.c In qm_symbols() there is a call to
>access_ok() to check if the user memory is writeable.
>But the memory will be written with copy_to_user()
>which contains its own call to access_ok()
>
>--- module.c~ Sun Dec 12 20:21:09 1999
>+++ module.c Sun Dec 12 20:21:19 1999
>@@ -558,9 +558,6 @@
> if (space > bufsize)
> goto calc_space_needed;
>
>- if (!access_ok(VERIFY_WRITE, buf, space))
>- return -EFAULT;
>-
> bufsize -= space;
> vals = (unsigned long *)buf;
> strings = buf+space;

Nope, access_ok is required for the first "space" bytes starting at
buf. copy_to_user is only done for the strings which start "space"
bytes into buf. The first "space" bytes of buf contain pairs of longs
which are set using __put_user, which does not check access. The
separate check on the start of buf is for speed, one big check instead
of checking on each long that is stored.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/