Re: [PATCH] mm: Fix dirty_bytes/dirty_background_bytes sysctls on64bit arches

From: Sven Wegener
Date: Sun Feb 01 2009 - 05:23:01 EST


On Sun, 1 Feb 2009, Peter Zijlstra wrote:

> On Sun, 2009-02-01 at 02:22 +0100, Sven Wegener wrote:
> > We need to pass an unsigned long as the minimum, because it gets casted
> > to an unsigned long in the sysctl handler. If we pass an int, we'll
> > access four more bytes on 64bit arches, resulting in a random minimum
> > value.
>
> If that's so, how can any of those other limit values still be good?

The problem here is that we use proc_doulongvec_minmax(), which expects an
unsigned long. Most other sysctls use the dointvec versions and are safe,
as long as they pass an int. If they pass a char or a short, they're
subject to the same problem.

The other sysctls in sysctl.c that use proc_doulongvec_minmax() don't pass
a min/max value. The others in the kernel I checked do the same or pass a
proper unsigned long.

Sven
--
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/