From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9rTe-0002Vq-UZ for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9rTc-0008No-8F for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:37:30 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:56439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9rTb-0008Ne-W1 for qemu-devel@nongnu.org; Fri, 18 Dec 2015 04:37:28 -0500 References: <5673A718.40103@emindsoft.com.cn> From: Laurent Vivier Message-ID: <5673D3C4.8020308@vivier.eu> Date: Fri, 18 Dec 2015 10:37:08 +0100 MIME-Version: 1.0 In-Reply-To: <5673A718.40103@emindsoft.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Notice about lock bitmask translation for fcntl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Gang , riku.voipio@iki.fi Cc: Peter Maydell , qemu-devel , Richard Henderson Le 18/12/2015 07:26, Chen Gang a écrit : > > 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 > --- > 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); > This patch looks good to me, except that script/checkpatch.pl complains about "DOS line ending" and "line over 80 characters". Reviewed-by: Laurent Vivier