Re: [PATCH] Fix /proc/pid/pagemap return length calculation
From: Dave Boutcher
Date: Mon Aug 06 2007 - 01:00:22 EST
On Sun, 5 Aug 2007 22:34:46 -0500, Matt Mackall <mpm@xxxxxxxxxxx> said:
>
> On Sun, Aug 05, 2007 at 09:03:23PM -0500, Dave Boutcher wrote:
>>
>> /proc/pid/pagemap has a header (usually 8 bytes) the length
>> of which needs to be compensated for when converting from
>> proc file offset to page number. The calculation of the
>> starting page number (svpfn) compensates for this, but the
>> calculation of the ending page number (evpfn) does not, resulting
>> in reads returning 8 bytes more than were asked for and
>> nastily overwriting userspace memory.
>
> Does this mean you're running on a 64-bit arch? I'd already fixed this
> locally, but it was off by 4 for me.
>
> Acked-by: Matt Mackall <mpm@xxxxxxxxxxx>
Yeah, and there is going to be at least one more patch coming, since
with this fix, which is a righteous fix, things don't get copied up to
user space correctly since some other code was dependent on the borken
length :-)
I like the /proc/xxx/pagemap function though...thanks for writing it.
Dave B
-
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/