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: Sun, 01 May 2022 07:50:53 -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: 055ab89327bab83f1bd07e9de07f7628643d3d8d
      
https://github.com/qemu/qemu/commit/055ab89327bab83f1bd07e9de07f7628643d3d8d
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-05-01 (Sun, 01 May 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>
[C.S. - Use AT_SYMLINK_NOFOLLOW instead of AT_SYMLINK_NOFOLLOW_ANY. ]
Link: https://lore.kernel.org/qemu-devel/3704033.BMyLRrx2Jx@silver/


  Commit: e5c88e2264ebd0bfe35b347b8cdca1e3af784d84
      
https://github.com/qemu/qemu/commit/e5c88e2264ebd0bfe35b347b8cdca1e3af784d84
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-05-01 (Sun, 01 May 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: 951fe2f89f46f5d51eead066556edc7369e23915
      
https://github.com/qemu/qemu/commit/951fe2f89f46f5d51eead066556edc7369e23915
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-05-01 (Sun, 01 May 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: 9ea3164611a63e898a979f2da24caa1abd29d906
      
https://github.com/qemu/qemu/commit/9ea3164611a63e898a979f2da24caa1abd29d906
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-05-01 (Sun, 01 May 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: 063c75db2e03938b2fadb052c4661adae36e352c
      
https://github.com/qemu/qemu/commit/063c75db2e03938b2fadb052c4661adae36e352c
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2022-05-01 (Sun, 01 May 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: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
      
https://github.com/qemu/qemu/commit/f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-05-01 (Sun, 01 May 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-20220501' 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+AhPiFkBNMK1h2Wkc5UFAmJuhqEXHHFlbXVfb3Nz
# QGNydWRlYnl0ZS5jb20ACgkQNMK1h2Wkc5U4fBAAofSRlDuxC0h2irHy0tRRGv+W
# rH1gDVm0jzFChUumarUOs5/hZjG5C4H9nFA0g/6di9bSoiubtA839w/dDmUYV7Xn
# S/8Jvauk/zZley1R1AKK5BEtOjJTlEYkbLqR1i9JPUrUk3Q9A+/f0FhgnW8NU2zu
# KhqbzYZnUXb3P1RyRm4cTh9UCr904OI30mdqiM9U+oJag1Zd3us/Q9sPdqDCYs8e
# vD4UXqG8c5UYpEN6C/ag2p3oJpAzpRa3CLkT5U59j/LhNgVtBPG/Pm5Q9qKHrxiN
# 3p/+36NWLNXMtCKsU4Tf9TsA+tEB1G+QfObC5g8yM0e12dInW7K8KKUIOO7lE5Eq
# a8aXZZC4yjW6y9vml0tC2E8p3n7n3r4MdLIrdY5VoOk72QLLBORq547DN/c5vt8A
# Qsj2eZTvkrZNVmpQKpanwc8nsavslenFmQVVo+E6kuEOhTJpBeahsEx/ReH4D9rg
# Hmq9O+xnPXodrj4DI1uqdwxN37A6bAn/4UAnQiPosnbzn+a6rZ3TZZ7x6ZZVwVub
# MyPdWSwu0JujcD8Goina7f12tDOt2GaYrbegH4AG3B6kpMUQD6vwzcAFwZMP/0zZ
# XMQnhR/lrvpsuBymuNA8cHRjccK6uGHxCEbstSsvKJCw0GqSonvTzMKY43HtgWmz
# XjQe3jVk2+U5Aw8umTU=
# =KBDF
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 01 May 2022 06:09:53 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-20220501' 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/1dca4af18189...f5643914a9e8



reply via email to

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