From patchwork Thu May 23 17:54:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1104336 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 458xxG5lZzz9s1c for ; Fri, 24 May 2019 03:55:28 +1000 (AEST) Received: from localhost ([127.0.0.1]:41365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTrw6-0007JN-2Y for incoming@patchwork.ozlabs.org; Thu, 23 May 2019 13:55:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTrvk-0007DA-SA for qemu-devel@nongnu.org; Thu, 23 May 2019 13:55:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTrvj-000455-EP for qemu-devel@nongnu.org; Thu, 23 May 2019 13:55:04 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:59173) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTrvj-00044S-59 for qemu-devel@nongnu.org; Thu, 23 May 2019 13:55:03 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MORN0-1hH7OV01YU-00PwkK; Thu, 23 May 2019 19:54:21 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 19:54:13 +0200 Message-Id: <20190523175413.14448-1-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:SLwN8cRc5Nl8DSKyHNnXjJHJSabtIj4F3VwCbnhOE3/uZmfVLWY isucfvQefJPt8jerEzgXTXdTvf8kZ/pbC7miQyutJPy6MStiYFs4P2tNaLZXYc/0DzmPorW S5DVKZANJpsAT4pUwFmFH8/QYdO6pTmohYgguEtvtITBWCKeA8w+ZuMSbs0GAPg5x9tRRm9 shfJagnWZeqE2MkVVznRg== X-UI-Out-Filterresults: notjunk:1; V03:K0:nI17I7pbAWg=:btWKmcssONsqhBjqZxjAe0 gTjFseiCVcXfRu1fzfI1JQUMXT/tCKbQ4WlTs8TWxvHpwOipn3SI40TM1ul3J6IL4y4Tj/XJG 7GYUHedChAAHTz7nNs4ynU9XpULvPkJRtqFuL0mkJv854s7okD+Vbd/CKqhUKzlzAK846brB7 /UR5DkSnUhmrqnjfy5ku4nYb9Pp+GaZJRlFNJMlk+aZRjsn1jBnrgsclbEh5FOaKf0gxNbRPf 11D2X+IetwbfuWMOhb4F29qI7JOR07SgiMDOxb9n1bIeQ+XPnlJi3mmV0/Mi/GqlNwrNdWmXg RNmjSS9jdKF+Lh0obEmtbM5cbmv05NpVx7iEmmCb2/xIJjM0AYEfkTW9Ua0CXY442HX2q1vqg PW+CzzXXVPyeWqCN3JW6pVkNhurmIlryKcKyyKtuynz2JtdzQG9Yb2TXhaJgzMhkD8WTTZ0+3 QuIcj0JLAqPG31Ytqg9PR3YxUw4ph4kmnaiPHQ904nYyMQiACSO3TFA//d4Kl5XD3IiaS8e+d XcJlqq1AZvk+Y4geDaH/wNLOFSOvKOB0QfAYC50GKqjwaee5wltU+RsKTfPk6pF00l+gCqreb Pb2tiIEWFEZ3f5eq7WPJ1b51tIgOEDKACb/6YuOkQE21l2oAnWBEv+8EkqO7njggSBelQzJ5Y /Za8Mu0M4UDLQ/R93fVM69U0w3CtCTtGVvOdPxZd2xRcy0eTTG0JZvrNwgXF2FdC6MlBqBXEi w9mvhZUKl1eTBAY7nnG2kKUARwpNftBvy4i9D7Rna4N/6teoru0Z6UNmdco= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 Subject: [Qemu-devel] [PATCH] linux-user: fix __NR_semtimedop undeclared error 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 , Cornelia Huck , =?utf-8?q?Alex_Benn=C3=A9e?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Aleksandar Markovic Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In current code, __NR_msgrcv and__NR_semtimedop are supposed to be defined if __NR_msgsnd is defined. But linux headers 5.2-rc1 for MIPS define __NR_msgsnd without defining __NR_semtimedop and it breaks the QEMU build. __NR_semtimedop is defined in asm-mips/unistd_n64.h and asm-mips/unistd_n32.h but not in asm-mips/unistd_o32.h. Commit d9cb4336159a ("linux headers: update against Linux 5.2-rc1") has updated asm-mips/unistd_o32.h and added __NR_msgsnd but not __NR_semtimedop. It introduces __NR_semtimedop_time64 instead. This patch fixes the problem by checking for each __NR_XXX symbol before defining the corresponding syscall. Fixes: d9cb4336159a ("linux headers: update against Linux 5.2-rc1") Reported-by: Philippe Mathieu-Daudé Signed-off-by: Laurent Vivier Tested-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Reviewed-by: Alex Bennée Tested-by: Alex Bennée --- linux-user/syscall.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e311fcda0517..d316de25c9f2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -761,14 +761,7 @@ safe_syscall2(int, nanosleep, const struct timespec *, req, safe_syscall4(int, clock_nanosleep, const clockid_t, clock, int, flags, const struct timespec *, req, struct timespec *, rem) #endif -#ifdef __NR_msgsnd -safe_syscall4(int, msgsnd, int, msgid, const void *, msgp, size_t, sz, - int, flags) -safe_syscall5(int, msgrcv, int, msgid, void *, msgp, size_t, sz, - long, msgtype, int, flags) -safe_syscall4(int, semtimedop, int, semid, struct sembuf *, tsops, - unsigned, nsops, const struct timespec *, timeout) -#else +#if !defined(__NR_msgsnd) || !defined(__NR_msgrcv) || !defined(__NR_semtimedop) /* This host kernel architecture uses a single ipc syscall; fake up * wrappers for the sub-operations to hide this implementation detail. * Annoyingly we can't include linux/ipc.h to get the constant definitions @@ -783,14 +776,29 @@ safe_syscall4(int, semtimedop, int, semid, struct sembuf *, tsops, safe_syscall6(int, ipc, int, call, long, first, long, second, long, third, void *, ptr, long, fifth) +#endif +#ifdef __NR_msgsnd +safe_syscall4(int, msgsnd, int, msgid, const void *, msgp, size_t, sz, + int, flags) +#else static int safe_msgsnd(int msgid, const void *msgp, size_t sz, int flags) { return safe_ipc(Q_IPCCALL(0, Q_MSGSND), msgid, sz, flags, (void *)msgp, 0); } +#endif +#ifdef __NR_msgrcv +safe_syscall5(int, msgrcv, int, msgid, void *, msgp, size_t, sz, + long, msgtype, int, flags) +#else static int safe_msgrcv(int msgid, void *msgp, size_t sz, long type, int flags) { return safe_ipc(Q_IPCCALL(1, Q_MSGRCV), msgid, sz, flags, msgp, type); } +#endif +#ifdef __NR_semtimedop +safe_syscall4(int, semtimedop, int, semid, struct sembuf *, tsops, + unsigned, nsops, const struct timespec *, timeout) +#else static int safe_semtimedop(int semid, struct sembuf *tsops, unsigned nsops, const struct timespec *timeout) {