From patchwork Tue Oct 18 13:21:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9382117 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 630C4607D0 for ; Tue, 18 Oct 2016 13:22:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5419829567 for ; Tue, 18 Oct 2016 13:22:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47BC4295F0; Tue, 18 Oct 2016 13:22:42 +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 72EFE29567 for ; Tue, 18 Oct 2016 13:22:41 +0000 (UTC) Received: from localhost ([::1]:41501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULo-0006GU-5S for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Oct 2016 09:22:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULB-0006E2-4z for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwUL9-0000dD-Qd for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:01 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:35880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwUL9-0000ca-Iy for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:21:59 -0400 Received: by mail-lf0-x231.google.com with SMTP id b75so346718078lfg.3 for ; Tue, 18 Oct 2016 06:21:59 -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=PvOi65ZSh4teBb+m6/mPAAwR/I2cinFeCFmy4dZauv8=; b=YJlxhcw4E9fVnj4mtB0/kTPuzm4xBNLezntcB2KRKBXT2ki+riz+UWCTZQu94Hr7Br 6H/XniPefVOi82K9SIeeBRBlWCqs7m+GAg4ckK3vXjv05DzVRghngYo0EOoqcMfa7sU7 h5LLD/xBWqH6lE+U6978c8v/UaW/TcnjXqSS4= 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=PvOi65ZSh4teBb+m6/mPAAwR/I2cinFeCFmy4dZauv8=; b=Z90/wJvUad+A+lxZHP05dj+HBflbqZhPRDKQFIZ0JesOe3MzkSSi1yz6DAn6OPsrJs 1PnjNUhtOQMVVBe5nSV7AEQEcbeAeVOLYo8eOKQvC42KxSUMwR4gvkACTiXcRHL+XEl0 KRM2++8uTQlhDguWEWCRKLZVK7xnFx+vjxbLmmPV+AjjFDXGTG2nu0mTbPEF52kfRnSK V3aTOF7DWBOPC1Y+Fb4UloDiIUbvba1V+EdvXEdSlGNHdGl/NMQv1kxo+6a54Uy0rRH9 tsmHQieOCw4V9KYDOWe/c1gxnUQZ/m8O0jp4rLsFeyyEwxTwXYMtbnRqSXH8qucG3mNc ippg== X-Gm-Message-State: AA6/9RmNL4PpU1NVGcPYvN9wq2VtN4RLnN5yRG+ZS5oKyad7r1ztArQbfGTPu2ZX5UTs27o9 X-Received: by 10.25.201.137 with SMTP id z131mr584255lff.144.1476796916980; Tue, 18 Oct 2016 06:21:56 -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.21.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:21:56 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 18 Oct 2016 16:21:32 +0300 Message-Id: <3d7a16fa0fb5e8640e14bf845195d1df13dc99f7.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::231 Subject: [Qemu-devel] [PULL v2 04/22] linux-user: Fix msgrcv() and msgsnd() syscalls support 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 , Aleksandar Markovic Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Aleksandar Markovic If syscalls msgrcv() and msgsnd() fail, they return E2BIG, EACCES, EAGAIN, EFAULT, EIDRM, EINTR, EINVAL, ENOMEM, or ENOMSG. By examining negative scenarios of these syscalls for Mips, it was established that ENOMSG does not have the same value accross all platforms, but it is nevertheless not included for conversion in the correspondant conversion table defined in linux-user/syscall.c. This is certainly a bug, since it leads to the incorrect emulation of msgrcv() and msgsnd() for scenarios involving ENOMSG. This patch fixes this by extending the conversion table to include ENOMSG. Also, LTP test msgrcv04 will be fixed for some platforms. Signed-off-by: Aleksandar Markovic Reviewed-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e031ecf..032cb76 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -790,6 +790,9 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = { #ifdef ENOTRECOVERABLE [ENOTRECOVERABLE] = TARGET_ENOTRECOVERABLE, #endif +#ifdef ENOMSG + [ENOMSG] = TARGET_ENOMSG, +#endif }; static inline int host_to_target_errno(int err)