qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chen Gang <chengang@emindsoft.com.cn>
To: riku.voipio@iki.fi
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH] linux-user/syscall.c: Notice about lock bitmask translation for fcntl
Date: Fri, 18 Dec 2015 14:26:32 +0800	[thread overview]
Message-ID: <5673A718.40103@emindsoft.com.cn> (raw)


For fcntl, it always needs to notice about it, just like do_fcntl() has
done, or it will cause issue (e.g. alpha host run i386 guest).

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 linux-user/syscall.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0f8adeb..1a60e6f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9007,7 +9007,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             if (((CPUARMState *)cpu_env)->eabi) {
                 if (!lock_user_struct(VERIFY_READ, target_efl, arg3, 1)) 
                     goto efault;
-                fl.l_type = tswap16(target_efl->l_type);
+                fl.l_type = target_to_host_bitmask(tswap16(target_fl->l_type),
+                                                   flock_tbl);
                 fl.l_whence = tswap16(target_efl->l_whence);
                 fl.l_start = tswap64(target_efl->l_start);
                 fl.l_len = tswap64(target_efl->l_len);
@@ -9018,7 +9019,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             {
                 if (!lock_user_struct(VERIFY_READ, target_fl, arg3, 1)) 
                     goto efault;
-                fl.l_type = tswap16(target_fl->l_type);
+                fl.l_type = target_to_host_bitmask(tswap16(target_fl->l_type),
+                                                   flock_tbl);
                 fl.l_whence = tswap16(target_fl->l_whence);
                 fl.l_start = tswap64(target_fl->l_start);
                 fl.l_len = tswap64(target_fl->l_len);
@@ -9031,7 +9033,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 if (((CPUARMState *)cpu_env)->eabi) {
                     if (!lock_user_struct(VERIFY_WRITE, target_efl, arg3, 0)) 
                         goto efault;
-                    target_efl->l_type = tswap16(fl.l_type);
+                    target_efl->l_type = host_to_target_bitmask(
+                                                 tswap16(fl.l_type), flock_tbl);
                     target_efl->l_whence = tswap16(fl.l_whence);
                     target_efl->l_start = tswap64(fl.l_start);
                     target_efl->l_len = tswap64(fl.l_len);
@@ -9042,7 +9045,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 {
                     if (!lock_user_struct(VERIFY_WRITE, target_fl, arg3, 0)) 
                         goto efault;
-                    target_fl->l_type = tswap16(fl.l_type);
+                    target_fl->l_type = host_to_target_bitmask(
+                                                 tswap16(fl.l_type), flock_tbl);
                     target_fl->l_whence = tswap16(fl.l_whence);
                     target_fl->l_start = tswap64(fl.l_start);
                     target_fl->l_len = tswap64(fl.l_len);
@@ -9058,7 +9062,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             if (((CPUARMState *)cpu_env)->eabi) {
                 if (!lock_user_struct(VERIFY_READ, target_efl, arg3, 1)) 
                     goto efault;
-                fl.l_type = tswap16(target_efl->l_type);
+                fl.l_type = target_to_host_bitmask(tswap16(target_fl->l_type),
+                                                   flock_tbl);
                 fl.l_whence = tswap16(target_efl->l_whence);
                 fl.l_start = tswap64(target_efl->l_start);
                 fl.l_len = tswap64(target_efl->l_len);
@@ -9069,7 +9074,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             {
                 if (!lock_user_struct(VERIFY_READ, target_fl, arg3, 1)) 
                     goto efault;
-                fl.l_type = tswap16(target_fl->l_type);
+                fl.l_type = target_to_host_bitmask(tswap16(target_fl->l_type),
+                                                   flock_tbl);
                 fl.l_whence = tswap16(target_fl->l_whence);
                 fl.l_start = tswap64(target_fl->l_start);
                 fl.l_len = tswap64(target_fl->l_len);
-- 
1.7.3.4

             reply	other threads:[~2015-12-18  6:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18  6:26 Chen Gang [this message]
2015-12-18  6:51 ` [Qemu-devel] [PATCH] linux-user/syscall.c: Notice about lock bitmask translation for fcntl Chen Gang
2015-12-18  9:41   ` Laurent Vivier
2015-12-18 10:47     ` Chen Gang
2015-12-21  2:47       ` Chen Gang
2015-12-18  9:37 ` Laurent Vivier
2015-12-18 21:40   ` Chen Gang
2015-12-18 21:58     ` Laurent Vivier
2015-12-18 22:12       ` Chen Gang
2015-12-18 22:15         ` Laurent Vivier
2015-12-18 22:31           ` Chen Gang

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=5673A718.40103@emindsoft.com.cn \
    --to=chengang@emindsoft.com.cn \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).