From patchwork Tue Oct 18 13:21:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 78044 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp888001qge; Tue, 18 Oct 2016 06:33:49 -0700 (PDT) X-Received: by 10.200.35.153 with SMTP id q25mr536429qtq.10.1476797629817; Tue, 18 Oct 2016 06:33:49 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y2si21027516qtb.15.2016.10.18.06.33.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:33:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUWb-0007V2-8j for patch@linaro.org; Tue, 18 Oct 2016 09:33:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULK-0006Ju-Bu for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwULJ-0000hD-Fi for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:10 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:33413) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwULJ-0000gb-8F for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:09 -0400 Received: by mail-lf0-x233.google.com with SMTP id x79so355983155lff.0 for ; Tue, 18 Oct 2016 06:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G6vSsIqf3EKR7yF1sSVqrlCn7VnWRpDvpmAU2q4xCoY=; b=Lk+SrTFaBKrjrAO5znYjCkCWoaLEnTRF6DZXgc5K8IcNTqAWySur2TL9un4+e2enQ6 enhnZSUdLGD2FomtsI122z5xAnWTREYpl+cKOztuLQvolg2azTr8cUq7ywRPRaIbRbGD VlPGrdDGl4fHA8tGNFx5k7l/95cLyR6DemGKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G6vSsIqf3EKR7yF1sSVqrlCn7VnWRpDvpmAU2q4xCoY=; b=BM0BEE4Ck+vvupFL6DYMlGQr315ms8cSWEBM681y4tA2hoh8nP2+My35l2foa6Tv8u 2eWKgHWDnkbZ0AsaEh30CLCK3uFtkDDM/tuozJo+Dw+DaNGrcyCvf6BAdODrnc3xpISl iID8j7WdW8p3ZklSXwY2uHapZsXUbO5SoV+Mnh+4W7vQZbL3rNHPcAA1uaVSHPcfAuPE T9CgSj6UfHfJZniIbUGXbUYxXZBYXbtCawlKgisfD+RoC5d8KVdbVZHsx7OTok19ILvT O6TKsrJVAfFFgp2IBDnauFp0euWB+Fi6ncuuqHBEbShMpeeLo6UhAAacFyDDZ9YJFcNt TYyw== X-Gm-Message-State: AA6/9Rmw3SjOV09Bv77HGWmNqdXkcOgffqLZR+a9jKjOLRXwPjcjU26Tho3ytYRIJVTPnp+6 X-Received: by 10.25.18.97 with SMTP id h94mr597217lfi.106.1476796927560; Tue, 18 Oct 2016 06:22:07 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 201sm9535359ljf.48.2016.10.18.06.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:22:06 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 18 Oct 2016 16:21:41 +0300 Message-Id: <99bc513fafc067838eb9b397b1fff64423100a21.1476796525.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::233 Subject: [Qemu-devel] [PULL v2 13/22] linux-user: Fix definition of target_sigevent for 32-bit guests 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The sigevent structure includes a union with some fields which are pointers. For the QEMU target_sigevent structure we must represent these as abi_ulongs, not host function pointers. This error was causing the compiler to believe it should 8-align the _sigev_un union on a 64-bit host, which meant that the code in target_to_host_sigevent() was looking at the wrong offset to find the _tid field, and timer_create() would spuriously fail with EINVAL. This fixes the final loose end noted in LP:1042388. While we're editing the structure, switch the 'int32_t' fields to 'abi_int'; this will only matter for guests with non-standard integer alignment like m68k. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall_defs.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 61270ef..714ae28 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2664,15 +2664,19 @@ typedef int32_t target_timer_t; struct target_sigevent { target_sigval_t sigev_value; - int32_t sigev_signo; - int32_t sigev_notify; + abi_int sigev_signo; + abi_int sigev_notify; union { - int32_t _pad[TARGET_SIGEV_PAD_SIZE]; - int32_t _tid; + abi_int _pad[TARGET_SIGEV_PAD_SIZE]; + abi_int _tid; + /* The kernel (and thus QEMU) never looks at these; + * they're only used as part of the ABI between a + * userspace program and libc. + */ struct { - void (*_function)(sigval_t); - void *_attribute; + abi_ulong _function; + abi_ulong _attribute; } _sigev_thread; } _sigev_un; };