Re: [BUG] x86info fails on 2.6.34 ?

From: Eric Dumazet
Date: Mon Apr 05 2010 - 17:04:24 EST


Le lundi 05 avril 2010 Ã 22:24 +0200, Eric Dumazet a Ãcrit :
> Hi Dave
>
> I just noticed x86info was not working anymore on latest kernel
>
> x86info v1.24. Dave Jones 2001-2009
> Feedback to <davej@xxxxxxxxxx>.
>
> type seek: Value too large for defined data type
>
>
> Offending syscall is an lseek(fd, -1, SEEK_CUR) on /dev/mem file
>
>
>
> open("/dev/mem", O_RDONLY) = 3
> ...
> lseek(3, 1023092, SEEK_SET) = 1023092
> read(3, "PCMP\4\3\4\266HP PROLIANT \0\0\0\0\0"..., 44) = 44
> read(3, "\0"..., 1) = 1
> lseek(3, -1, SEEK_CUR) = -1 EOVERFLOW (Value too large
> for defined data type)
>
> It seems -1 is taken as an unsigned quantity ?
>

Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the
problem.

It breaks rewinds (negative offsets to lseek (... SEEK_CUR))


commit dcefafb6ac90ece8d68a6c203105f3d313e52da4
Author: Wu Fengguang <fengguang.wu@xxxxxxxxx>
Date: Wed Mar 10 15:21:51 2010 -0800

/dev/mem: dont allow seek to last page

So as to return a uniform error -EOVERFLOW instead of a random one:

# kmem-seek 0xfffffffffffffff0
seek /dev/kmem: Device or resource busy
# kmem-seek 0xfffffffffffffff1
seek /dev/kmem: Block device required

Suggested by OGAWA Hirofumi.

Cc: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>



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