From patchwork Mon Oct 17 13:24:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 77749 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp400586qge; Mon, 17 Oct 2016 06:40:48 -0700 (PDT) X-Received: by 10.55.101.201 with SMTP id z192mr22144328qkb.35.1476711648127; Mon, 17 Oct 2016 06:40:48 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 143si17939952qkf.329.2016.10.17.06.40.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 17 Oct 2016 06:40:48 -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]:33124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw89n-0007P1-JM for patch@linaro.org; Mon, 17 Oct 2016 09:40:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7uZ-0003Fb-TR for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw7uY-0003G0-V4 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:03 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:34502) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bw7uY-0003Fa-MY for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:02 -0400 Received: by mail-lf0-x22a.google.com with SMTP id b81so285339539lfe.1 for ; Mon, 17 Oct 2016 06:25:02 -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=RLxY/lJF0FEgoxHW3Rx3xdght+aaf0dAl41GG5rikZ1/ham+wVF2bPsLJERpLTWTX0 Mgldhs2jx2ynUajRe+e6vWrLhqZvhYDPlqjTZZbhDL6wZAymkNeNzjC4ba4prwwNAQEq EBa6dsbdpTUHxJADZFFo6OQgXbV7Awj21WSdo= 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=Do8WFA5hSvcpMkimCBzC7ORAAiLuf1nVAa34laIrGoOuDk+7HiClom1iGG/E34Ca0A fMJF/WUx09ucswZ5zmWr9lHxbX6vru3p5Gk9YOVmdQCeynSdew830P3+dhXO6vWXFZlT 4NWcXU9UEBjm0qE+NOOWkF/eTKuH19W9AEvBO8Gt5nptKsASHY2KWIySPvFdgo+gnCR3 oZukv/vUjHZhqwCKCbPT8X5Z+5LfARI1vatm1QOgVa7ipNLr2GZW+Slr8cx1XZKicoIs Zb4KbjBP8fLq5+w+OYw3r2Oi9J9oH0SnOx3A8nmxz3tEOJZgU3cCnQ4YmHLx9Ns8GWJR fPnw== X-Gm-Message-State: AA6/9RkoXjfYMzVoTYzEEV7PdfQGgkzCO2N9/f/xyi/YiltapW0OcRcy6j2Gy/CfwvYNj2lO X-Received: by 10.25.24.93 with SMTP id o90mr15186266lfi.74.1476710699646; Mon, 17 Oct 2016 06:24:59 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id y81sm7782857lff.29.2016.10.17.06.24.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 06:24:58 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 16:24:31 +0300 Message-Id: <14a98cd2984aa70e1c085c3fe943d91f52ba89e7.1476710353.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::22a Subject: [Qemu-devel] [PULL 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; };