- Fix seeking for negative SEEK_CUR seeks

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=146
This commit is contained in:
Alexander Graf 2013-07-16 02:49:49 +00:00 committed by Git OBS Bridge
parent 69d7cf99d4
commit 6d5c4b8822
5 changed files with 16 additions and 11 deletions

View File

@ -1,14 +1,14 @@
From f4310e6dc96e9036cd40d6b804019c4edbbb97f5 Mon Sep 17 00:00:00 2001
From a6c68880318cb93391649fa2a9edb9ef5cba9b8c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 13 Dec 2012 14:29:22 +0100
Subject: [PATCH] linux-user: lseek: explicitly cast end offsets to signed
Subject: [PATCH] linux-user: lseek: explicitly cast non-set offsets to signed
When doing lseek, SEEK_END indicates that the offset is a signed variable
that is usually negative, while and other SEEK indicates that it's unsigned.
When doing lseek, SEEK_SET indicates that the offset is an unsigned variable.
Other seek types have parameters that can be negative.
When converting from 32bit to 64bit parameters, we need to take this into
account and enable SEEK_END to be negative, while other SEEKs usually indicate
absolute position which we need to maintain as unsigned.
account and enable SEEK_END and SEEK_CUR to be negative, while SEEK_SET stays
absolute positioned which we need to maintain as unsigned.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
@ -16,7 +16,7 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c1eceb2..259fed4 100644
index c1eceb2..232f70d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5648,9 +5648,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
@ -27,7 +27,7 @@ index c1eceb2..259fed4 100644
- ret = get_errno(lseek(arg1, arg2, arg3));
+ case TARGET_NR_lseek: {
+ off_t off = arg2;
+ if (arg3 == SEEK_END) {
+ if (arg3 != SEEK_SET) {
+ off = (abi_long)arg2;
+ }
+ ret = get_errno(lseek(arg1, off, arg3));

View File

@ -1,4 +1,4 @@
From 563299dd5726bc6c7f2bc21ba101f965cf0c9fba Mon Sep 17 00:00:00 2001
From da9befab62ffd8232354cc7e4e1d1d1db288d462 Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Thu, 16 May 2013 12:39:10 +0200
Subject: [PATCH] virtfs-proxy-helper: Provide __u64 for broken

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 16 02:48:53 UTC 2013 - agraf@suse.com
- Fix seeking for negative SEEK_CUR seeks
-------------------------------------------------------------------
Sat May 25 15:50:49 UTC 2013 - afaerber@suse.de

View File

@ -60,7 +60,7 @@ Patch0033: 0033-Legacy-Patch-kvm-qemu-preXX-dictzip.patch
Patch0034: 0034-Legacy-Patch-kvm-qemu-preXX-report-.patch
Patch0035: 0035-console-add-question-mark-escape-op.patch
Patch0036: 0036-Make-char-muxer-more-robust-wrt-sma.patch
Patch0037: 0037-linux-user-lseek-explicitly-cast-en.patch
Patch0037: 0037-linux-user-lseek-explicitly-cast-no.patch
Patch0038: 0038-virtfs-proxy-helper-Provide-__u64-f.patch
# this is to make lint happy
Source300: rpmlintrc

View File

@ -60,7 +60,7 @@ Patch0033: 0033-Legacy-Patch-kvm-qemu-preXX-dictzip.patch
Patch0034: 0034-Legacy-Patch-kvm-qemu-preXX-report-.patch
Patch0035: 0035-console-add-question-mark-escape-op.patch
Patch0036: 0036-Make-char-muxer-more-robust-wrt-sma.patch
Patch0037: 0037-linux-user-lseek-explicitly-cast-en.patch
Patch0037: 0037-linux-user-lseek-explicitly-cast-no.patch
Patch0038: 0038-virtfs-proxy-helper-Provide-__u64-f.patch
# this is to make lint happy
Source300: rpmlintrc