qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 0009df: 9pfs: fix inode sequencing in 'synth'


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 0009df: 9pfs: fix inode sequencing in 'synth' driver
Date: Sat, 30 Apr 2022 05:48:44 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 0009df31cb51cb2be681f4eebd58a9776d75a580
      
https://github.com/qemu/qemu/commit/0009df31cb51cb2be681f4eebd58a9776d75a580
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-synth.c

  Log Message:
  -----------
  9pfs: fix inode sequencing in 'synth' driver

The 'synth' driver's root node and the 'synth' driver's first
subdirectory node falsely share the same inode number (zero), which
makes it impossible for 9p clients (i.e. 9p test cases) to distinguish
root node and first subdirectory from each other by comparing their QIDs
(which are derived by 9p server from driver's inode numbers).

Fix this issue by using prefix-increment instead of postfix-increment
operator while generating new inode numbers for subdirectories and files.

Link: https://lore.kernel.org/qemu-devel/3859307.hTDP4D0zbi@silver/
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <E1nTpyU-0000yR-9o@lizzy.crudebyte.com>


  Commit: 096af171274cc76c51bf11366ae257391ddfed2a
      
https://github.com/qemu/qemu/commit/096af171274cc76c51bf11366ae257391ddfed2a
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-util-darwin.c

  Log Message:
  -----------
  9pfs: fix qemu_mknodat(S_IFREG) on macOS

mknod() on macOS does not support creating regular files, so
divert to openat_file() if S_IFREG is passed with mode argument.

Furthermore, 'man 2 mknodat' on Linux says: "Zero file type is
equivalent to type S_IFREG".

Link: https://lore.kernel.org/qemu-devel/17933734.zYzKuhC07K@silver/
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Will Cohen <wwcohen@gmail.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<3102ca936f88bc1f79d2a325e5bc68f48f54e6e3.1651228000.git.qemu_oss@crudebyte.com>


  Commit: c621d5c0ba22b25e2d5b3d9d7ee0877461776683
      
https://github.com/qemu/qemu/commit/c621d5c0ba22b25e2d5b3d9d7ee0877461776683
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-util-darwin.c

  Log Message:
  -----------
  9pfs: fix qemu_mknodat(S_IFSOCK) on macOS

mknod() on macOS does not support creating sockets, so divert to
call sequence socket(), bind() and fchmodat() respectively if S_IFSOCK
was passed with mode argument.

Link: https://lore.kernel.org/qemu-devel/17933734.zYzKuhC07K@silver/
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<2e7b5ecd7a6d83a538db4e8a22d8fb03e9e0f06e.1651228001.git.qemu_oss@crudebyte.com>


  Commit: ea39a4bc024582a26ca0786771557f854eaf84f4
      
https://github.com/qemu/qemu/commit/ea39a4bc024582a26ca0786771557f854eaf84f4
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-util.h
    M hw/9pfs/9p.c

  Log Message:
  -----------
  9pfs: fix wrong encoding of rdev field in Rgetattr on macOS

The 'rdev' field in 9p reponse 'Rgetattr' is of type dev_t,
which is actually a system dependant type and therefore both the
size and encoding of dev_t differ between macOS and Linux.

So far we have sent 'rdev' to guest in host's dev_t format as-is,
which caused devices to appear with wrong device numbers on
guests running on macOS hosts, eventually leading to various
misbehaviours on guest in conjunction with device files.

This patch fixes this issue by converting the device number from
host's dev_t format to Linux dev_t format. As 9p request
'Tgettattr' is exclusive to protocol version 9p2000.L, it should
be fair to assume that 'rdev' field is assumed to be in Linux dev_t
format by client as well.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Link: https://lore.kernel.org/qemu-devel/20220421093056.5ab1e7ed@bahia/
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<b3a430c2c382ba69a7405e04c0b090ab0d86f17e.1651228001.git.qemu_oss@crudebyte.com>


  Commit: b3779960b7d5bb9dd438e1d3fbece2b027d2ed48
      
https://github.com/qemu/qemu/commit/b3779960b7d5bb9dd438e1d3fbece2b027d2ed48
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-util.h
    M hw/9pfs/9p.c

  Log Message:
  -----------
  9pfs: fix wrong errno being sent to Linux client on macOS host

Linux and macOS only share some errno definitions with equal macro
name and value. In fact most mappings for errno are completely
different on the two systems.

This patch converts some important errno values from macOS host to
corresponding Linux errno values before eventually sending such error
codes along with 'Rlerror' replies (if 9p2000.L is used that is). Not
having translated errnos before violated the 9p2000.L protocol spec,
which says:

  "
  size[4] Rlerror tag[2] ecode[4]

  ... ecode is a numerical Linux errno.
  "

  https://github.com/chaos/diod/wiki/protocol#lerror----return-error-code

This patch fixes a bunch of misbehaviours when running a Linux client
on macOS host. For instance this patch fixes:

  mount -t 9p -o posixacl ...

on Linux guest if security_mode=mapped was used for 9p server, which
refused to mount successfully, because macOS returned ENOATTR==93
when client tried to retrieve POSIX ACL xattrs, because errno 93
is defined as EPROTONOSUPPORT==93 on Linux, so Linux client believed
that xattrs were not supported by filesystem on host in general.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Link: https://lore.kernel.org/qemu-devel/20220421124835.3e664669@bahia/
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<b322ab298a62069e527d2b032028bdc9115afacd.1651228001.git.qemu_oss@crudebyte.com>


  Commit: 84a89408326215e2b423f23c1af415cfd773d099
      
https://github.com/qemu/qemu/commit/84a89408326215e2b423f23c1af415cfd773d099
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-posix-acl.c

  Log Message:
  -----------
  9pfs: fix removing non-existent POSIX ACL xattr on macOS host

When mapped POSIX ACL is used, we are ignoring errors when trying
to remove a POSIX ACL xattr that does not exist. On Linux hosts we
would get ENODATA in such cases, on macOS hosts however we get
ENOATTR instead.

As we can be sure that ENOATTR is defined as being identical on Linux
hosts (at least by qemu/xattr.h), it is safe to fix this issue by
simply comparing against ENOATTR instead of ENODATA.

This patch fixes e.g. a command on Linux guest like:

  cp --preserve=mode old new

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Link: https://lore.kernel.org/qemu-devel/2866993.yOYK24bMf6@silver/
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<34f81e9bffd7a3e65fb7aab5b56c107bd0aac960.1651228001.git.qemu_oss@crudebyte.com>


  Commit: e8fb9ed725fe2ed00a275674a84beb5ba6e538a7
      
https://github.com/qemu/qemu/commit/e8fb9ed725fe2ed00a275674a84beb5ba6e538a7
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-util-darwin.c

  Log Message:
  -----------
  9pfs: fix qemu_mknodat() to always return -1 on error on macOS host

qemu_mknodat() is expected to behave according to its POSIX API, and
therefore should always return exactly -1 on any error, and errno
should be set for the actual error code.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: 
<c714b5e1cae225ab7575242c45ee0fe4945eb6ad.1651228001.git.qemu_oss@crudebyte.com>


  Commit: 5df9aec8f1317f1671a120a4ba73bdfc4ca12961
      
https://github.com/qemu/qemu/commit/5df9aec8f1317f1671a120a4ba73bdfc4ca12961
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M hw/9pfs/9p-posix-acl.c
    M hw/9pfs/9p-synth.c
    M hw/9pfs/9p-util-darwin.c
    M hw/9pfs/9p-util.h
    M hw/9pfs/9p.c

  Log Message:
  -----------
  Merge tag 'pull-9p-20220430' of https://github.com/cschoenebeck/qemu into 
staging

9pfs: various fixes

* macOS: Fix recently (in QEMU 7.0) added 9p support for macOS hosts.

* Tests: Fix inode sequencing in 'synth' driver.

# -----BEGIN PGP SIGNATURE-----
#
# iQJLBAABCgA1FiEEltjREM96+AhPiFkBNMK1h2Wkc5UFAmJtIRcXHHFlbXVfb3Nz
# QGNydWRlYnl0ZS5jb20ACgkQNMK1h2Wkc5Uy6g//Vgcm97FuzyNHRikbt25OH9ZG
# sHM94i1GF7yK+7STUROae2PwWyh6BhSyx12mAslOBHjT4FUow4feY9/RJdD2LOIU
# r8c6r2i3Hd2aTTjWeKUTkx/PPx9bLXda1CfwPrDNpV0Wm3hxd8unBuHzxOmnhN7U
# xVvjB+iC8da8nQAdqNiG6Ospp06+xgg0wau9K2/u9CTn6dp1dDyhBEPWr+GiVhLS
# SFnR2cIjbv7rGWJItCF5shEZ9NsaNGofUgb0z4j6mz6eIUocEJNSKFIReduQVqCi
# AtbKNKivwXy0vuWetbm6krbgZ0mspo8wB2e+llh/lPmKyJlYh/PRhKyqiq64fLke
# jNP7gYw6cov4CoU3uJXf90evhv7SdujXeLyf+O1HVBNSuK5lBH4D1KuFbEyTqmjV
# Uycgo1Jw0Ma780tXM4XXo6si4BP8iXVhDR6lmMGH5/V/X9wpxqyW7nPJl1wILBy+
# Q8I2g3sr+oHII42Z2ZFcLL0CPximDzDVckgmaYozoBAnBdPw3Qxi22RuC3ETP/A3
# rakPUuEFgHoMbko79iEM7yEo64zF0GsRYmof8cdKLin1UBdwVXqxMgXDr9U1p5o5
# jcqOsYP3iUjFA7HqvnjtnqGG+DnWffy2o23oiIXLBCht6LwoYMfA+Ve3WO/6y6OA
# zZ4rLQe9aRnT70Q0U5o=
# =tnUD
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 30 Apr 2022 04:44:23 AM PDT
# gpg:                using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395
# gpg:                issuer "qemu_oss@crudebyte.com"
# gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" 
[unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: ECAB 1A45 4014 1413 BA38  4926 30DB 47C3 A012 D5F4
#      Subkey fingerprint: 96D8 D110 CF7A F808 4F88  5901 34C2 B587 65A4 7395

* tag 'pull-9p-20220430' of https://github.com/cschoenebeck/qemu:
  9pfs: fix qemu_mknodat() to always return -1 on error on macOS host
  9pfs: fix removing non-existent POSIX ACL xattr on macOS host
  9pfs: fix wrong errno being sent to Linux client on macOS host
  9pfs: fix wrong encoding of rdev field in Rgetattr on macOS
  9pfs: fix qemu_mknodat(S_IFSOCK) on macOS
  9pfs: fix qemu_mknodat(S_IFREG) on macOS
  9pfs: fix inode sequencing in 'synth' driver

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/6b6b27f49ebd...5df9aec8f131



reply via email to

[Prev in Thread] Current Thread [Next in Thread]