From: "Kirill A. Shutemov" <k.shutemov@gmail.com>
To: Thiemo Seufer <ths@networkno.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fcntl64 fix
Date: Tue, 20 Mar 2007 13:43:15 +0200 [thread overview]
Message-ID: <20070320114315.GA26019@localhost.localdomain> (raw)
In-Reply-To: <20070319171303.GE28895@networkno.de>
[-- Attachment #1.1: Type: text/plain, Size: 1597 bytes --]
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.
[-- Attachment #1.2: qemu-0.9.0-alt-fcntl64-fix.patch --]
[-- Type: text/plain, Size: 1820 bytes --]
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;
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-03-20 11:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-09 21:53 [Qemu-devel] [PATCH] fcntl64 fix Kirill A. Shutemov
2007-03-19 17:13 ` Thiemo Seufer
2007-03-19 17:48 ` Stuart Anderson
2007-03-20 6:46 ` Stuart Anderson
2007-03-20 11:43 ` Kirill A. Shutemov [this message]
[not found] ` <Pine.LNX.4.64.0703200954000.12505@trantor.stuart.netsweng.com>
2007-03-20 13:59 ` Kirill A. Shutemov
2007-03-20 16:54 ` Stuart Anderson
2007-03-20 17:11 ` Kirill A. Shutemov
2007-03-20 18:03 ` Stuart Anderson
2007-03-20 19:34 ` Kirill A. Shutemov
2007-03-20 20:26 ` Stuart Anderson
2007-03-20 21:32 ` Stuart Anderson
2007-03-20 21:40 ` Paul Brook
2007-03-20 21:47 ` Thiemo Seufer
2007-03-20 22:56 ` Kirill A. Shutemov
2007-03-20 22:59 ` Kirill A. Shutemov
2007-03-21 13:49 ` Stuart Anderson
2007-03-20 23:05 ` Stuart Anderson
2007-03-20 23:10 ` Kirill A. Shutemov
2007-03-20 23:11 ` Kirill A. Shutemov
2007-03-20 23:43 ` Paul Brook
2007-03-21 13:50 ` Stuart Anderson
2007-03-22 14:23 ` Kirill A. Shutemov
-- strict thread matches above, loose matches on Subject: below --
2007-03-09 21:48 Kirill A. Shutemov
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=20070320114315.GA26019@localhost.localdomain \
--to=k.shutemov@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=ths@networkno.de \
/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 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.