Yep. You're right. Fixed patch in the attachment.
On [Mon, 19.03.2007 17:12], Thiemo Seufer wrote: > Kirill A. Shutemov wrote: > > TARGET_F_*64 should be used instead of F_*64, because on 64-bit host > > systems F_GETLK == F_GETLK64(same for SETLK and SETLKW), so we cannot > > determinate if it's a long lock or not on a target 32-bit system. > > Patch in the attachment. > > > > P.S. Please, review my privious patches, which I have added description > > recently. Or should I repost it? > > > > > diff -uNr qemu-0.9.0.cvs20070304.orig/linux-user/syscall.c > > qemu-0.9.0.cvs20070304/linux-user/syscall.c > > --- qemu-0.9.0.cvs20070304.orig/linux-user/syscall.c 2007-03-09 > > 20:08:59 +0200 > > +++ qemu-0.9.0.cvs20070304/linux-user/syscall.c 2007-03-09 20:09:54 > > +0200 > > @@ -4063,7 +4063,7 @@ > > #endif > > > > switch(arg2) { > > - case F_GETLK64: > > + case TARGET_F_GETLK64: > > ret = get_errno(fcntl(arg1, arg2, &fl)); > > This changes the bug from checking the wrong flag to (potentially) > passing down the wrong flag... > > > if (ret == 0) { > > #ifdef TARGET_ARM > > @@ -4089,8 +4089,8 @@ > > } > > break; > > > > - case F_SETLK64: > > - case F_SETLKW64: > > + case TARGET_F_SETLK64: > > + case TARGET_F_SETLKW64: > > #ifdef TARGET_ARM > > if (((CPUARMState *)cpu_env)->eabi) { > > lock_user_struct(target_efl, arg3, 1); > > Likewise here. We should always check TARGET_* flags and pass down the > corresponding host flag.
diff -uNr qemu-0.9.0.cvs20070320.orig/linux-user/syscall.c qemu-0.9.0.cvs20070320/linux-user/syscall.c --- qemu-0.9.0.cvs20070320.orig/linux-user/syscall.c 2007-03-20 13:26:04 +0200 +++ qemu-0.9.0.cvs20070320/linux-user/syscall.c 2007-03-20 13:34:09 +0200 @@ -4058,15 +4058,27 @@ #if TARGET_LONG_BITS == 32 case TARGET_NR_fcntl64: { + int cmd; struct flock64 fl; struct target_flock64 *target_fl; #ifdef TARGET_ARM struct target_eabi_flock64 *target_efl; #endif + switch(arg2){ + case TARGET_F_GETLK64: + cmd = F_GETLK64; + case TARGET_F_SETLK64: + cmd = F_SETLK64; + case TARGET_F_SETLKW64: + cmd = F_SETLK64; + default: + cmd = arg2; + } + switch(arg2) { - case F_GETLK64: - ret = get_errno(fcntl(arg1, arg2, &fl)); + case TARGET_F_GETLK64: + ret = get_errno(fcntl(arg1, cmd, &fl)); if (ret == 0) { #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) { @@ -4091,8 +4103,8 @@ } break; - case F_SETLK64: - case F_SETLKW64: + case TARGET_F_SETLK64: + case TARGET_F_SETLKW64: #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) { lock_user_struct(target_efl, arg3, 1); @@ -4113,10 +4125,10 @@ fl.l_pid = tswapl(target_fl->l_pid); unlock_user_struct(target_fl, arg3, 0); } - ret = get_errno(fcntl(arg1, arg2, &fl)); + ret = get_errno(fcntl(arg1, cmd, &fl)); break; default: - ret = get_errno(do_fcntl(arg1, arg2, arg3)); + ret = get_errno(do_fcntl(arg1, cmd, arg3)); break; } break;
signature.asc
Description: Digital signature
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel