From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZefB-0000cj-4i for qemu-devel@nongnu.org; Tue, 16 Aug 2016 09:44:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZef6-0004jN-SZ for qemu-devel@nongnu.org; Tue, 16 Aug 2016 09:44:16 -0400 Received: from jessie.kos.to ([212.47.231.226]:43900 helo=pilvi.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZef6-0004iM-Ls for qemu-devel@nongnu.org; Tue, 16 Aug 2016 09:44:12 -0400 Date: Tue, 16 Aug 2016 16:44:08 +0300 From: Riku Voipio Message-ID: <20160816134408.GB19717@beaming.home> References: <1470938379-1133-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH for-2.7] linux-user: Fix llseek with high bit of offset_low set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chanho Park Cc: Peter Maydell , QEMU Developers , patches@linaro.org Hi, applied to linux-user-for upstream. Riku On Mon, Aug 15, 2016 at 10:41:35PM +0900, Chanho Park wrote: > It works perfectly. > Thanks. > > Tested-by: Chanho Park > > On Fri, Aug 12, 2016 at 2:59 AM, Peter Maydell wrote: > > The llseek syscall takes two 32-bit arguments, offset_high > > and offset_low, which must be combined to form a single > > 64-bit offset. Unfortunately we were combining them with > > (uint64_t)arg2 << 32) | arg3 > > and arg3 is a signed type; this meant that when promoting > > arg3 to a 64-bit type it would be sign-extended. The effect > > was that if the offset happened to have bit 31 set then > > this bit would get sign-extended into all of bits 63..32. > > Explicitly cast arg3 to abi_ulong to avoid the erroneous > > sign extension. > > > > Reported-by: Chanho Park > > Signed-off-by: Peter Maydell > > --- > > Long-standing bug and we're quite close to 2.7 but the > > fix is trivial so if somebody would like to review it > > I think we could put it in... > > > > linux-user/syscall.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > > index ebdb753..b4e21d3 100644 > > --- a/linux-user/syscall.c > > +++ b/linux-user/syscall.c > > @@ -9406,7 +9406,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > > { > > int64_t res; > > #if !defined(__NR_llseek) > > - res = lseek(arg1, ((uint64_t)arg2 << 32) | arg3, arg5); > > + res = lseek(arg1, ((uint64_t)arg2 << 32) | (abi_ulong)arg3, arg5); > > if (res == -1) { > > ret = get_errno(res); > > } else { > > -- > > 2.7.4 > > > > > > -- > Best Regards, > Chanho Park