Re: [patch 2.6.13-rc6] Fix kmem read on 32-bit archs

From: Linus Torvalds
Date: Sun Aug 14 2005 - 16:30:47 EST




On Sun, 14 Aug 2005, Chuck Ebbert wrote:
>
> It's ugly but so is the existing code. And it won't fix 64-bit
> archs AFAICT. Tested on 2.6.11, patch offsets fixed up for 2.6.13-rc6.

Btw, if you really want to allow negative ("huge positive") loff_t, then
you should do it the way we did "file->f_maxcount", and just have a u64
"file->f_maxpos" that we initialize to LONG_LONG_MAX or something like
that by default.

Then, the kmem_open() routine could set it to ULONG_LONG_MAX, and the
rw_verify_area check would change from comparing pos for being negative to
an unsigned compare of pos against "f_maxpos".

(That would also allow filesystems to limit the position to 32-bit values
if they wanted to, and felt that they didn't want to even handle anything
else).

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