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: 109641 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp2953701qge; Tue, 8 Aug 2017 06:31:24 -0700 (PDT) X-Received: by 10.31.109.194 with SMTP id i185mr2843336vkc.53.1502199084638; Tue, 08 Aug 2017 06:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502199084; cv=none; d=google.com; s=arc-20160816; b=ChdG5WJ362gX1ixr+H6lFzf7ixWHOT3lrR8Ssjkg6wPvBRCC8CdMUTCMNTEAsqh2Mi YdutDFlMgp15fLxw2/kpnwKmDdSdHnVlUOjC30u8QSG+dkR1cMxs5lRLvIm6jXpQo2Ko WFhkh9DzNyTIfxfkt52T5gXIoD8jjxJ08H3MWmhFtbhvOBherUKtj6ujc/d7zZmT/5NN wT71+8qTdF5FGBd4dAywwJ4C3NBn55NyhIBlUKv2fJXOe0PxWs7kaGPv0yyIDw4P8fbl cBv90ktaNxtGQ034HDaAnVMLQQ24Sew2pg7fzY2+GwphOyt5NPD0ga4GA46oMFMsbn4S E8Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:subject:precedence:message-id :references:to:from:date:content-transfer-encoding:mime-version :arc-authentication-results; bh=YSJUWI7ivcgTkPoLx2qxYNv+qjjKXbFOLXRDTwpC7cw=; b=cUD3L1PBmfD2Ml/UyIx/GdP9wIbdRUenI9ZWTWoSfQjWOtZ9wYi1hQUmf3KvVpQq5V nCjfHGWGpQAtBsgdgH1fo/kuFl878YbPQIt4PK2T23q7SoLdDT9OpzGGf0nukhx344ht DFgJua5QSgx9JI/7GO/xEF36WIl/I7LJ9h8dy+TOQamBW0K0X0iiA+WAUTlOqUcB9kP1 8l2dVSM9bOsne/QFG/0WGOr/Tfdn5XkVeLKQ9nUKOqd6ikwNVoFeqVnsktBeIHUMCiIV jtMffaA+ZDvjyv83vnpfHxlfXMO3f3ijEa5yEufEz1wFJ450ZRcQtmklqAv32DbkNLjY wvyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q63si698121vkg.290.2017.08.08.06.31.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Aug 2017 06:31:24 -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; 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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df4bU-0003En-57 for patch@linaro.org; Tue, 08 Aug 2017 09:31:24 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.11.0 -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1709170 Title: QEMU fails to honor O_TMPFILE Status in QEMU: New Bug description: When making a call like open("/tmp", O_TMPFILE | O_RDWR); under QEMU, we ged -EISDIR. Under any kernel 3.11 or later, we are supposed to get an unnamed file in /tmp. In case the filesystem for /tmp does not support unnamed files, we are supposed to get EOPNOTSUPP. [I don't know the QEMU version, since this happened in a system I don't have access to] To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions 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