qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 870328: 9p: unsigned type for type, version,


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 870328: 9p: unsigned type for type, version, path
Date: Mon, 14 Oct 2019 07:08:27 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 870328335286385b5a78ba7d925b46dc5ba74d7f
      
https://github.com/qemu/qemu/commit/870328335286385b5a78ba7d925b46dc5ba74d7f
  Author: Antonios Motakis <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

  Changed paths:
    M fsdev/9p-marshal.h
    M hw/9pfs/9p.c
    M hw/9pfs/trace-events

  Log Message:
  -----------
  9p: unsigned type for type, version, path

There is no need for signedness on these QID fields for 9p.

Signed-off-by: Antonios Motakis <address@hidden>
[CS: - Also make QID type unsigned.
     - Adjust donttouch_stat() to new types.
     - Adjust trace-events to new types. ]
Signed-off-by: Christian Schoenebeck <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: c0da0cb7614db9a6ba6e8f00cea4c86844bb3e22
      
https://github.com/qemu/qemu/commit/c0da0cb7614db9a6ba6e8f00cea4c86844bb3e22
  Author: Greg Kurz <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

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

  Log Message:
  -----------
  9p: Simplify error path of v9fs_device_realize_common()

Make v9fs_device_unrealize_common() idempotent and use it for rollback,
in order to reduce code duplication.

Signed-off-by: Greg Kurz <address@hidden>


  Commit: ea52cdd443840448c198fec48e5a9ea5f40564f0
      
https://github.com/qemu/qemu/commit/ea52cdd443840448c198fec48e5a9ea5f40564f0
  Author: Greg Kurz <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

  Changed paths:
    M fsdev/qemu-fsdev-throttle.c
    M fsdev/qemu-fsdev-throttle.h
    M hw/9pfs/9p-local.c

  Log Message:
  -----------
  fsdev: Add return value to fsdev_throttle_parse_opts()

It is more convenient to use the return value of the function to notify
errors, rather than to be tied up setting up the &local_err boilerplate.

Signed-off-by: Greg Kurz <address@hidden>


  Commit: 3b5ee9e86b68fff5db5f68499311239485776ea9
      
https://github.com/qemu/qemu/commit/3b5ee9e86b68fff5db5f68499311239485776ea9
  Author: Antonios Motakis <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

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

  Log Message:
  -----------
  9p: Treat multiple devices on one export as an error

The QID path should uniquely identify a file. However, the
inode of a file is currently used as the QID path, which
on its own only uniquely identifies files within a device.
Here we track the device hosting the 9pfs share, in order
to prevent security issues with QID path collisions from
other devices.

We only print a warning for now but a subsequent patch will
allow users to have finer control over the desired behaviour.
Failing the I/O will be one the proposed behaviour, so we
also change stat_to_qid() to return an error here in order to
keep other patches simpler.

Signed-off-by: Antonios Motakis <address@hidden>
[CS: - Assign dev_id to export root's device already in
       v9fs_device_realize_common(), not postponed in
       stat_to_qid().
     - error_report_once() if more than one device was
       shared by export.
     - Return -ENODEV instead of -ENOSYS in stat_to_qid().
     - Fixed typo in log comment. ]
Signed-off-by: Christian Schoenebeck <address@hidden>
[groug, changed to warning, updated message and changelog]
Signed-off-by: Greg Kurz <address@hidden>


  Commit: 1a6ed33cc56997479bbe5b48337ff8da44585bd4
      
https://github.com/qemu/qemu/commit/1a6ed33cc56997479bbe5b48337ff8da44585bd4
  Author: Antonios Motakis <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

  Changed paths:
    M fsdev/file-op-9p.h
    M fsdev/qemu-fsdev-opts.c
    M fsdev/qemu-fsdev.c
    M hw/9pfs/9p-local.c
    M hw/9pfs/9p.c
    M hw/9pfs/9p.h
    M qemu-options.hx
    M vl.c

  Log Message:
  -----------
  9p: Added virtfs option 'multidevs=remap|forbid|warn'

'warn' (default): Only log an error message (once) on host if more than one
device is shared by same export, except of that just ignore this config
error though. This is the default behaviour for not breaking existing
installations implying that they really know what they are doing.

'forbid': Like 'warn', but except of just logging an error this
also denies access of guest to additional devices.

'remap': Allows to share more than one device per export by remapping
inodes from host to guest appropriately. To support multiple devices on the
9p share, and avoid qid path collisions we take the device id as input to
generate a unique QID path. The lowest 48 bits of the path will be set
equal to the file inode, and the top bits will be uniquely assigned based
on the top 16 bits of the inode and the device id.

Signed-off-by: Antonios Motakis <address@hidden>
[CS: - Rebased to https://github.com/gkurz/qemu/commits/9p-next
       (SHA1 7fc4c49e91).
     - Added virtfs option 'multidevs', original patch simply did the inode
       remapping without being asked.
     - Updated hash calls to new xxhash API.
     - Updated docs for new option 'multidevs'.
     - Fixed v9fs_do_readdir() not having remapped inodes.
     - Log error message when running out of prefixes in
       qid_path_prefixmap().
     - Fixed definition of QPATH_INO_MASK.
     - Wrapped qpp_table initialization to dedicated qpp_table_init()
       function.
     - Dropped unnecessary parantheses in qpp_lookup_func().
     - Dropped unnecessary g_malloc0() result checks. ]
Signed-off-by: Christian Schoenebeck <address@hidden>
[groug: - Moved "multidevs" parsing to the local backend.
        - Added hint to invalid multidevs option error.
        - Turn "remap" into "x-remap". ]
Signed-off-by: Greg Kurz <address@hidden>


  Commit: f3fe4a2d92bb4ee5b599b8b1eb781b2ae68af36c
      
https://github.com/qemu/qemu/commit/f3fe4a2d92bb4ee5b599b8b1eb781b2ae68af36c
  Author: Antonios Motakis <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

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

  Log Message:
  -----------
  9p: stat_to_qid: implement slow path

stat_to_qid attempts via qid_path_prefixmap to map unique files (which are
identified by 64 bit inode nr and 32 bit device id) to a 64 QID path value.
However this implementation makes some assumptions about inode number
generation on the host.

If qid_path_prefixmap fails, we still have 48 bits available in the QID
path to fall back to a less memory efficient full mapping.

Signed-off-by: Antonios Motakis <address@hidden>
[CS: - Rebased to https://github.com/gkurz/qemu/commits/9p-next
       (SHA1 7fc4c49e91).
     - Updated hash calls to new xxhash API.
     - Removed unnecessary parantheses in qpf_lookup_func().
     - Removed unnecessary g_malloc0() result checks.
     - Log error message when running out of prefixes in
       qid_path_fullmap().
     - Log warning message about potential degraded performance in
       qid_path_prefixmap().
     - Wrapped qpf_table initialization to dedicated qpf_table_init()
       function.
     - Fixed typo in comment. ]
Signed-off-by: Christian Schoenebeck <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: 6b6aa8285d7ecc172ed59903bb61f26c19ba2538
      
https://github.com/qemu/qemu/commit/6b6aa8285d7ecc172ed59903bb61f26c19ba2538
  Author: Christian Schoenebeck <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

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

  Log Message:
  -----------
  9p: Use variable length suffixes for inode remapping

Use variable length suffixes for inode remapping instead of the fixed
16 bit size prefixes before. With this change the inode numbers on guest
will typically be much smaller (e.g. around >2^1 .. >2^7 instead of >2^48
with the previous fixed size inode remapping.

Additionally this solution is more efficient, since inode numbers in
practice can take almost their entire 64 bit range on guest as well, so
there is less likely a need for generating and tracking additional suffixes,
which might also be beneficial for nested virtualization where each level of
virtualization would shift up the inode bits and increase the chance of
expensive remapping actions.

The "Exponential Golomb" algorithm is used as basis for generating the
variable length suffixes. The algorithm has a parameter k which controls the
distribution of bits on increasing indeces (minimum bits at low index vs.
maximum bits at high index). With k=0 the generated suffixes look like:

Index Dec/Bin -> Generated Suffix Bin
1 [1] -> [1] (1 bits)
2 [10] -> [010] (3 bits)
3 [11] -> [110] (3 bits)
4 [100] -> [00100] (5 bits)
5 [101] -> [10100] (5 bits)
6 [110] -> [01100] (5 bits)
7 [111] -> [11100] (5 bits)
8 [1000] -> [0001000] (7 bits)
9 [1001] -> [1001000] (7 bits)
10 [1010] -> [0101000] (7 bits)
11 [1011] -> [1101000] (7 bits)
12 [1100] -> [0011000] (7 bits)
...
65533 [1111111111111101] ->  [1011111111111111000000000000000] (31 bits)
65534 [1111111111111110] ->  [0111111111111111000000000000000] (31 bits)
65535 [1111111111111111] ->  [1111111111111111000000000000000] (31 bits)
Hence minBits=1 maxBits=31

And with k=5 they would look like:

Index Dec/Bin -> Generated Suffix Bin
1 [1] -> [000001] (6 bits)
2 [10] -> [100001] (6 bits)
3 [11] -> [010001] (6 bits)
4 [100] -> [110001] (6 bits)
5 [101] -> [001001] (6 bits)
6 [110] -> [101001] (6 bits)
7 [111] -> [011001] (6 bits)
8 [1000] -> [111001] (6 bits)
9 [1001] -> [000101] (6 bits)
10 [1010] -> [100101] (6 bits)
11 [1011] -> [010101] (6 bits)
12 [1100] -> [110101] (6 bits)
...
65533 [1111111111111101] -> [0011100000000000100000000000] (28 bits)
65534 [1111111111111110] -> [1011100000000000100000000000] (28 bits)
65535 [1111111111111111] -> [0111100000000000100000000000] (28 bits)
Hence minBits=6 maxBits=28

Signed-off-by: Christian Schoenebeck <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: e410bbc52a7a246858af54ce1842fadf26f39ff7
      
https://github.com/qemu/qemu/commit/e410bbc52a7a246858af54ce1842fadf26f39ff7
  Author: Greg Kurz <address@hidden>
  Date:   2019-10-10 (Thu, 10 Oct 2019)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: Downgrade status of virtio-9p to "Odd Fixes"

Latest submissions for 9pfs made me realize that I no longer have time
and motivation to actively support it. I'll stay around for odd fixes
though.

Signed-off-by: Greg Kurz <address@hidden>


  Commit: c8b2bc5185c9a9dff5caada3c28e64cc94e1d669
      
https://github.com/qemu/qemu/commit/c8b2bc5185c9a9dff5caada3c28e64cc94e1d669
  Author: Peter Maydell <address@hidden>
  Date:   2019-10-14 (Mon, 14 Oct 2019)

  Changed paths:
    M MAINTAINERS
    M fsdev/9p-marshal.h
    M fsdev/file-op-9p.h
    M fsdev/qemu-fsdev-opts.c
    M fsdev/qemu-fsdev-throttle.c
    M fsdev/qemu-fsdev-throttle.h
    M fsdev/qemu-fsdev.c
    M hw/9pfs/9p-local.c
    M hw/9pfs/9p-proxy.c
    M hw/9pfs/9p.c
    M hw/9pfs/9p.h
    M hw/9pfs/trace-events
    M qemu-options.hx
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2019-10-10' into 
staging

The most notable change is that we now detect cross-device setups in the
host since it may cause inode number collision and mayhem in the guest.
A new fsdev property is added for the user to choose the appropriate
policy to handle that: either remap all inode numbers or fail I/Os to
another host device or just print out a warning (default behaviour).

This is also my last PR as _active_ maintainer of 9pfs.

# gpg: Signature made Thu 10 Oct 2019 12:14:07 BST
# gpg:                using RSA key B4828BAF943140CEF2A3491071D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <address@hidden>" [full]
# gpg:                 aka "Gregory Kurz <address@hidden>" [full]
# gpg:                 aka "[jpeg image of size 3330]" [full]
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz/tags/9p-next-2019-10-10:
  MAINTAINERS: Downgrade status of virtio-9p to "Odd Fixes"
  9p: Use variable length suffixes for inode remapping
  9p: stat_to_qid: implement slow path
  9p: Added virtfs option 'multidevs=remap|forbid|warn'
  9p: Treat multiple devices on one export as an error
  fsdev: Add return value to fsdev_throttle_parse_opts()
  9p: Simplify error path of v9fs_device_realize_common()
  9p: unsigned type for type, version, path

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/088d67096d75...c8b2bc5185c9



reply via email to

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