From: Al Viro <viro@ZenIV.linux.org.uk>
To: Chris Metcalf <cmetcalf@tilera.com>
Cc: linux-arch@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] tile: work around bug in the generic sys_llseek
Date: Mon, 4 Mar 2013 16:54:10 +0000 [thread overview]
Message-ID: <20130304165410.GS4503@ZenIV.linux.org.uk> (raw)
In-Reply-To: <201303041627.r24GR7Ql032052@farm-0021.internal.tilera.com>
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@tilera.com>
> Cc: stable@kernel.org [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.
next prev parent reply other threads:[~2013-03-04 16:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-25 0:29 [tile] sys_llseek() can *not* be used as compat_sys_llseek() there Al Viro
2013-02-27 18:46 ` Chris Metcalf
2013-02-27 19:41 ` Al Viro
2013-03-04 16:19 ` [PATCH] tile: work around bug in the generic sys_llseek Chris Metcalf
2013-03-04 16:54 ` Al Viro [this message]
2013-03-04 17:45 ` Chris Metcalf
2013-03-04 18:37 ` [PATCH] tile: properly use COMPAT_SYSCALL_DEFINEx Chris Metcalf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130304165410.GS4503@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=cmetcalf@tilera.com \
--cc=linux-arch@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).