Re: [PATCH] tile: work around bug in the generic sys_llseek

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 04, 2013 at 11:19:09AM -0500, Chris Metcalf wrote:
> sys_llseek should specify the high and low 32-bit seek values as "unsigned
> int" but instead it specifies "unsigned long".  Since compat syscall
> arguments are always sign-extended on tile, this means that a seek value
> of 0xffffffff will be incorrectly interpreted as a value of -1ULL.
> 
> To avoid the risk of breaking binary compatibility on architectures
> that already use sys_llseek this way, we follow the same path as MIPS
> and provide a wrapper override.
> 
> Signed-off-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxx [v3.6 onwards]
> ---
> Al Viro suggested changing the generic implementation but there has
> been no followup, and his preference was just fixing tile anyway,
> so this is what this patch does.  Al, can you ack this if it looks OK?
> The generated code for compat_sys_llseek just clears the high 32 bits
> of the two offset parameters and jumps to sys_llseek.

That's not enough - the reason why mips variant works is that they
use SYSCALL_DEFINE, which casts the sucker down to unsigned int.  Simply
declaring it as something that takes unsigned int will just tell the
compiler that upper bits of register are all zero, so it's free to pass
the damn thing unchanged.

Explicit cast down (for old versions) or use of COMPAT_SYSCALL_DEFINE would
work; longer term I'd prefer to have something (select or explicit defines
in asm/compat.h) telling whether we have a sign-extending or zero-extending
biarch and have that COMPAT_SYSCALL_DEFINE in fs/read_write.c, under ifdef
for arch being a sign-extender, but that's the next cycle fodder and can
be done on top of minimal (and easier backportable) fix.
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux