From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268691; cv=none; d=zoho.com; s=zohoarc; b=HZiSZLq6aBW/A2lB1cLRlyEi7cbGPWkh5XKAZ9TDJ3hhHpj88O/52FmDPLwCg9iiwR8Cfd17kEMosofagABAHsufrgBcNhpRZDMoBOFaN0xGELU3/JRl/fQATc8WJrKQiMDx2tUJMYdUzXZrnj2UPvyXbPKwWjc/zqMU4t35irs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268691; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BHGI3+8vtRubbduLCNhhlbnp/D5j3XNj3WuKzd4SrtQ=; b=fqnoRypHGw4eKb9diHDJtFZ4xbpLKDqQW056iGv3HoTZxmlFveLmAPRlXqOAbDsmB8gvVmaWvFmo3WRBKnUsUQzt1TFPL25PHuswQAuvwYfc7QbQgyk1aDm8Q6f8DbKtzSA0vmGYleIwkVpzCpKhWsWl1gl9bk9tNpAQryzzFGQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268691025455.73828776402036; Sun, 19 May 2019 05:24:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:48053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKrp-0008Vi-Ir for importer@patchew.org; Sun, 19 May 2019 08:24:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKqE-0007f5-EL for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKqD-0004DW-Do for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:02 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:57204 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKqD-0004D6-7Y for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:01 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 1D1BA1A202F; Sun, 19 May 2019 14:23:00 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id C069A1A1D9C; Sun, 19 May 2019 14:22:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:26 +0200 Message-Id: <1558268551-14877-2-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 1/6] linux-user: Fix support for SIOCATMARK and SIOCGPGRP ioctls for xtensa X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aleksandar Markovic Fix support for the SIOCATMARK and SIOCGPGRP ioctls for xtensa by correcting corresponding macro definition. Values for TARGET_SIOCATMARK and TARGET_SIOCGPGRP are determined by Linux kernel. Following relevant lines (obtained by grep) are from the kernel source tree: arch/ia64/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 arch/mips/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/parisc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 arch/sh/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/alpha/include/uapi/asm/sockios.h:#define SIOCATMARK _IOR('s', 7, int) arch/sparc/include/uapi/asm/sockios.h:#define SIOCATMARK 0x8905 include/uapi/asm-generic/sockios.h:#define SIOCATMARK 0x8905 arch/ia64/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 arch/mips/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/parisc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 arch/sh/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/alpha/include/uapi/asm/sockios.h:#define SIOCGPGRP _IOR('s', 9, pid= _t) arch/sparc/include/uapi/asm/sockios.h:#define SIOCGPGRP 0x8904 include/uapi/asm-generic/sockios.h:#define SIOCGPGRP 0x8904 It is visible from above that xtensa should have the same definitions as alpha, mips and sh4 already do. This patch brings QEMU to the accurate state wrt these two ioctls. Acked-by: Max Filippov Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier --- linux-user/syscall_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 12c8407..1e86fb9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -736,7 +736,8 @@ struct target_pollfd { #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags]= */ #define TARGET_KDSIGACCEPT 0x4B4E =20 -#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) +#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ + defined(TARGET_XTENSA) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else --=20 2.7.4 From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268722; cv=none; d=zoho.com; s=zohoarc; b=O77KBdJ3qbb/+QeZ9Jye+uymeq85DY3OW+iiVoDEIWm70GECszz1OuxpRDTCdWhKiPWT/UcTMxIw15vzLVlStu/xoXYiGETng2gDtQt0quRhc/L0jgxCkWtrAb/r09qKfGH4sTBFBX8uutZvfrCHLiFlKQqswZhmreyTAHCIL4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268722; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KG/hFtlDPW4YClY2CJ1osCnWysGJ8ahEdLi8ASM7YJM=; b=BAZ13J344krkM8Y9fZzXRT2Wp5UDKY28KI8WcoxqfOMnnqZxomcHq7rDUY9gEEAXFzpS74Yq9wuL4Qt3B5TQ8+IMLpeOkr1vmwaViWQV+iEI3eakr3cDXHyUXmJiX31G50n8KLiyzu7IeomKtJXe5RR4Rk2pvTiQ6pOr9TtdfJI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268722049205.69304527928193; Sun, 19 May 2019 05:25:22 -0700 (PDT) Received: from localhost ([127.0.0.1]:48056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKsN-0000Xh-Vp for importer@patchew.org; Sun, 19 May 2019 08:25:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKqY-0007uM-23 for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKqX-0004PV-4d for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:22 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:57485 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKqW-0004P5-Ub for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id E73DF1A1E3D; Sun, 19 May 2019 14:23:19 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 919BB1A1D9C; Sun, 19 May 2019 14:23:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:27 +0200 Message-Id: <1558268551-14877-3-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 2/6] linux-user: Add support for SIOCSPGRP ioctl for all targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aleksandar Markovic Add support for setting the process (or process group) to receive SIGIO or SIGURG signals when I/O becomes possible or urgent data is available, using SIOCSPGRP ioctl. The ioctl numeric values for SIOCSPGRP are platform-dependent and are determined by following files in Linux kernel source tree: arch/ia64/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 arch/mips/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/parisc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 arch/sh/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/xtensa/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/alpha/include/uapi/asm/sockios.h:#define SIOCSPGRP _IOW('s', 8, pid_= t) arch/sparc/include/uapi/asm/sockios.h:#define SIOCSPGRP 0x8902 include/uapi/asm-generic/sockios.h:#define SIOCSPGRP 0x8902 Hence the different definition for alpha, mips, sh4, and xtensa. Signed-off-by: Aleksandar Markovic Reviewed-by: Max Filippov Reviewed-by: Laurent Vivier --- linux-user/ioctls.h | 1 + linux-user/syscall_defs.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index ae89516..c37adc5 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -218,6 +218,7 @@ IOCTL(SIOCSRARP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) + IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */ IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval))) IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec))) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 1e86fb9..2941231 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -739,11 +739,14 @@ struct target_pollfd { #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ defined(TARGET_XTENSA) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else #define TARGET_SIOCATMARK 0x8905 +#define TARGET_SIOCSPGRP 0x8902 #define TARGET_SIOCGPGRP 0x8904 #endif + #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ =20 --=20 2.7.4 From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268743; cv=none; d=zoho.com; s=zohoarc; b=Fske/YLWfsUFs30eJYftHTJgMk4EdfgrDllffllxnUl6MVoFVMLfLOF+oblV8fXJYg4OJ3+GxFr74/jPfYV6efXjPonyumJUNvzpZPR1Caf5KvQtaKaC/JCKzjltuPrc1m3Oy3f3L5uzpfFw67WApTHs7nd0zm62KCbzpEsPwhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268743; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4FZeIoyLwUkgDam/aBjbFIt0oa/xZjwWWsfjK4SQk7o=; b=evz6ppVWgvvC2NgYHfsqwPzfVtt+7RTn6xCq2eRT0cNiHKnvcuNKvrE8DeMmW53iDWyBLzpP1ayk+aoSUsSyQ5uL4TZAYS1Eo+KVOOTzUio2qLoHveB4bfOGVF9514+U9V/tB0ezJuU8V0Cf4CfKePhV8OakdcOGJdgcFiRKg/c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268743979632.8652706812156; Sun, 19 May 2019 05:25:43 -0700 (PDT) Received: from localhost ([127.0.0.1]:48072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKsl-0000q0-Ul for importer@patchew.org; Sun, 19 May 2019 08:25:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKqu-00088B-QR for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKqt-0004Z0-OA for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:44 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:59689 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKqt-0004Yd-EP for qemu-devel@nongnu.org; Sun, 19 May 2019 08:23:43 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 67C201A1E3D; Sun, 19 May 2019 14:23:42 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 01EF11A1D9C; Sun, 19 May 2019 14:23:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:28 +0200 Message-Id: <1558268551-14877-4-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 3/6] linux-user: Add support for SIOCIFPFLAGS ioctls for all targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for getting and setting extended private flags of a network device via SIOCSIFPFLAGS and SIOCGIFPFLAGS ioctls. The ioctl numeric values are platform-independent and determined by the file include/uapi/linux/sockios.h in Linux kernel source code: #define SIOCSIFPFLAGS 0x8934 #define SIOCGIFPFLAGS 0x8935 These ioctls get (or set) the field ifr_flags of type short in the structure ifreq. Such functionality is achieved in QEMU by using MK_STRUCT() and MK_PTR() macros with an appropriate argument, as it was done for existing similar cases. Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Message-Id: <1554839486-3527-1-git-send-email-aleksandar.markovic@rt-rk.com> --- linux-user/ioctls.h | 2 ++ linux-user/syscall_defs.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index c37adc5..76375df 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -206,6 +206,8 @@ IOCTL(SIOCADDMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCDELMULTI, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCGIFINDEX, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) + IOCTL(SIOCSIFPFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) + IOCTL(SIOCGIFPFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)= )) IOCTL(SIOCSIFLINK, 0, TYPE_NULL) IOCTL_SPECIAL(SIOCGIFCONF, IOC_W | IOC_R, do_ioctl_ifconf, MK_PTR(MK_STRUCT(STRUCT_ifconf))) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 2941231..8904d35 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -781,6 +781,8 @@ struct target_pollfd { #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists = */ #define TARGET_SIOCDELMULTI 0x8932 #define TARGET_SIOCGIFINDEX 0x8933 +#define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags = */ +#define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags = */ =20 /* Bridging control calls */ #define TARGET_SIOCGIFBR 0x8940 /* Bridging support = */ --=20 2.7.4 From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268849; cv=none; d=zoho.com; s=zohoarc; b=VmelBF31v6a4cN1En2O64spwKSzZYeZm2iYCVLDGNyb+KxSf9nr0ylZtOSPrQmGPZ2EAasbEan1GNzBZz7NA4rI30bvy59wDNdAvUclyEhbTIv4kXxYPuSWGC0keFqsiwzrMetNCSnMS3//oRyARJOp9lsyXrVIktnH7+lYR0ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268849; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=I/PmA5T8mwE+XZCjH/IWqmzHkEF9tdPIGaxGb/eiZFM=; b=m8MEkinPD9g8ctwKh10zjSws5Z2r8C5aZLHKXPRSgDN07n8n54WIpxfZQJszeHVfVgh9W5DshEBWAuypVl3zCQlZQ5pWrzPJZf4q9avu1saOvusJYqNQI922hGzknExSQXCOVjY4UzK0dR37JEZSVBYFIIvt5NrHpyLuCYqXSbk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268849570997.0125558906907; Sun, 19 May 2019 05:27:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:48109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKuR-0002s7-E8 for importer@patchew.org; Sun, 19 May 2019 08:27:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKrS-0000Am-RH for qemu-devel@nongnu.org; Sun, 19 May 2019 08:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKrR-0004nj-U5 for qemu-devel@nongnu.org; Sun, 19 May 2019 08:24:18 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:60883 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKrR-0004nJ-Ns for qemu-devel@nongnu.org; Sun, 19 May 2019 08:24:17 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id A7D6F1A1E3D; Sun, 19 May 2019 14:24:16 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 79F091A1D9C; Sun, 19 May 2019 14:24:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:29 +0200 Message-Id: <1558268551-14877-5-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 4/6] linux-user: Add support for setsockopt() options IPV6__MEMBERSHIP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for options IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMPEMBERSHIP of the syscall setsockopt(). These options control membership in multicast groups. Their argument is a pointer to a struct ipv6_mreq, which is in turn defined in IP v6 headers as: struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_interface; }; ...whereas its definition in kernel (include/uapi/linux/in6.h) is: struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_ifindex; }; The first field of ipv6_mreq has the same name ("ipv6mr_multiaddr") and type ("in6_addr") in both cases. Moreover, the in6_addr structure consists of fields that are always big-endian (on host of any endian), therefore the ipv6_mreq's field ipv6mr_multiaddr doesn't need any endian conversion. The second field of ipv6_mreq may, however, depending on the build environment, have different names. This is the reason why the line "#if __UAPI_DEF_IPV6_MREQ" is used in this patch - to establish the right choice for the field name. Also, endian conversion is needed fot this field, since it is of type "int". Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic --- linux-user/syscall.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 96cd4bf..d8f95c5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1892,6 +1892,31 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, &pki, sizeof(pki))); break; } + case IPV6_ADD_MEMBERSHIP: + case IPV6_DROP_MEMBERSHIP: + { + struct ipv6_mreq ipv6mreq; + + if (optlen < sizeof(ipv6mreq)) { + return -TARGET_EINVAL; + } + + if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) { + return -TARGET_EFAULT; + } + +#if __UAPI_DEF_IPV6_MREQ + ipv6mreq.ipv6mr_ifindex =3D tswap32(ipv6mreq.ipv6mr_ifindex); +#else + ipv6mreq.ipv6mr_interface =3D tswap32(ipv6mreq.ipv6mr_interfac= e); +#endif /* __UAPI_DEF_IVP6_MREQ */ + + ipv6mreq.ipv6mr_interface =3D tswap32(ipv6mreq.ipv6mr_interfac= e); + + ret =3D get_errno(setsockopt(sockfd, level, optname, + &ipv6mreq, sizeof(ipv6mreq))); + break; + } default: goto unimplemented; } --=20 2.7.4 From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268919; cv=none; d=zoho.com; s=zohoarc; b=B0vMqmOl+XIzvxDIx6vMFOT3p8brxwp5ub/5Pjv0ZZGs4um603UU3EcDje9WYX0e6zrvQBfPx3/ur6A4WJLnO0E2C7R6S9bGlMMaJOhrdIVH1/NjNiQriLVnE3mAdt8Way9V+e3qy5s3igbxBaUYhTqoK8gACYZz4HdbfHV/MeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268919; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4dqNte1VLc9PiYN5dp9/pItHs/Ud7ZYYO5NmbGbef/Y=; b=jqOmUsMPuQPAhYkym9C/yatwnjz+AVQWfkNrMPWlfr2+t5IR1bTlM3j/IspucFmphvVW7VYI5Rc/wf38iwAr+QzBxbWwoQkQv74Kc+OKB44//o1PXa6+xBfUDgbvcUdn0RZJEQABNTVDmFD7AqNbv328ocXcmIAhyCI95lXANoA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268919310775.1877484631545; Sun, 19 May 2019 05:28:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:48119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKvc-0003hY-B8 for importer@patchew.org; Sun, 19 May 2019 08:28:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKsG-0000tR-6r for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKsF-0005IB-6k for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:08 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:32907 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKsF-0005Hj-0E for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:07 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 000081A1E3D; Sun, 19 May 2019 14:25:05 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id D18851A1D9C; Sun, 19 May 2019 14:25:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:30 +0200 Message-Id: <1558268551-14877-6-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 5/6] linux-user: Sanitize interp_info and, for mips only, init field fp_abi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Daniel Santos Sanitize interp_info structure in load_elf_binary() and, for MIPS only, init its field fp_abi to MIPS_ABI_FP_UNKNOWN. This fixes appearances of "Unexpected FPU mode" message in some MIPS use cases. Currently, this bug is a complete stopper for some MIPS binaries. In load_elf_binary(), struct image_info interp_info is used without being properly initialized. One result is that when the ELF's program header doesn't contain an entry for the ABI flags, then the value of the struct image_info's fp_abi field is set to whatever happened to be in stack memory at the time. Backporting to 4.0 and, if possible, to 3.1 is recommended. Fixes: https://bugs.launchpad.net/qemu/+bug/1825002 Signed-off-by: Daniel Santos Signed-off-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- linux-user/elfload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c1a2602..7f09d57 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struc= t image_info *info) char *elf_interpreter =3D NULL; char *scratch; =20 + memset(&interp_info, 0, sizeof(interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi =3D MIPS_ABI_FP_UNKNOWN; +#endif + info->start_mmap =3D (abi_ulong)ELF_START_MMAP; =20 load_elf_image(bprm->filename, bprm->fd, info, --=20 2.7.4 From nobody Mon Nov 10 17:58:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268835; cv=none; d=zoho.com; s=zohoarc; b=CroZSW3cZW2vwdi/wpP2jS604QuCjgWBuW0zseZ7VtBqYWgRB3sYMmkyEyb3BhsdZsiBXFNiIDXUgq9zVCCz9NzWj8hFbmt1CmrApCAWTxNcfja6gWc7HdBtx62+p3nFzj+VXy24ZUqHCcLSNVtKPVNz6utrlBbNKw9t2g2dTxo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268835; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wpjE+PC6zxKbq+gEesVapTRBstl0pVF5K3yUn06Y8so=; b=BarrRciOYp5WlA5U5uZ9+Du6njkoOPpIiOA2ls8eYessyT3pVuxIPzGNZKtULVqK3uxxQKrPqeZtet4JhzDVNh92+ZcTA70hqi1hOCHLh9eH4QNLshvV1z9cSZKEJpSLdymY7UlBNzzFwFf+vH48LpWoigopBU06mplBIA2Ag0U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268835419329.5014258987608; Sun, 19 May 2019 05:27:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:48107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKuD-0002ii-AD for importer@patchew.org; Sun, 19 May 2019 08:27:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKsa-0001Cy-OH for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKsW-0005kv-KN for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:28 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:33578 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKsW-0005kF-9o for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 48CD21A1E3D; Sun, 19 May 2019 14:25:23 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 26D3E1A1D9C; Sun, 19 May 2019 14:25:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:31 +0200 Message-Id: <1558268551-14877-7-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 6/6] linux-user: Add support for statx() syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aleksandar Rikalo Implement support for translation of system call statx(). The implementation includes invoking other (more mature) system calls (from the same 'stat' family) on the host side. This way, the problems of potential lack of statx() availability of on the host side are avoided. Support for statx() in kernel and glibc was unfortunately introduced in different points of time (the difference is more than a year): - kernel: Linux 4.11 (30 April 2017) - glibc: glibc 2.28 (1 Aug 2018) In this patch, the availability of statx() support is established via __NR_statx (if it is defined, statx() is considered available). This coincedes with statx() introduction in kernel. However, the structure statx may not be available for hosts with glibc older than 2.28, even though the statx() functionality may be supported in kernel, if the kernel is not older than 4.11. Hence, a structure "target_statx" is defined in this patch, to remove that dependency on glibc headers. It is used for both target and host structures statx (of course, endian conversion is done in all needed cases). Signed-off-by: Aleksandar Rikalo Signed-off-by: Aleksandar Markovic --- linux-user/syscall.c | 135 ++++++++++++++++++++++++++++++++++++++++++= +++- linux-user/syscall_defs.h | 37 +++++++++++++ 2 files changed, 171 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d8f95c5..aea2000 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -6429,6 +6430,48 @@ static inline abi_long host_to_target_stat64(void *c= pu_env, } #endif =20 +#if defined(TARGET_NR_statx) && defined(__NR_statx) +static inline abi_long host_to_target_statx(struct target_statx *host_stx, + abi_ulong target_addr) +{ + struct target_statx *target_stx; + + if (!lock_user_struct(VERIFY_WRITE, target_stx, target_addr, 0)) { + return -TARGET_EFAULT; + } + memset(target_stx, 0, sizeof(*target_stx)); + + __put_user(host_stx->stx_mask, &target_stx->stx_mask); + __put_user(host_stx->stx_blksize, &target_stx->stx_blksize); + __put_user(host_stx->stx_attributes, &target_stx->stx_attributes); + __put_user(host_stx->stx_nlink, &target_stx->stx_nlink); + __put_user(host_stx->stx_uid, &target_stx->stx_uid); + __put_user(host_stx->stx_gid, &target_stx->stx_gid); + __put_user(host_stx->stx_mode, &target_stx->stx_mode); + __put_user(host_stx->stx_ino, &target_stx->stx_ino); + __put_user(host_stx->stx_size, &target_stx->stx_size); + __put_user(host_stx->stx_blocks, &target_stx->stx_blocks); + __put_user(host_stx->stx_attributes_mask, &target_stx->stx_attributes_= mask); + __put_user(host_stx->stx_atime.tv_sec, &target_stx->stx_atime.tv_sec); + __put_user(host_stx->stx_atime.tv_nsec, &target_stx->stx_atime.tv_nsec= ); + __put_user(host_stx->stx_btime.tv_sec, &target_stx->stx_atime.tv_sec); + __put_user(host_stx->stx_btime.tv_nsec, &target_stx->stx_atime.tv_nsec= ); + __put_user(host_stx->stx_ctime.tv_sec, &target_stx->stx_atime.tv_sec); + __put_user(host_stx->stx_ctime.tv_nsec, &target_stx->stx_atime.tv_nsec= ); + __put_user(host_stx->stx_mtime.tv_sec, &target_stx->stx_atime.tv_sec); + __put_user(host_stx->stx_mtime.tv_nsec, &target_stx->stx_atime.tv_nsec= ); + __put_user(host_stx->stx_rdev_major, &target_stx->stx_rdev_major); + __put_user(host_stx->stx_rdev_minor, &target_stx->stx_rdev_minor); + __put_user(host_stx->stx_dev_major, &target_stx->stx_dev_major); + __put_user(host_stx->stx_dev_minor, &target_stx->stx_dev_minor); + + unlock_user_struct(target_stx, target_addr, 1); + + return 0; +} +#endif + + /* ??? Using host futex calls even when target atomic operations are not really atomic probably breaks things. However implementing futexes locally would make futexes shared between multiple processes @@ -6982,7 +7025,8 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, abi_long ret; #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) \ || defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) \ - || defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) + || defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) \ + || defined(TARGET_NR_statx) struct stat st; #endif #if defined(TARGET_NR_statfs) || defined(TARGET_NR_statfs64) \ @@ -10031,6 +10075,95 @@ static abi_long do_syscall1(void *cpu_env, int num= , abi_long arg1, ret =3D host_to_target_stat64(cpu_env, arg3, &st); return ret; #endif +#if defined(TARGET_NR_statx) + case TARGET_NR_statx: + { + struct target_statx *target_stx; + int dirfd =3D arg1; + int flags =3D arg3; + + p =3D lock_user_string(arg2); + if (p =3D=3D NULL) { + return -TARGET_EFAULT; + } +#if defined(__NR_statx) + { + /* + * It is assumed that struct statx is arhitecture independ= ent + */ + struct target_statx host_stx; + int mask =3D arg4; + + ret =3D get_errno(syscall(__NR_statx, dirfd, p, flags, mas= k, + &host_stx)); + if (!is_error(ret)) { + if (host_to_target_statx(&host_stx, arg5) !=3D 0) { + unlock_user(p, arg2, 0); + return -TARGET_EFAULT; + } + } + + if (ret !=3D TARGET_ENOSYS) { + unlock_user(p, arg2, 0); + return ret; + } + } +#endif + if ((p =3D=3D NULL) || (*((char *)p) =3D=3D 0)) { + /* + * By file descriptor + */ + if (flags & AT_EMPTY_PATH) { + unlock_user(p, arg2, 0); + return -TARGET_ENOENT; + } + ret =3D get_errno(fstat(dirfd, &st)); + } else if (*((char *)p) =3D=3D '/') { + /* + * By absolute pathname + */ + ret =3D get_errno(stat(path(p), &st)); + } else { + if (dirfd =3D=3D AT_FDCWD) { + /* + * By pathname relative to the current working directo= ry + */ + ret =3D get_errno(stat(path(p), &st)); + } else { + /* + * By pathname relative to the directory referred to by + * the file descriptor 'dirfd' + */ + ret =3D get_errno(fstatat(dirfd, path(p), &st, flags)); + } + } + unlock_user(p, arg2, 0); + + if (!is_error(ret)) { + if (!lock_user_struct(VERIFY_WRITE, target_stx, arg5, 0)) { + return -TARGET_EFAULT; + } + memset(target_stx, 0, sizeof(*target_stx)); + __put_user(major(st.st_dev), &target_stx->stx_dev_major); + __put_user(minor(st.st_dev), &target_stx->stx_dev_minor); + __put_user(st.st_ino, &target_stx->stx_ino); + __put_user(st.st_mode, &target_stx->stx_mode); + __put_user(st.st_uid, &target_stx->stx_uid); + __put_user(st.st_gid, &target_stx->stx_gid); + __put_user(st.st_nlink, &target_stx->stx_nlink); + __put_user(major(st.st_rdev), &target_stx->stx_rdev_major); + __put_user(minor(st.st_rdev), &target_stx->stx_rdev_minor); + __put_user(st.st_size, &target_stx->stx_size); + __put_user(st.st_blksize, &target_stx->stx_blksize); + __put_user(st.st_blocks, &target_stx->stx_blocks); + __put_user(st.st_atime, &target_stx->stx_atime.tv_sec); + __put_user(st.st_mtime, &target_stx->stx_mtime.tv_sec); + __put_user(st.st_ctime, &target_stx->stx_ctime.tv_sec); + unlock_user_struct(target_stx, arg5, 1); + } + } + return ret; +#endif #ifdef TARGET_NR_lchown case TARGET_NR_lchown: if (!(p =3D lock_user_string(arg1))) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 8904d35..82f2ac3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2522,4 +2522,41 @@ struct target_user_cap_data { /* Return size of the log buffer */ #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 =20 +struct target_statx_timestamp { + int64_t tv_sec; + uint32_t tv_nsec; + int32_t __reserved; +}; + +struct target_statx { + /* 0x00 */ + uint32_t stx_mask; /* What results were written [uncond] */ + uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ + uint64_t stx_attributes; /* Flags conveying information about the file = */ + /* 0x10 */ + uint32_t stx_nlink; /* Number of hard links */ + uint32_t stx_uid; /* User ID of owner */ + uint32_t stx_gid; /* Group ID of owner */ + uint16_t stx_mode; /* File mode */ + uint16_t __spare0[1]; + /* 0x20 */ + uint64_t stx_ino; /* Inode number */ + uint64_t stx_size; /* File size */ + uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ + uint64_t stx_attributes_mask; /* Mask to show what is supported */ + /* 0x40 */ + struct target_statx_timestamp stx_atime; /* Last access time */ + struct target_statx_timestamp stx_btime; /* File creation time */ + struct target_statx_timestamp stx_ctime; /* Last attribute change tim= e */ + struct target_statx_timestamp stx_mtime; /* Last data modification ti= me */ + /* 0x80 */ + uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] = */ + uint32_t stx_rdev_minor; + uint32_t stx_dev_major; /* ID of device containing file [uncond] */ + uint32_t stx_dev_minor; + /* 0x90 */ + uint64_t __spare2[14]; /* Spare space for future expansion */ + /* 0x100 */ +}; + #endif --=20 2.7.4