From patchwork Thu Oct 12 15:30:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 115640 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2070633qgn; Thu, 12 Oct 2017 08:30:45 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TJteIovXrSLj772PC7daH5HphUG78ZPuAQD8bhIgZkcRQ1cU6jFtLpHAt7dDyLKoQcaMbI X-Received: by 10.46.29.65 with SMTP id d62mr283963ljd.139.1507822245034; Thu, 12 Oct 2017 08:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507822245; cv=none; d=google.com; s=arc-20160816; b=scGGcoLQPZBcCea59OofXg0gwxsOEB8RX9osi1acMcQmX9ZTo/gZtXB4XmW9rPSLPT L9E5ZH72A0+DNv0SmplXuu7r2F67Z7vgQFygkOfhyucB7GwDgYSOaJwJvwbnzz0oDWgQ iAXwj1QZ9XY7YmLqW9YCXEWbyXWF7Pq/Kk9YZzzq7E6AZ4NOWrrELzquzJAHo4XCfC8i rLlyo1a1Ay7naXnVG8IqG6FW7ry6bPaOrCArH1/1tNAu76NGLrv0JMMHQueafoS7iwxU +89+9I1QOlTvWo98gWCOVVKAcM4QxhKglhDy2P+tLE63w0FoZAPQFfn1lVfMrymEmfV/ x/PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=r1oBAXhDqahLj/X52sgidhsl+B6NqSM8ZHdC2UmDFA0=; b=XO/FqLReB45QJfhGDs4cLJMQmy5ZJcMatGdBY+ZQjg+VOWOjDiZ+H5Zjl2pzEseCod oRCZYcjhUfKlllMqge0PdXTeHY0R7VuWoEuflStuOT8iiPzqIIU0IO2Fg1St4v/bamZb 76Xr9t+PlfZHhhEOcNLGdLHHrAeQD27HFftg8L7YVZG2dP0zSKV2nQkaEZdnF6bNVwlX YKwLA/VGi/opvv/XFUN0JhIc/5JSOcfak9Z1HOYAAjmdOqg27dUhryoYCTq9SJ8Ps7lz WNNHBakijw9xUj/S16CyfKhcSnWpbJR9+8wCWKhfvj0m+djUCMLsNtnDkpchgHIYiQt+ wlBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id v1si7731557ljd.302.2017.10.12.08.30.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Oct 2017 08:30:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1e2fRZ-0000Ws-Do; Thu, 12 Oct 2017 16:30:41 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier , pgndev Subject: [PATCH 1/2] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers Date: Thu, 12 Oct 2017 16:30:44 +0100 Message-Id: <1507822245-15748-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507822245-15748-1-git-send-email-peter.maydell@linaro.org> References: <1507822245-15748-1-git-send-email-peter.maydell@linaro.org> We were defining TARGET_FS_IOC_GETFLAGS and TARGET_FS_IOC_SETFLAGS using the host 'long' type in the size field, which meant that they had the wrong values if the host and guest had different sized longs. Switch to abi_long instead. This fixes a bug where these ioctls don't work on 32-bit guests on 64-bit hosts (and makes the LTP test 'setxattr03' pass where it did not previously.) Reported-by: pgndev Signed-off-by: Peter Maydell --- linux-user/syscall_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 Reviewed-by: Laurent Vivier diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 40c5027..f7cc9f9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1101,8 +1101,8 @@ struct target_pollfd { /* Note that the ioctl numbers claim type "long" but the actual type * used by the kernel is "int". */ -#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, long) -#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, long) +#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) +#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) From patchwork Thu Oct 12 15:30:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 115641 Delivered-To: patches@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2070644qgn; Thu, 12 Oct 2017 08:30:45 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCvnlSyTI6ZhFIsV6fUZEHJIO2BSDK0OdXLflcp0VEmbbILvd3rsxo58VUb9Artwdx4mMTy X-Received: by 10.28.131.131 with SMTP id f125mr1999807wmd.137.1507822245499; Thu, 12 Oct 2017 08:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507822245; cv=none; d=google.com; s=arc-20160816; b=PhfY9tU8kkQy/y/eftNym4rO9L98RtSLQO6lm47h7Q2oqcR7lHMG1xI2DVv9Tr3XEI us+VNPu74neFDOXnmbj1AAYhdWH4BfXra7rwxVH/RHmuMqQ/VYuzD/qMsAIH15lHU5Lr 8qamvJ2mSeZAkTknXcvx8ivgUFT6FSTQxUFchVoCf6wOY9IF7ynzqcIzlUM4NyqcWhuI WIgHz/w+xgyQBpdn74rm33g8rIij2Dh0QhQauieCK5yD/zUmSq0Qyn5mF0GOHp7BWHhW KBcJF483v0BHK5p7TR/kURBDYr8YyRZdgu0YtDmHnpfLrOjhwS91eig2VnG9N+ICQRf1 86Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Hn7CMt4kkf8pUHmExjz5DRxnnne9w0yFQxi4VmqpN0E=; b=a4Pwk53aH+S+g0Xp8DfQgT9xRiHoaEPU3ZWwGSHntF/nC6llLqz5xGNlE/ZNnWkOO+ 2X3+i4sexsOGIQwEWv7TkilpRJhFg8vMwDcVXiEtdqXwWN51SP+DK2XwOtfjgsBMXQQ3 J/WUwwYEHCydPH/xIi6EnC+0c771YnxFDc/Syh1frBWUMvuWsZKvKv0CnJojONh7+s7G JltDeQzWZAGJgqS46CS01KYJ32O9gaNfgsiNuyfvKD0zi3MHwZsd1cYNGcdVkw6nQUY7 JBjJeHatUlgoMsMAWPReHg+QjUlFYlIhCi3kVx/1Xlu9VuM3UduFrs+uCMJ21P5uvjcc RjdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id 204si348736wml.71.2017.10.12.08.30.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Oct 2017 08:30:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1e2fRa-0000X5-0U; Thu, 12 Oct 2017 16:30:42 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier , pgndev Subject: [PATCH 2/2] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values Date: Thu, 12 Oct 2017 16:30:45 +0100 Message-Id: <1507822245-15748-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507822245-15748-1-git-send-email-peter.maydell@linaro.org> References: <1507822245-15748-1-git-send-email-peter.maydell@linaro.org> The TARGET_MTIOCTOP/TARGET_MTIOCGET/TARGET_MTIOCPOS values were being defined in terms of host struct types, but these structures are such that their size might differ on different hosts. Switch to using a target struct definition instead. Signed-off-by: Peter Maydell --- linux-user/syscall_defs.h | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index f7cc9f9..16d56fa 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2706,9 +2706,34 @@ struct target_f_owner_ex { #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) -#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) -#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) -#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) +struct target_mtop { + abi_short mt_op; + abi_int mt_count; +}; + +#if defined(TARGET_SPARC) || defined(TARGET_MIPS) +typedef abi_long target_kernel_daddr_t; +#else +typedef abi_int target_kernel_daddr_t; +#endif + +struct target_mtget { + abi_long mt_type; + abi_long mt_resid; + abi_long mt_dsreg; + abi_long mt_gstat; + abi_long mt_erreg; + target_kernel_daddr_t mt_fileno; + target_kernel_daddr_t mt_blkno; +}; + +struct target_mtpos { + abi_long mt_blkno; +}; + +#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) +#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) +#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) struct target_sysinfo { abi_long uptime; /* Seconds since boot */