From patchwork Tue Aug 8 13:21:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9888189 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 376DB60352 for ; Tue, 8 Aug 2017 13:32:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2931628906 for ; Tue, 8 Aug 2017 13:32:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E0432893E; Tue, 8 Aug 2017 13:32:05 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 B67DB28906 for ; Tue, 8 Aug 2017 13:32:04 +0000 (UTC) Received: from localhost ([::1]:42607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df4c7-0003En-V4 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Aug 2017 09:32:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df4b3-0003DB-RE for qemu-devel@nongnu.org; Tue, 08 Aug 2017 09:31:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1df4ay-0004cP-MH for qemu-devel@nongnu.org; Tue, 08 Aug 2017 09:30:57 -0400 Received: from indium.canonical.com ([91.189.90.7]:44717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1df4ay-0004aR-FK for qemu-devel@nongnu.org; Tue, 08 Aug 2017 09:30:52 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1df4ax-0008IJ-Ej for ; Tue, 08 Aug 2017 13:30:51 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 67C492E80C9 for ; Tue, 8 Aug 2017 13:30:51 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 08 Aug 2017 13:21:47 -0000 From: Riku Voipio To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=New; importance=Undecided; assignee=None; X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: riku-voipio thiago-kde X-Launchpad-Bug-Reporter: Thiago Macieira (thiago-kde) X-Launchpad-Bug-Modifier: Riku Voipio (riku-voipio) References: <150213708469.19430.16716526584783151905.malonedeb@chaenomeles.canonical.com> Message-Id: <20170808132147.GA29384@kos.to> X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="18446"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 5b32d207b50f85346710ce861d411b743905b6c8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 91.189.90.7 Subject: [Qemu-devel] [Bug 1709170] [PATCH] linux-user: fix O_TMPFILE handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1709170 <1709170@bugs.launchpad.net> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since O_TMPFILE might differ between guest and host, add it to the bitmask_transtbl. While at it, fix the definitions of O_DIRECTORY etc on arm64, which are identical to arm32 according to kernel sources. This fixes open14 and openat03 ltp testcases. Fixes: https://bugs.launchpad.net/qemu/+bug/1709170 --- linux-user/strace.c | 4 ++++ linux-user/syscall.c | 3 +++ linux-user/syscall_defs.h | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index d821d165ff..bd897a3f20 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -838,6 +838,10 @@ UNUSED static struct flags open_flags[] = { #ifdef O_PATH FLAG_TARGET(O_PATH), #endif +#ifdef O_TMPFILE + FLAG_TARGET(O_TMPFILE), + FLAG_TARGET(__O_TMPFILE), +#endif FLAG_END, }; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 54343c06be..b3aa8099b4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -342,6 +342,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = { #if defined(O_PATH) { TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH }, #endif +#if defined(O_TMPFILE) + { TARGET_O_TMPFILE, TARGET_O_TMPFILE, O_TMPFILE, O_TMPFILE }, +#endif /* Don't terminate the list prematurely on 64-bit host+guest. */ #if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0 { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, }, diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 40c5027e93..6e2287e918 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2416,7 +2416,7 @@ struct target_statfs64 { #define TARGET_O_CLOEXEC 010000000 #define TARGET___O_SYNC 000100000 #define TARGET_O_PATH 020000000 -#elif defined(TARGET_ARM) || defined(TARGET_M68K) +#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64) #define TARGET_O_DIRECTORY 040000 /* must be a directory */ #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ @@ -2513,6 +2513,12 @@ struct target_statfs64 { #ifndef TARGET_O_PATH #define TARGET_O_PATH 010000000 #endif +#ifndef TARGET___O_TMPFILE +#define TARGET___O_TMPFILE 020000000 +#endif +#ifndef TARGET_O_TMPFILE +#define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY) +#endif #ifndef TARGET_O_NDELAY #define TARGET_O_NDELAY TARGET_O_NONBLOCK #endif