All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] syscall _llseek does not work with file offset >= 2 GB
@ 2013-07-26 20:49 Gilles Mouchard
  2013-07-28  9:57 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Gilles Mouchard @ 2013-07-26 20:49 UTC (permalink / raw)
  To: qemu-trivial


[-- Attachment #1.1: Type: text/plain, Size: 1818 bytes --]

Hello,

In Linux user mode, system call _llseek returns EINVAL when offset_low >= 2
GB.
Replacing __NR_llseek by __NR__llseek has solved the bug (note the missing
underscore).

diff -Naur qemu-1.5.2-orig/linux-user/openrisc/syscall_nr.h
qemu-1.5.2-new/linux-user/openrisc/syscall_nr.h
--- qemu-1.5.2-orig/linux-user/openrisc/syscall_nr.h    2013-07-25
23:01:44.000000000 +0200
+++ qemu-1.5.2-new/linux-user/openrisc/syscall_nr.h    2013-07-26
22:30:12.894996804 +0200
@@ -493,7 +493,7 @@
 #define TARGET_NR_fstatfs64 TARGET_NR_3264_fstatfs
 #define TARGET_NR_truncate64 TARGET_NR_3264_truncate
 #define TARGET_NR_ftruncate64 TARGET_NR_3264_ftruncate
-#define TARGET_NR_llseek TARGET_NR_3264_lseek
+#define TARGET_NR__llseek TARGET_NR_3264_lseek
 #define TARGET_NR_sendfile64 TARGET_NR_3264_sendfile
 #define TARGET_NR_fstatat64 TARGET_NR_3264_fstatat
 #define TARGET_NR_fstat64 TARGET_NR_3264_fstat
diff -Naur qemu-1.5.2-orig/linux-user/syscall.c
qemu-1.5.2-new/linux-user/syscall.c
--- qemu-1.5.2-orig/linux-user/syscall.c    2013-07-25 23:01:44.000000000
+0200
+++ qemu-1.5.2-new/linux-user/syscall.c    2013-07-26 22:26:19.203918344
+0200
@@ -227,7 +227,7 @@
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
 _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp,
uint, count);
 #endif
-#if defined(TARGET_NR__llseek) && defined(__NR_llseek)
+#if defined(TARGET_NR__llseek) && defined(__NR__llseek)
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
 #endif
@@ -7106,7 +7106,7 @@
     case TARGET_NR__llseek:
         {
             int64_t res;
-#if !defined(__NR_llseek)
+#if !defined(__NR__llseek)
             res = lseek(arg1, ((uint64_t)arg2 << 32) | arg3, arg5);
             if (res == -1) {
                 ret = get_errno(res);

[-- Attachment #1.2: Type: text/html, Size: 2085 bytes --]

[-- Attachment #2: qemu-1.5.2-syscall-_llseek.patch --]
[-- Type: application/octet-stream, Size: 1629 bytes --]

diff -Naur qemu-1.5.2-orig/linux-user/openrisc/syscall_nr.h qemu-1.5.2-new/linux-user/openrisc/syscall_nr.h
--- qemu-1.5.2-orig/linux-user/openrisc/syscall_nr.h	2013-07-25 23:01:44.000000000 +0200
+++ qemu-1.5.2-new/linux-user/openrisc/syscall_nr.h	2013-07-26 22:30:12.894996804 +0200
@@ -493,7 +493,7 @@
 #define TARGET_NR_fstatfs64 TARGET_NR_3264_fstatfs
 #define TARGET_NR_truncate64 TARGET_NR_3264_truncate
 #define TARGET_NR_ftruncate64 TARGET_NR_3264_ftruncate
-#define TARGET_NR_llseek TARGET_NR_3264_lseek
+#define TARGET_NR__llseek TARGET_NR_3264_lseek
 #define TARGET_NR_sendfile64 TARGET_NR_3264_sendfile
 #define TARGET_NR_fstatat64 TARGET_NR_3264_fstatat
 #define TARGET_NR_fstat64 TARGET_NR_3264_fstat
diff -Naur qemu-1.5.2-orig/linux-user/syscall.c qemu-1.5.2-new/linux-user/syscall.c
--- qemu-1.5.2-orig/linux-user/syscall.c	2013-07-25 23:01:44.000000000 +0200
+++ qemu-1.5.2-new/linux-user/syscall.c	2013-07-26 22:26:19.203918344 +0200
@@ -227,7 +227,7 @@
 #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
 _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
 #endif
-#if defined(TARGET_NR__llseek) && defined(__NR_llseek)
+#if defined(TARGET_NR__llseek) && defined(__NR__llseek)
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
 #endif
@@ -7106,7 +7106,7 @@
     case TARGET_NR__llseek:
         {
             int64_t res;
-#if !defined(__NR_llseek)
+#if !defined(__NR__llseek)
             res = lseek(arg1, ((uint64_t)arg2 << 32) | arg3, arg5);
             if (res == -1) {
                 ret = get_errno(res);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-trivial] syscall _llseek does not work with file offset >= 2 GB
  2013-07-26 20:49 [Qemu-trivial] syscall _llseek does not work with file offset >= 2 GB Gilles Mouchard
@ 2013-07-28  9:57 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2013-07-28  9:57 UTC (permalink / raw)
  To: Gilles Mouchard; +Cc: qemu-trivial

27.07.2013 00:49, Gilles Mouchard wrote:
> Hello,
> 
> In Linux user mode, system call _llseek returns EINVAL when offset_low >= 2 GB.
> Replacing __NR_llseek by __NR__llseek has solved the bug (note the missing underscore).

Hm.  While the patch is rather trivial indeed, the change is quite
a bit non-trivial.  Please resubmit to qemu-devel@.

Thank you!

/mjt


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-28  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-26 20:49 [Qemu-trivial] syscall _llseek does not work with file offset >= 2 GB Gilles Mouchard
2013-07-28  9:57 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.