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: 9382139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 68751600CA for ; Tue, 18 Oct 2016 13:31:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5848A294A9 for ; Tue, 18 Oct 2016 13:31:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D23429572; Tue, 18 Oct 2016 13:31:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6488294A9 for ; Tue, 18 Oct 2016 13:31:39 +0000 (UTC) Received: from localhost ([::1]:41545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUUV-0005lL-1n for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Oct 2016 09:31:39 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; };