qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] ee46c7: virtiofsd: Pull in upstream headers


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] ee46c7: virtiofsd: Pull in upstream headers
Date: Fri, 24 Jan 2020 03:15:15 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: ee46c78901eb7fa78e328e04c0494ad6d207238b
      
https://github.com/qemu/qemu/commit/ee46c78901eb7fa78e328e04c0494ad6d207238b
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A tools/virtiofsd/fuse.h
    A tools/virtiofsd/fuse_common.h
    A tools/virtiofsd/fuse_i.h
    A tools/virtiofsd/fuse_log.h
    A tools/virtiofsd/fuse_lowlevel.h
    A tools/virtiofsd/fuse_misc.h
    A tools/virtiofsd/fuse_opt.h
    A tools/virtiofsd/passthrough_helpers.h

  Log Message:
  -----------
  virtiofsd: Pull in upstream headers

Pull in headers fromlibfuse's upstream fuse-3.8.0

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a62a9e192bc5f0aa0bc076b51db5a069add87c78
      
https://github.com/qemu/qemu/commit/a62a9e192bc5f0aa0bc076b51db5a069add87c78
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A include/standard-headers/linux/fuse.h
    M scripts/update-linux-headers.sh

  Log Message:
  -----------
  virtiofsd: Pull in kernel's fuse.h

Update scripts/update-linux-headers.sh to add fuse.h and
use it to pull in fuse.h from the kernel; from v5.5-rc1

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: ffcf8d9f8649c6e56b1193bbbc9c9f7388920043
      
https://github.com/qemu/qemu/commit/ffcf8d9f8649c6e56b1193bbbc9c9f7388920043
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A tools/virtiofsd/buffer.c
    A tools/virtiofsd/fuse_log.c
    A tools/virtiofsd/fuse_opt.c
    A tools/virtiofsd/fuse_signals.c
    A tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: Add auxiliary .c's

Add most of the non-main .c files we need from upstream fuse-3.8.0

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 2de121f01e37e2fe98a4362f4abf7c0848697f76
      
https://github.com/qemu/qemu/commit/2de121f01e37e2fe98a4362f4abf7c0848697f76
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Add fuse_lowlevel.c

fuse_lowlevel is one of the largest files from the library
and does most of the work.  Add it separately to keep the diff
sizes small.
Again this is from upstream fuse-3.8.0

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 7c6b66027241f41720240fc6ee1021cdbd975b2e
      
https://github.com/qemu/qemu/commit/7c6b66027241f41720240fc6ee1021cdbd975b2e
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    A tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Add passthrough_ll

passthrough_ll is one of the examples in the upstream fuse project
and is the main part of our daemon here.  It passes through requests
from fuse to the underlying filesystem, using syscalls as directly
as possible.

>From libfuse fuse-3.8.0

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
  Fixed up 'GPL' to 'GPLv2' as per Dan's comments and consistent
  with the 'LICENSE' file in libfuse;  patch sent to libfuse to fix
  it upstream.
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a3e23f325439a290c504d6bbc48c2e742149ecab
      
https://github.com/qemu/qemu/commit/a3e23f325439a290c504d6bbc48c2e742149ecab
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse.h
    M tools/virtiofsd/fuse_common.h
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_log.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/fuse_opt.h
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_helpers.h
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Trim down imported files

There's a lot of the original fuse code we don't need; trim them down.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
with additional trimming by:
Signed-off-by: Misono Tomohiro <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Xiao Yang <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 7387863d033e8028aa09a815736617a7c4490827
      
https://github.com/qemu/qemu/commit/7387863d033e8028aa09a815736617a7c4490827
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse.h
    M tools/virtiofsd/fuse_common.h
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_log.c
    M tools/virtiofsd/fuse_log.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/fuse_misc.h
    M tools/virtiofsd/fuse_opt.c
    M tools/virtiofsd/fuse_opt.h
    M tools/virtiofsd/fuse_signals.c
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_helpers.h
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Format imported files to qemu style

Mostly using a set like:

indent -nut -i 4 -nlp -br -cs -ce --no-space-after-function-call-names file
clang-format -style=file -i -- file
clang-tidy -fix-errors -checks=readability-braces-around-statements file
clang-format -style=file -i -- file

With manual cleanups.

The .clang-format used is below.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed by: Aleksandar Markovic <address@hidden>

Language:        Cpp
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false # although we like it, it creates churn
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands:   true
AlignTrailingComments: false # churn
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None # AlwaysBreakAfterDefinitionReturnType is 
taken into account
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
  AfterControlStatement: false
  AfterEnum:       false
  AfterFunction:   true
  AfterStruct:     false
  AfterUnion:      false
  BeforeElse:      false
  IndentBraces:    false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
ColumnLimit:     80
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat:   false
ForEachMacros:   [
  'CPU_FOREACH',
  'CPU_FOREACH_REVERSE',
  'CPU_FOREACH_SAFE',
  'IOMMU_NOTIFIER_FOREACH',
  'QLIST_FOREACH',
  'QLIST_FOREACH_ENTRY',
  'QLIST_FOREACH_RCU',
  'QLIST_FOREACH_SAFE',
  'QLIST_FOREACH_SAFE_RCU',
  'QSIMPLEQ_FOREACH',
  'QSIMPLEQ_FOREACH_SAFE',
  'QSLIST_FOREACH',
  'QSLIST_FOREACH_SAFE',
  'QTAILQ_FOREACH',
  'QTAILQ_FOREACH_REVERSE',
  'QTAILQ_FOREACH_SAFE',
  'QTAILQ_RAW_FOREACH',
  'RAMBLOCK_FOREACH'
]
IncludeCategories:
  - Regex:           '^"qemu/osdep.h'
    Priority:        -3
  - Regex:           
'^"(block|chardev|crypto|disas|exec|fpu|hw|io|libdecnumber|migration|monitor|net|qapi|qemu|qom|standard-headers|sysemu|ui)/'
    Priority:        -2
  - Regex:           
'^"(elf.h|qemu-common.h|glib-compat.h|qemu-io.h|trace-tcg.h)'
    Priority:        -1
  - Regex:           '.*'
    Priority:        1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth:     4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: '.*_BEGIN$' # only PREC_BEGIN ?
MacroBlockEnd:   '.*_END$'
MaxEmptyLinesToKeep: 2
PointerAlignment: Right
ReflowComments:  true
SortIncludes:    true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Auto
UseTab:          Never
...

Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 67aab02272f6cb47c56420f60b370c184961b5ca
      
https://github.com/qemu/qemu/commit/67aab02272f6cb47c56420f60b370c184961b5ca
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: remove mountpoint dummy argument

Classic FUSE file system daemons take a mountpoint argument but
virtiofsd exposes a vhost-user UNIX domain socket instead.  The
mountpoint argument is not used by virtiofsd but the user is still
required to pass a dummy argument on the command-line.

Remove the mountpoint argument to clean up the command-line.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 64c6f408a29ef03e9b8da9f5a5d8fd511b0d801e
      
https://github.com/qemu/qemu/commit/64c6f408a29ef03e9b8da9f5a5d8fd511b0d801e
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h

  Log Message:
  -----------
  virtiofsd: remove unused notify reply support

Notify reply support is unused by virtiofsd.  The code would need to be
updated to validate input buffer sizes.  Remove this unused code since
changes to it are untestable.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 8c3fe75e0308ba2f01d160ace534b7e386cea808
      
https://github.com/qemu/qemu/commit/8c3fe75e0308ba2f01d160ace534b7e386cea808
  Author: Xiao Yang <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse_common.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Remove unused enum fuse_buf_copy_flags

Signed-off-by: Xiao Yang <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 30d8e49760712d65697ea517c53671bd1d214fc7
      
https://github.com/qemu/qemu/commit/30d8e49760712d65697ea517c53671bd1d214fc7
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: Fix fuse_daemonize ignored return values

QEMU's compiler enables warnings/errors for ignored values
and the (void) trick used in the fuse code isn't enough.
Turn all the return values into a return value on the function.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 09863ebc7e32a107235b3c815ad54d26cc64f07a
      
https://github.com/qemu/qemu/commit/09863ebc7e32a107235b3c815ad54d26cc64f07a
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_log.c
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_opt.c
    M tools/virtiofsd/fuse_signals.c
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Fix common header and define for QEMU builds

All of the fuse files include config.h and define GNU_SOURCE
where we don't have either under our build - remove them.
Fixup path to the kernel's fuse.h in the QEMUs world.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 72c42e2d65510e073cf78fdc924d121c77fa0080
      
https://github.com/qemu/qemu/commit/72c42e2d65510e073cf78fdc924d121c77fa0080
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Trim out compatibility code

virtiofsd only supports major=7, minor>=31; trim out a lot of
old compatibility code.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9776457ca6f05d5900e27decb1dba2ffddf95a22
      
https://github.com/qemu/qemu/commit/9776457ca6f05d5900e27decb1dba2ffddf95a22
  Author: Xiao Yang <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  vitriofsd/passthrough_ll: fix fallocate() ifdefs

1) Use correct CONFIG_FALLOCATE macro to check if fallocate() is supported.(i.e 
configure
   script sets CONFIG_FALLOCATE intead of HAVE_FALLOCATE if fallocate() is 
supported)
2) Replace HAVE_POSIX_FALLOCATE with CONFIG_POSIX_FALLOCATE.

Signed-off-by: Xiao Yang <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
  Merged from two of Xiao Yang's patches


  Commit: 1b209805f8159c3f4d89ddb9390a5f64887cebff
      
https://github.com/qemu/qemu/commit/1b209805f8159c3f4d89ddb9390a5f64887cebff
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Make fsync work even if only inode is passed in

If caller has not sent file handle in request, then using inode, retrieve
the fd opened using O_PATH and use that to open file again and issue
fsync. This will be needed when dax_flush() calls fsync. At that time
we only have inode information (and not file).

Signed-off-by: Vivek Goyal <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 205de006aab8dcbe546a7e3a51d295c2d05e654b
      
https://github.com/qemu/qemu/commit/205de006aab8dcbe546a7e3a51d295c2d05e654b
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: Add options for virtio

Add options to specify parameters for virtio-fs paths, i.e.

   ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 4ff075f72be2f489c8998ae492ec5cdbbbd73e07
      
https://github.com/qemu/qemu/commit/4ff075f72be2f489c8998ae492ec5cdbbbd73e07
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: add -o source=PATH to help output

The -o source=PATH option will be used by most command-line invocations.
Let's document it!

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: d14bf584dd965821e80d14c16d9292a464b1ab85
      
https://github.com/qemu/qemu/commit/d14bf584dd965821e80d14c16d9292a464b1ab85
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    A tools/virtiofsd/fuse_virtio.c
    A tools/virtiofsd/fuse_virtio.h

  Log Message:
  -----------
  virtiofsd: Open vhost connection instead of mounting

When run with vhost-user options we conect to the QEMU instead
via a socket.  Start this off by creating the socket.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f6f3573c6f271af5ded63ce28589a113f7205c72
      
https://github.com/qemu/qemu/commit/f6f3573c6f271af5ded63ce28589a113f7205c72
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/fuse_virtio.c
    M tools/virtiofsd/fuse_virtio.h
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Start wiring up vhost-user

Listen on our unix socket for the connection from QEMU, when we get it
initialise vhost-user and dive into our own loop variant (currently
dummy).

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 204d8ae57b3c57098642c79b3c03d42495149c09
      
https://github.com/qemu/qemu/commit/204d8ae57b3c57098642c79b3c03d42495149c09
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Add main virtio loop

Processes incoming requests on the vhost-user fd.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f2cef5fb9ae20136ca18d16328787b69b3abfa18
      
https://github.com/qemu/qemu/commit/f2cef5fb9ae20136ca18d16328787b69b3abfa18
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: get/set features callbacks

Add the get/set features callbacks.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: e4c55a3c144493b436e40031e2eed61a84eca47b
      
https://github.com/qemu/qemu/commit/e4c55a3c144493b436e40031e2eed61a84eca47b
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Start queue threads

Start a thread for each queue when we get notified it's been started.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
fix by:
Signed-off-by: Jun Piao <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 5dcd1f56141378226d33dc3df68ec57913e0aa04
      
https://github.com/qemu/qemu/commit/5dcd1f56141378226d33dc3df68ec57913e0aa04
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Poll kick_fd for queue

In the queue thread poll the kick_fd we're passed.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: b509e1228b3e5eb83c14819045988999fc2dbd1b
      
https://github.com/qemu/qemu/commit/b509e1228b3e5eb83c14819045988999fc2dbd1b
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Start reading commands from queue

Pop queue elements off queues, copy the data from them and
pass that to fuse.

  Note: 'out' in a VuVirtqElement is from QEMU
        'in' in libfuse is into the daemon

  So we read from the out iov's to get a fuse_in_header

When we get a kick we've got to read all the elements until the queue
is empty.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: df57ba919ec3edef9cc208d35685095e6e92713e
      
https://github.com/qemu/qemu/commit/df57ba919ec3edef9cc208d35685095e6e92713e
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c
    M tools/virtiofsd/fuse_virtio.h

  Log Message:
  -----------
  virtiofsd: Send replies to messages

Route fuse out messages back through the same queue elements
that had the command that triggered the request.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 2f65e69a7f22da8d20c747f34f339ebb40a0634f
      
https://github.com/qemu/qemu/commit/2f65e69a7f22da8d20c747f34f339ebb40a0634f
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Keep track of replies

Keep track of whether we sent a reply to a request; this is a bit
paranoid but it means:
  a) We should always recycle an element even if there was an error
     in the request
  b) Never try and send two replies on one queue element

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 81bfc42dcf473bc8d3790622633410da72d8e622
      
https://github.com/qemu/qemu/commit/81bfc42dcf473bc8d3790622633410da72d8e622
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M Makefile
    M Makefile.objs
    A tools/virtiofsd/Makefile.objs

  Log Message:
  -----------
  virtiofsd: Add Makefile wiring for virtiofsd contrib

Wire up the building of the virtiofsd in tools.

virtiofsd relies on Linux-specific system calls and seccomp.  Anyone
wishing to port it to other host operating systems should do so
carefully and without reducing security.

Only allow building on Linux hosts.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Liam Merwick <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: eb49d187ef5134483a34c970bbfece28aaa686a7
      
https://github.com/qemu/qemu/commit/eb49d187ef5134483a34c970bbfece28aaa686a7
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c
    M tools/virtiofsd/fuse_virtio.h

  Log Message:
  -----------
  virtiofsd: Fast path for virtio read

Readv the data straight into the guests buffer.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
With fix by:
Signed-off-by: Eryu Guan <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: cee8e35d4386e34bf79c3ca2aab7f7b1bb48cf8d
      
https://github.com/qemu/qemu/commit/cee8e35d4386e34bf79c3ca2aab7f7b1bb48cf8d
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: add --fd=FDNUM fd passing option

Although --socket-path=PATH is useful for manual invocations, management
tools typically create the UNIX domain socket themselves and pass it to
the vhost-user device backend.  This way QEMU can be launched
immediately with a valid socket.  No waiting for the vhost-user device
backend is required when fd passing is used.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 0bbd31753714ac2899efda0f0de31e353e965789
      
https://github.com/qemu/qemu/commit/0bbd31753714ac2899efda0f0de31e353e965789
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: make -f (foreground) the default

According to vhost-user.rst "Backend program conventions", backend
programs should run in the foregound by default.  Follow the
conventions so libvirt and other management tools can control virtiofsd
in a standard way.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 315616ed50ba15a5d7236ade8a402a93898202de
      
https://github.com/qemu/qemu/commit/315616ed50ba15a5d7236ade8a402a93898202de
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M .gitignore
    M Makefile
    A tools/virtiofsd/50-qemu-virtiofsd.json.in

  Log Message:
  -----------
  virtiofsd: add vhost-user.json file

Install a vhost-user.json file describing virtiofsd.  This allows
libvirt and other management tools to enumerate vhost-user backend
programs.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 45018fbb0a73ce66fd3dd87ecd2872b45658add4
      
https://github.com/qemu/qemu/commit/45018fbb0a73ce66fd3dd87ecd2872b45658add4
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M docs/interop/vhost-user.json
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: add --print-capabilities option

Add the --print-capabilities option as per vhost-user.rst "Backend
programs conventions".  Currently there are no advertised features.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: bad7d2c3ad1af9344df035aedaf8e0967a543070
      
https://github.com/qemu/qemu/commit/bad7d2c3ad1af9344df035aedaf8e0967a543070
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  virtiofs: Add maintainers entry

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 929cfb7a9a1b101cdfc9ac19807ecab4c81a13e4
      
https://github.com/qemu/qemu/commit/929cfb7a9a1b101cdfc9ac19807ecab4c81a13e4
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: create new files in caller's context

We need to create files in the caller's context. Otherwise after
creating a file, the caller might not be able to do file operations on
that file.

Changed effective uid/gid to caller's uid/gid, create file and then
switch back to uid/gid 0.

Use syscall(setresuid, ...) otherwise glibc does some magic to change EUID
in all threads, which is not what we want.

Signed-off-by: Vivek Goyal <address@hidden>
Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 25c135727b08dca90f00094e522a69170b13dfac
      
https://github.com/qemu/qemu/commit/25c135727b08dca90f00094e522a69170b13dfac
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add lo_map for ino/fh indirection

A layer of indirection is needed because passthrough_ll cannot expose
pointers or file descriptor numbers to untrusted clients.  Malicious
clients could send invalid pointers or file descriptors in order to
crash or exploit the file system daemon.

lo_map provides an integer key->value mapping.  This will be used for
ino and fh fields in the patches that follow.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 92fb57b83cdbfc4bf53c0c46a3d0bcbc36e64126
      
https://github.com/qemu/qemu/commit/92fb57b83cdbfc4bf53c0c46a3d0bcbc36e64126
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers

Do not expose lo_inode pointers to clients.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: b39bce121bfad8757eec0ee41f14607b883935d3
      
https://github.com/qemu/qemu/commit/b39bce121bfad8757eec0ee41f14607b883935d3
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers

Do not expose lo_dirp pointers to clients.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 73b4d19dfc4248a74c1f3e511cfa934681d9c602
      
https://github.com/qemu/qemu/commit/73b4d19dfc4248a74c1f3e511cfa934681d9c602
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add fd_map to hide file descriptors

Do not expose file descriptor numbers to clients.  This prevents the
abuse of internal file descriptors (like stdin/stdout).

Signed-off-by: Stefan Hajnoczi <address@hidden>
Fix from:
Signed-off-by: Xiao Yang <address@hidden>
dgilbert:
  Added lseek
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 5fe319a7b19c9c328e6e061bffcf1ff6cc8b89ce
      
https://github.com/qemu/qemu/commit/5fe319a7b19c9c328e6e061bffcf1ff6cc8b89ce
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add fallback for racy ops

We have two operations that cannot be done race-free on a symlink in
certain cases: utimes and link.

Add racy fallback for these if the race-free method doesn't work.  We do
our best to avoid races even in this case:

  - get absolute path by reading /proc/self/fd/NN symlink

  - lookup parent directory: after this we are safe against renames in
    ancestors

  - lookup name in parent directory, and verify that we got to the original
    inode,  if not retry the whole thing

Both utimes(2) and link(2) hold i_lock on the inode across the operation,
so a racing rename/delete by this fuse instance is not possible, only from
other entities changing the filesystem.

If the "norace" option is given, then disable the racy fallbacks.

Signed-off-by: Miklos Szeredi <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 25dae28c58d7e706b5d5db99042c9db3cef2e657
      
https://github.com/qemu/qemu/commit/25dae28c58d7e706b5d5db99042c9db3cef2e657
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: validate path components

Several FUSE requests contain single path components.  A correct FUSE
client sends well-formed path components but there is currently no input
validation in case something went wrong or the client is malicious.

Refuse ".", "..", and paths containing '/' when we expect a path
component.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 469f9d2fc405b0508e6cf1b4b5bbcadfc82064e5
      
https://github.com/qemu/qemu/commit/469f9d2fc405b0508e6cf1b4b5bbcadfc82064e5
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Plumb fuse_bufvec through to do_write_buf

Let fuse_session_process_buf_int take a fuse_bufvec * instead of a
fuse_buf;  and then through to do_write_buf - where in the best
case it can pass that straight through to op.write_buf without copying
(other than skipping a header).

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: e17f7a580e2c599330ad3a6946be615ca2fe97d9
      
https://github.com/qemu/qemu/commit/e17f7a580e2c599330ad3a6946be615ca2fe97d9
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Pass write iov's all the way through

Pass the write iov pointing to guest RAM all the way through rather
than copying the data.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Xiao Yang <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: dad157e880416ab3a0e45beaa0e81977516568bc
      
https://github.com/qemu/qemu/commit/dad157e880416ab3a0e45beaa0e81977516568bc
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c
    M tools/virtiofsd/fuse_common.h

  Log Message:
  -----------
  virtiofsd: add fuse_mbuf_iter API

Introduce an API for consuming bytes from a buffer with size checks.
All FUSE operations will be converted to use this safe API instead of
void *inarg.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 0ba8c3c6fce8fe949d59c1fd84d98d220ef9e759
      
https://github.com/qemu/qemu/commit/0ba8c3c6fce8fe949d59c1fd84d98d220ef9e759
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: validate input buffer sizes in do_write_buf()

There is a small change in behavior: if fuse_write_in->size doesn't
match the input buffer size then the request is failed.  Previously
write requests with 1 fuse_buf element would truncate to
fuse_write_in->size.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 70995754416eb4491c31607fe380a83cfd25a087
      
https://github.com/qemu/qemu/commit/70995754416eb4491c31607fe380a83cfd25a087
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: check input buffer size in fuse_lowlevel.c ops

Each FUSE operation involves parsing the input buffer.  Currently the
code assumes the input buffer is large enough for the expected
arguments.  This patch uses fuse_mbuf_iter to check the size.

Most operations are simple to convert.  Some are more complicated due to
variable-length inputs or different sizes depending on the protocol
version.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 854684bc0b3d63eb90b3abdfe471c2e4271ef176
      
https://github.com/qemu/qemu/commit/854684bc0b3d63eb90b3abdfe471c2e4271ef176
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: prevent ".." escape in lo_do_lookup()

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 752272da2b68a2312f0e11fc5303015a6c3ee1ac
      
https://github.com/qemu/qemu/commit/752272da2b68a2312f0e11fc5303015a6c3ee1ac
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: prevent ".." escape in lo_do_readdir()

Construct a fake dirent for the root directory's ".." entry.  This hides
the parent directory from the FUSE client.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9f59d175e2ca96f0b87f534dba69ea547dd35945
      
https://github.com/qemu/qemu/commit/9f59d175e2ca96f0b87f534dba69ea547dd35945
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: use /proc/self/fd/ O_PATH file descriptor

Sandboxing will remove /proc from the mount namespace so we can no
longer build string paths into "/proc/self/fd/...".

Keep an O_PATH file descriptor so we can still re-open fds via
/proc/self/fd.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 5baa3b8e95064c2434bd9e2f312edd5e9ae275dc
      
https://github.com/qemu/qemu/commit/5baa3b8e95064c2434bd9e2f312edd5e9ae275dc
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: sandbox mount namespace

Use a mount namespace with the shared directory tree mounted at "/" and
no other mounts.

This prevents symlink escape attacks because symlink targets are
resolved only against the shared directory and cannot go outside it.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Peng Tao <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: d74830d12ae233186ff74ddf64c552d26bb39e50
      
https://github.com/qemu/qemu/commit/d74830d12ae233186ff74ddf64c552d26bb39e50
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: move to an empty network namespace

If the process is compromised there should be no network access.  Use an
empty network namespace to sandbox networking.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 8e1d4ef231d8327be219f7aea7aa15d181375bbc
      
https://github.com/qemu/qemu/commit/8e1d4ef231d8327be219f7aea7aa15d181375bbc
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: move to a new pid namespace

virtiofsd needs access to /proc/self/fd.  Let's move to a new pid
namespace so that a compromised process cannot see another other
processes running on the system.

One wrinkle in this approach: unshare(CLONE_NEWPID) affects *child*
processes and not the current process.  Therefore we need to fork the
pid 1 process that will actually run virtiofsd and leave a parent in
waitpid(2).  This is not the same thing as daemonization and parent
processes should not notice a difference.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 4f8bde99c175ffd86b5125098a4707d43f5e80c6
      
https://github.com/qemu/qemu/commit/4f8bde99c175ffd86b5125098a4707d43f5e80c6
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M Makefile
    M tools/virtiofsd/Makefile.objs
    M tools/virtiofsd/passthrough_ll.c
    A tools/virtiofsd/seccomp.c
    A tools/virtiofsd/seccomp.h

  Log Message:
  -----------
  virtiofsd: add seccomp whitelist

Only allow system calls that are needed by virtiofsd.  All other system
calls cause SIGSYS to be directed at the thread and the process will
coredump.

Restricting system calls reduces the kernel attack surface and limits
what the process can do when compromised.

Signed-off-by: Stefan Hajnoczi <address@hidden>
with additional entries by:
Signed-off-by: Ganesh Maharaj Mahalingam <address@hidden>
Signed-off-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Misono Tomohiro <address@hidden>
Signed-off-by: piaojun <address@hidden>
Signed-off-by: Vivek Goyal <address@hidden>
Signed-off-by: Eric Ren <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f779bc5265e7e7abb13a03d4bfbc74151afc15c2
      
https://github.com/qemu/qemu/commit/f779bc5265e7e7abb13a03d4bfbc74151afc15c2
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_common.h
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV

Caller can set FUSE_WRITE_KILL_PRIV in write_flags. Parse it and pass it
to the filesystem.

Signed-off-by: Vivek Goyal <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 2405f3c0d19eb4d516a88aa4e5c54e5f9c6bbea3
      
https://github.com/qemu/qemu/commit/2405f3c0d19eb4d516a88aa4e5c54e5f9c6bbea3
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M Makefile
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: cap-ng helpers

libcap-ng reads /proc during capng_get_caps_process, and virtiofsd's
sandboxing doesn't have /proc mounted; thus we have to do the
caps read before we sandbox it and save/restore the state.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: ee88465224b3aed2596049caa28f86cbe0d5a3d0
      
https://github.com/qemu/qemu/commit/ee88465224b3aed2596049caa28f86cbe0d5a3d0
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Drop CAP_FSETID if client asked for it

If client requested killing setuid/setgid bits on file being written, drop
CAP_FSETID capability so that setuid/setgid bits are cleared upon write
automatically.

pjdfstest chown/12.t needs this.

Signed-off-by: Vivek Goyal <address@hidden>
  dgilbert: reworked for libcap-ng
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 01a6dc95ec7f71eeff9963fe3cb03d85225fba3e
      
https://github.com/qemu/qemu/commit/01a6dc95ec7f71eeff9963fe3cb03d85225fba3e
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: set maximum RLIMIT_NOFILE limit

virtiofsd can exceed the default open file descriptor limit easily on
most systems.  Take advantage of the fact that it runs as root to raise
the limit.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 3db2876a0153ac7103c077c53090e020faffb3ea
      
https://github.com/qemu/qemu/commit/3db2876a0153ac7103c077c53090e020faffb3ea
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: fix libfuse information leaks

Some FUSE message replies contain padding fields that are not
initialized by libfuse.  This is fine in traditional FUSE applications
because the kernel is trusted.  virtiofsd does not trust the guest and
must not expose uninitialized memory.

Use C struct initializers to automatically zero out memory.  Not all of
these code changes are strictly necessary but they will prevent future
information leaks if the structs are extended.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f185621d41f03a23b55795b89e6584253fa23505
      
https://github.com/qemu/qemu/commit/f185621d41f03a23b55795b89e6584253fa23505
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c
    M tools/virtiofsd/seccomp.c
    M tools/virtiofsd/seccomp.h

  Log Message:
  -----------
  virtiofsd: add --syslog command-line option

Sometimes collecting output from stderr is inconvenient or does not fit
within the overall logging architecture.  Add syslog(3) support for
cases where stderr cannot be used.

Signed-off-by: Stefan Hajnoczi <address@hidden>
dgilbert: Reworked as a logging function
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: d240314a1a18a1d914af1b5763fe8c9a572e6409
      
https://github.com/qemu/qemu/commit/d240314a1a18a1d914af1b5763fe8c9a572e6409
  Author: Eryu Guan <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_lowlevel.h
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: print log only when priority is high enough

Introduce "-o log_level=" command line option to specify current log
level (priority), valid values are "debug info warn err", e.g.

    ./virtiofsd -o log_level=debug ...

So only log priority higher than "debug" will be printed to
stderr/syslog. And the default level is info.

The "-o debug"/"-d" options are kept, and imply debug log level.

Signed-off-by: Eryu Guan <address@hidden>
dgilbert: Reworked for libfuse's log_func
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
with fix by:
Signed-off-by: Xiao Yang <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 36f3846902bd41413f6c0bf797dee509028c29f4
      
https://github.com/qemu/qemu/commit/36f3846902bd41413f6c0bf797dee509028c29f4
  Author: Masayoshi Mizuma <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level

virtiofsd has some threads, so we see a lot of logs with debug option.
It would be useful for debugging if we can identify the specific thread
from the log.

Add ID, which is got by gettid(), to the log with FUSE_LOG_DEBUG level
so that we can grep the specific thread.

The log is like as:

  ]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 
-o cache=auto
  ...
  [ID: 00000097]    unique: 12696, success, outsize: 120
  [ID: 00000097] virtio_send_msg: elem 18: with 2 in desc of length 120
  [ID: 00000003] fv_queue_thread: Got queue event on Queue 1
  [ID: 00000003] fv_queue_thread: Queue 1 gave evalue: 1 available: in: 65552 
out: 80
  [ID: 00000003] fv_queue_thread: Waiting for Queue 1 event
  [ID: 00000071] fv_queue_worker: elem 33: with 2 out desc of length 80 
bad_in_num=0 bad_out_num=0
  [ID: 00000071] unique: 12694, opcode: READ (15), nodeid: 2, insize: 80, pid: 
2014
  [ID: 00000071] lo_read(ino=2, size=65536, off=131072)

Signed-off-by: Masayoshi Mizuma <address@hidden>

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
  added rework as suggested by Daniel P. Berrangé during review
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 50fb955aa0e6ede929422146936cf68bf1ca876f
      
https://github.com/qemu/qemu/commit/50fb955aa0e6ede929422146936cf68bf1ca876f
  Author: Masayoshi Mizuma <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level

virtiofsd has some threads, so we see a lot of logs with debug option.
It would be useful for debugging if we can see the timestamp.

Add nano second timestamp, which got by get_clock(), to the log with
FUSE_LOG_DEBUG level if the syslog option isn't set.

The log is like as:

  # ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 
-o cache=auto
  ...
  [5365943125463727] [ID: 00000002] fv_queue_thread: Start for queue 0 kick_fd 9
  [5365943125568644] [ID: 00000002] fv_queue_thread: Waiting for Queue 0 event
  [5365943125573561] [ID: 00000002] fv_queue_thread: Got queue event on Queue 0

Signed-off-by: Masayoshi Mizuma <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: c806d6435fe95fd54b379920aca2f4e3ea1f3258
      
https://github.com/qemu/qemu/commit/c806d6435fe95fd54b379920aca2f4e3ea1f3258
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Handle reinit

Allow init->destroy->init  for mount->umount->mount

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: e8556f49098b5d95634e592d79a97f761b76c96e
      
https://github.com/qemu/qemu/commit/e8556f49098b5d95634e592d79a97f761b76c96e
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: Handle hard reboot

Handle a
  mount
  hard reboot (without unmount)
  mount

we get another 'init' which FUSE doesn't normally expect.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 10477ac47fc57d00a84802ff97c15450cd8021c1
      
https://github.com/qemu/qemu/commit/10477ac47fc57d00a84802ff97c15450cd8021c1
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Kill threads when queues are stopped

Kill the threads we've started when the queues get stopped.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
With improvements by:
Signed-off-by: Eryu Guan <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 0fdc465d7d5aafeae127eba488f247ac6f58df4c
      
https://github.com/qemu/qemu/commit/0fdc465d7d5aafeae127eba488f247ac6f58df4c
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M hw/virtio/vhost-user.c

  Log Message:
  -----------
  vhost-user: Print unexpected slave message types

When we receive an unexpected message type on the slave fd, print
the type.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: c25c02b9e6a196be87a818f459c426556b24770d
      
https://github.com/qemu/qemu/commit/c25c02b9e6a196be87a818f459c426556b24770d
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M contrib/libvhost-user/libvhost-user.c
    M contrib/libvhost-user/libvhost-user.h

  Log Message:
  -----------
  contrib/libvhost-user: Protect slave fd with mutex

In future patches we'll be performing commands on the slave-fd driven
by commands on queues, since those queues will be driven by individual
threads we need to make sure they don't attempt to use the slave-fd
for multiple commands in parallel.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f0ab7d6f78a7d3c1c19fd81a91c9b1199f56c4f6
      
https://github.com/qemu/qemu/commit/f0ab7d6f78a7d3c1c19fd81a91c9b1199f56c4f6
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: add renameat2 support

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: ddcbabcb0ea177be3ec3500726b699c7c26ffd93
      
https://github.com/qemu/qemu/commit/ddcbabcb0ea177be3ec3500726b699c7c26ffd93
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: disable readdirplus on cache=never

...because the attributes sent in the READDIRPLUS reply would be discarded
anyway.

Signed-off-by: Miklos Szeredi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 59aef494be2d8d91055ff3f3a8eb13d9f32873d8
      
https://github.com/qemu/qemu/commit/59aef494be2d8d91055ff3f3a8eb13d9f32873d8
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: control readdirplus

Signed-off-by: Miklos Szeredi <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 95d2715791c60b5dc2d22e4eb7b83217273296fa
      
https://github.com/qemu/qemu/commit/95d2715791c60b5dc2d22e4eb7b83217273296fa
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: rename unref_inode() to unref_inode_lolocked()

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9de4fab5995d115f8ebfb41d8d94a866d80a1708
      
https://github.com/qemu/qemu/commit/9de4fab5995d115f8ebfb41d8d94a866d80a1708
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: fail when parent inode isn't known in lo_do_lookup()

The Linux file handle APIs (struct export_operations) can access inodes
that are not attached to parents because path name traversal is not
performed.  Refuse if there is no parent in lo_do_lookup().

Also clean up lo_do_lookup() while we're here.

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 3ca8a2b1c83eb185c232a4e87abbb65495263756
      
https://github.com/qemu/qemu/commit/3ca8a2b1c83eb185c232a4e87abbb65495263756
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: extract root inode init into setup_root()

Inititialize the root inode in a single place.

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
dgilbert:
with fix suggested by Misono Tomohiro <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 230e777b5e250759ee0480fcc0e9ccfa2b082fba
      
https://github.com/qemu/qemu/commit/230e777b5e250759ee0480fcc0e9ccfa2b082fba
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: clean up cache related options

 - Rename "cache=never" to "cache=none" to match 9p's similar option.

 - Rename CACHE_NORMAL constant to CACHE_AUTO to match the "cache=auto"
   option.

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: bfc50a6e06b10b2f9dbaf6c1a89dd523322e016f
      
https://github.com/qemu/qemu/commit/bfc50a6e06b10b2f9dbaf6c1a89dd523322e016f
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: use hashtable

Improve performance of inode lookup by using a hash table.

Signed-off-by: Miklos Szeredi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 771b01eb76ff480fee984bd1d21727147cc3e702
      
https://github.com/qemu/qemu/commit/771b01eb76ff480fee984bd1d21727147cc3e702
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Clean up inodes on destroy

Clear out our inodes and fd's on a 'destroy' - so we get rid
of them if we reboot the guest.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 8a792b034d4b315251fd842bb4c73a133aa1368f
      
https://github.com/qemu/qemu/commit/8a792b034d4b315251fd842bb4c73a133aa1368f
  Author: Jiufei Xue <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M configure
    M tools/virtiofsd/fuse_misc.h

  Log Message:
  -----------
  virtiofsd: support nanosecond resolution for file timestamp

Define HAVE_STRUCT_STAT_ST_ATIM to 1 if `st_atim' is member of `struct
stat' which means support nanosecond resolution for the file timestamp
fields.

Signed-off-by: Jiufei Xue <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: c6de804670f2255ce776263124c37f3370dc5ac1
      
https://github.com/qemu/qemu/commit/c6de804670f2255ce776263124c37f3370dc5ac1
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: fix error handling in main()

Neither fuse_parse_cmdline() nor fuse_opt_parse() goes to the right place
to do cleanup.

Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 61cfc44982e566c33b9d5df17858e4d5ae373873
      
https://github.com/qemu/qemu/commit/61cfc44982e566c33b9d5df17858e4d5ae373873
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c
    M tools/virtiofsd/fuse_virtio.h

  Log Message:
  -----------
  virtiofsd: cleanup allocated resource in se

This cleans up unfreed resources in se on quiting, including
se->virtio_dev, se->vu_socket_path, se->vu_socketfd.

Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e
      
https://github.com/qemu/qemu/commit/eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: fix memory leak on lo.source

valgrind reported that lo.source is leaked on quiting, but it was defined
as (const char*) as it may point to a const string "/".

Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 18a69cbbb6a4caa7c2040c6db4a33b044a32be7e
      
https://github.com/qemu/qemu/commit/18a69cbbb6a4caa7c2040c6db4a33b044a32be7e
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: add helper for lo_data cleanup

This offers an helper function for lo_data's cleanup.

Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 96814800d2b49d18737c36e021c387697ec40c62
      
https://github.com/qemu/qemu/commit/96814800d2b49d18737c36e021c387697ec40c62
  Author: Masayoshi Mizuma <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: Prevent multiply running with same vhost_user_socket

virtiofsd can run multiply even if the vhost_user_socket is same path.

  ]# ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu -o source=/tmp/share &
  [1] 244965
  virtio_session_mount: Waiting for vhost-user socket connection...
  ]# ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu -o source=/tmp/share &
  [2] 244966
  virtio_session_mount: Waiting for vhost-user socket connection...
  ]#

The user will get confused about the situation and maybe the cause of the
unexpected problem. So it's better to prevent the multiple running.

Create a regular file under localstatedir directory to exclude the
vhost_user_socket. To create and lock the file, use qemu_write_pidfile()
because the API has some sanity checks and file lock.

Signed-off-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
  Applied fixes from Stefan's review and moved osdep include
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: b7ed733a3841c4d489d3bd6ca7ed23c84db119c2
      
https://github.com/qemu/qemu/commit/b7ed733a3841c4d489d3bd6ca7ed23c84db119c2
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: enable PARALLEL_DIROPS during INIT

lookup is a RO operations, PARALLEL_DIROPS can be enabled.

Signed-off-by: Liu Bo <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: fc3f0041b43b6c64aa97b3558a6abe1a10028354
      
https://github.com/qemu/qemu/commit/fc3f0041b43b6c64aa97b3558a6abe1a10028354
  Author: Eric Ren <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: fix incorrect error handling in lo_do_lookup

Signed-off-by: Eric Ren <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 740b0b700a6338a1cf60c26229651ac5f6724944
      
https://github.com/qemu/qemu/commit/740b0b700a6338a1cf60c26229651ac5f6724944
  Author: Liu Bo <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  Virtiofsd: fix memory leak on fuse queueinfo

For fuse's queueinfo, both queueinfo array and queueinfos are allocated in
fv_queue_set_started() but not cleaned up when the daemon process quits.

This fixes the leak in proper places.

Signed-off-by: Liu Bo <address@hidden>
Signed-off-by: Eric Ren <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 0e81414c54161296212f6bc8a1c70526c4a9755a
      
https://github.com/qemu/qemu/commit/0e81414c54161296212f6bc8a1c70526c4a9755a
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Support remote posix locks

Doing posix locks with-in guest kernel are not sufficient if a file/dir
is being shared by multiple guests. So we need the notion of daemon doing
the locks which are visible to rest of the guests.

Given posix locks are per process, one can not call posix lock API on host,
otherwise bunch of basic posix locks properties are broken. For example,
If two processes (A and B) in guest open the file and take locks on different
sections of file, if one of the processes closes the fd, it will close
fd on virtiofsd and all posix locks on file will go away. This means if
process A closes the fd, then locks of process B will go away too.

Similar other problems exist too.

This patch set tries to emulate posix locks while using open file
description locks provided on Linux.

Daemon provides two options (-o posix_lock, -o no_posix_lock) to enable
or disable posix locking in daemon. By default it is enabled.

There are few issues though.

- GETLK() returns pid of process holding lock. As we are emulating locks
  using OFD, and these locks are not per process and don't return pid
  of process, so GETLK() in guest does not reuturn process pid.

- As of now only F_SETLK is supported and not F_SETLKW. We can't block
  the thread in virtiofsd for arbitrary long duration as there is only
  one thread serving the queue. That means unlock request will not make
  it to daemon and F_SETLKW will block infinitely and bring virtio-fs
  to a halt. This is a solvable problem though and will require significant
  changes in virtiofsd and kernel. Left as a TODO item for now.

Signed-off-by: Vivek Goyal <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 620e9d8d9cee6df7fe71168dea950dba0cc21a4a
      
https://github.com/qemu/qemu/commit/620e9d8d9cee6df7fe71168dea950dba0cc21a4a
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy()

vu_socket_path is NULL when --fd=FDNUM was used.  Use
fuse_lowlevel_is_virtio() instead.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: e7b337326d594b71b07cd6dbb332c49c122c80a4
      
https://github.com/qemu/qemu/commit/e7b337326d594b71b07cd6dbb332c49c122c80a4
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: prevent fv_queue_thread() vs virtio_loop() races

We call into libvhost-user from the virtqueue handler thread and the
vhost-user message processing thread without a lock.  There is nothing
protecting the virtqueue handler thread if the vhost-user message
processing thread changes the virtqueue or memory table while it is
running.

This patch introduces a read-write lock.  Virtqueue handler threads are
readers.  The vhost-user message processing thread is a writer.  This
will allow concurrency for multiqueue in the future while protecting
against fv_queue_thread() vs virtio_loop() races.

Note that the critical sections could be made smaller but it would be
more invasive and require libvhost-user changes.  Let's start simple and
improve performance later, if necessary.  Another option would be an
RCU-style approach with lighter-weight primitives.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: baed65c060c0e524530bc243eec427fb408bd477
      
https://github.com/qemu/qemu/commit/baed65c060c0e524530bc243eec427fb408bd477
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: make lo_release() atomic

Hold the lock across both lo_map_get() and lo_map_remove() to prevent
races between two FUSE_RELEASE requests.  In this case I don't see a
serious bug but it's safer to do things atomically.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: acefdde73b403576a241ebd8dbe8431ddc0d9442
      
https://github.com/qemu/qemu/commit/acefdde73b403576a241ebd8dbe8431ddc0d9442
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: prevent races with lo_dirp_put()

Introduce lo_dirp_put() so that FUSE_RELEASEDIR does not cause
use-after-free races with other threads that are accessing lo_dirp.

Also make lo_releasedir() atomic to prevent FUSE_RELEASEDIR racing with
itself.  This prevents double-frees.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 1222f015558fc34cea02aa3a5a92de608c82cec8
      
https://github.com/qemu/qemu/commit/1222f015558fc34cea02aa3a5a92de608c82cec8
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: rename inode->refcount to inode->nlookup

This reference counter plays a specific role in the FUSE protocol.  It's
not a generic object reference counter and the FUSE kernel code calls it
"nlookup".

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 49e9ec749d4db62ae51f76354143cee183912a1d
      
https://github.com/qemu/qemu/commit/49e9ec749d4db62ae51f76354143cee183912a1d
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M contrib/libvhost-user/libvhost-user.c
    M contrib/libvhost-user/libvhost-user.h

  Log Message:
  -----------
  libvhost-user: Fix some memtable remap cases

If a new setmemtable command comes in once the vhost threads are
running, it will remap the guests address space and the threads
will now be looking in the wrong place.

Fortunately we're running this command under lock, so we can
update the queue mappings so that threads will look in the new-right
place.

Note: This doesn't fix things that the threads might be doing
without a lock (e.g. a readv/writev!)  That's for another time.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9257e514d861afa759c36704e1904d43ca3fec88
      
https://github.com/qemu/qemu/commit/9257e514d861afa759c36704e1904d43ca3fec88
  Author: Miklos Szeredi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: fix refcounting on remove/rename

Signed-off-by: Miklos Szeredi <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: c241aa9457d88c6a0d027f48fadfed131646bce3
      
https://github.com/qemu/qemu/commit/c241aa9457d88c6a0d027f48fadfed131646bce3
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: introduce inode refcount to prevent use-after-free

If thread A is using an inode it must not be deleted by thread B when
processing a FUSE_FORGET request.

The FUSE protocol itself already has a counter called nlookup that is
used in FUSE_FORGET messages.  We cannot trust this counter since the
untrusted client can manipulate it via FUSE_FORGET messages.

Introduce a new refcount to keep inodes alive for the required lifespan.
lo_inode_put() must be called to release a reference.  FUSE's nlookup
counter holds exactly one reference so that the inode stays alive as
long as the client still wants to remember it.

Note that the lo_inode->is_symlink field is moved to avoid creating a
hole in the struct due to struct field alignment.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: e468d4af5f5192ab33283464a9f6933044ce47f7
      
https://github.com/qemu/qemu/commit/e468d4af5f5192ab33283464a9f6933044ce47f7
  Author: Peng Tao <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: do not always set FUSE_FLOCK_LOCKS

Right now we always enable it regardless of given commandlines.
Fix it by setting the flag relying on the lo->flock bit.

Signed-off-by: Peng Tao <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: fc1aed0bf96259d0b46b1cfea7497b7762c4ee3d
      
https://github.com/qemu/qemu/commit/fc1aed0bf96259d0b46b1cfea7497b7762c4ee3d
  Author: Eryu Guan <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_signals.c
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: convert more fprintf and perror to use fuse log infra

Signed-off-by: Eryu Guan <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 65da4539803373ec4eec97ffc49ee90083e56efd
      
https://github.com/qemu/qemu/commit/65da4539803373ec4eec97ffc49ee90083e56efd
  Author: Vivek Goyal <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Reset O_DIRECT flag during file open

If an application wants to do direct IO and opens a file with O_DIRECT
in guest, that does not necessarily mean that we need to bypass page
cache on host as well. So reset this flag on host.

If somebody needs to bypass page cache on host as well (and it is safe to
do so), we can add a knob in daemon later to control this behavior.

I check virtio-9p and they do reset O_DIRECT flag.

Signed-off-by: Vivek Goyal <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 8e4e41e39eac5ee5f378d66f069a2f70a1734317
      
https://github.com/qemu/qemu/commit/8e4e41e39eac5ee5f378d66f069a2f70a1734317
  Author: Misono Tomohiro <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Fix data corruption with O_APPEND write in writeback mode

When writeback mode is enabled (-o writeback), O_APPEND handling is
done in kernel. Therefore virtiofsd clears O_APPEND flag when open.
Otherwise O_APPEND flag takes precedence over pwrite() and write
data may corrupt.

Currently clearing O_APPEND flag is done in lo_open(), but we also
need the same operation in lo_create(). So, factor out the flag
update operation in lo_open() to update_open_flags() and call it
in both lo_open() and lo_create().

This fixes the failure of xfstest generic/069 in writeback mode
(which tests O_APPEND write data integrity).

Signed-off-by: Misono Tomohiro <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9b610b09b49b1aada256097b338d49da805da6ae
      
https://github.com/qemu/qemu/commit/9b610b09b49b1aada256097b338d49da805da6ae
  Author: Misono Tomohiro <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: passthrough_ll: Use cache_readdir for directory open

Since keep_cache(FOPEN_KEEP_CACHE) has no effect for directory as
described in fuse_common.h, use cache_readdir(FOPNE_CACHE_DIR) for
diretory open when cache=always mode.

Signed-off-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9ceaaa15cf21073c2b23058c374f61c30cd39c31
      
https://github.com/qemu/qemu/commit/9ceaaa15cf21073c2b23058c374f61c30cd39c31
  Author: piaojun <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c

  Log Message:
  -----------
  virtiofsd: add definition of fuse_buf_writev()

Define fuse_buf_writev() which use pwritev and writev to improve io
bandwidth. Especially, the src bufs with 0 size should be skipped as
their mems are not *block_size* aligned which will cause writev failed
in direct io mode.

Signed-off-by: Jun Piao <address@hidden>
Suggested-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: c465bba2c90a810f6e71e4f2646b1b4ee4b478de
      
https://github.com/qemu/qemu/commit/c465bba2c90a810f6e71e4f2646b1b4ee4b478de
  Author: piaojun <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/buffer.c

  Log Message:
  -----------
  virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better 
performance

fuse_buf_writev() only handles the normal write in which src is buffer
and dest is fd. Specially if src buffer represents guest physical
address that can't be mapped by the daemon process, IO must be bounced
back to the VMM to do it by fuse_buf_copy().

Signed-off-by: Jun Piao <address@hidden>
Suggested-by: Dr. David Alan Gilbert <address@hidden>
Suggested-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a3d756c5aecccc4c0e51060a7e2f1c87bf8f1180
      
https://github.com/qemu/qemu/commit/a3d756c5aecccc4c0e51060a7e2f1c87bf8f1180
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: process requests in a thread pool

Introduce a thread pool so that fv_queue_thread() just pops
VuVirtqElements and hands them to the thread pool.  For the time being
only one worker thread is allowed since passthrough_ll.c is not
thread-safe yet.  Future patches will lift this restriction so that
multiple FUSE requests can be processed in parallel.

The main new concept is struct FVRequest, which contains both
VuVirtqElement and struct fuse_chan.  We now have fv_VuDev for a device,
fv_QueueInfo for a virtqueue, and FVRequest for a request.  Some of
fv_QueueInfo's fields are moved into FVRequest because they are
per-request.  The name FVRequest conforms to QEMU coding style and I
expect the struct fv_* types will be renamed in a future refactoring.

This patch series is not optimal.  fbuf reuse is dropped so each request
does malloc(se->bufsize), but there is no clean and cheap way to keep
this with a thread pool.  The vq_lock mutex is held for longer than
necessary, especially during the eventfd_write() syscall.  Performance
can be improved in the future.

prctl(2) had to be added to the seccomp whitelist because glib invokes
it.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: cdc497c6925be745bc895355bd4674a17a4b2a8b
      
https://github.com/qemu/qemu/commit/cdc497c6925be745bc895355bd4674a17a4b2a8b
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c

  Log Message:
  -----------
  virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races

When running with multiple threads it can be tricky to handle
FUSE_INIT/FUSE_DESTROY in parallel with other request types or in
parallel with themselves.  Serialize FUSE_INIT and FUSE_DESTROY so that
malicious clients cannot trigger race conditions.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Masayoshi Mizuma <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 28f7a3b026f231bfe8de5fed6a18a8d27b1dfcee
      
https://github.com/qemu/qemu/commit/28f7a3b026f231bfe8de5fed6a18a8d27b1dfcee
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: fix lo_destroy() resource leaks

Now that lo_destroy() is serialized we can call unref_inode() so that
all inode resources are freed.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 951b3120dbc971f08681e1d860360e4a1e638902
      
https://github.com/qemu/qemu/commit/951b3120dbc971f08681e1d860360e4a1e638902
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_i.h
    M tools/virtiofsd/fuse_lowlevel.c
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: add --thread-pool-size=NUM option

Add an option to control the size of the thread pool.  Requests are now
processed in parallel by default.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: fe4c15798a48143dd6b1f58d2d3cad12206ce211
      
https://github.com/qemu/qemu/commit/fe4c15798a48143dd6b1f58d2d3cad12206ce211
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd: Convert lo_destroy to take the lo->mutex lock itself

lo_destroy was relying on some implicit knowledge of the locking;
we can avoid this if we create an unref_inode that doesn't take
the lock and then grab it for the whole of the lo_destroy.

Suggested-by: Vivek Goyal <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a931b6861e59c78d861017e9c6a9c161ff49a163
      
https://github.com/qemu/qemu/commit/a931b6861e59c78d861017e9c6a9c161ff49a163
  Author: Xiao Yang <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/passthrough_ll.c

  Log Message:
  -----------
  virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()

lo_copy_file_range() passes -errno to fuse_reply_err() and then fuse_reply_err()
changes it to errno again, so that subsequent fuse_send_reply_iov_nofree() 
catches
the wrong errno.(i.e. reports "fuse: bad error value: ...").

Make fuse_send_reply_iov_nofree() accept the correct -errno by passing errno
directly in lo_copy_file_range().

Signed-off-by: Xiao Yang <address@hidden>
Reviewed-by: Eryu Guan <address@hidden>

dgilbert: Sent upstream and now Merged as aa1185e153f774f1df65
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 9883df8ccae6d744a0c8d9cbf9d62b1797d70ebd
      
https://github.com/qemu/qemu/commit/9883df8ccae6d744a0c8d9cbf9d62b1797d70ebd
  Author: Eryu Guan <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/fuse_virtio.c

  Log Message:
  -----------
  virtiofsd: stop all queue threads on exit in virtio_loop()

On guest graceful shutdown, virtiofsd receives VHOST_USER_GET_VRING_BASE
request from VMM and shuts down virtqueues by calling fv_set_started(),
which joins fv_queue_thread() threads. So when virtio_loop() returns,
there should be no thread is still accessing data in fuse session and/or
virtio dev.

But on abnormal exit, e.g. guest got killed for whatever reason,
vhost-user socket is closed and virtio_loop() breaks out the main loop
and returns to main(). But it's possible fv_queue_worker()s are still
working and accessing fuse session and virtio dev, which results in
crash or use-after-free.

Fix it by stopping fv_queue_thread()s before virtio_loop() returns,
to make sure there's no-one could access fuse session and virtio dev.

Reported-by: Qingming Su <address@hidden>
Signed-off-by: Eryu Guan <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 1d59b1b210d7c3b0bdf4b10ebe0bb1fccfcb8b95
      
https://github.com/qemu/qemu/commit/1d59b1b210d7c3b0bdf4b10ebe0bb1fccfcb8b95
  Author: Masayoshi Mizuma <address@hidden>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M tools/virtiofsd/helper.c

  Log Message:
  -----------
  virtiofsd: add some options to the help message

Add following options to the help message:
- cache
- flock|no_flock
- norace
- posix_lock|no_posix_lock
- readdirplus|no_readdirplus
- timeout
- writeback|no_writeback
- xattr|no_xattr

Signed-off-by: Masayoshi Mizuma <address@hidden>

dgilbert: Split cache, norace, posix_lock, readdirplus off
  into our own earlier patches that added the options

Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Misono Tomohiro <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a43efa34c7d7b628cbf1ec0fe60043e5c91043ea
      
https://github.com/qemu/qemu/commit/a43efa34c7d7b628cbf1ec0fe60043e5c91043ea
  Author: Peter Maydell <address@hidden>
  Date:   2020-01-24 (Fri, 24 Jan 2020)

  Changed paths:
    M .gitignore
    M MAINTAINERS
    M Makefile
    M Makefile.objs
    M configure
    M contrib/libvhost-user/libvhost-user.c
    M contrib/libvhost-user/libvhost-user.h
    M docs/interop/vhost-user.json
    M hw/virtio/vhost-user.c
    A include/standard-headers/linux/fuse.h
    M scripts/update-linux-headers.sh
    A tools/virtiofsd/50-qemu-virtiofsd.json.in
    A tools/virtiofsd/Makefile.objs
    A tools/virtiofsd/buffer.c
    A tools/virtiofsd/fuse.h
    A tools/virtiofsd/fuse_common.h
    A tools/virtiofsd/fuse_i.h
    A tools/virtiofsd/fuse_log.c
    A tools/virtiofsd/fuse_log.h
    A tools/virtiofsd/fuse_lowlevel.c
    A tools/virtiofsd/fuse_lowlevel.h
    A tools/virtiofsd/fuse_misc.h
    A tools/virtiofsd/fuse_opt.c
    A tools/virtiofsd/fuse_opt.h
    A tools/virtiofsd/fuse_signals.c
    A tools/virtiofsd/fuse_virtio.c
    A tools/virtiofsd/fuse_virtio.h
    A tools/virtiofsd/helper.c
    A tools/virtiofsd/passthrough_helpers.h
    A tools/virtiofsd/passthrough_ll.c
    A tools/virtiofsd/seccomp.c
    A tools/virtiofsd/seccomp.h

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/dgilbert-gitlab/tags/pull-virtiofs-20200123b' into staging

virtiofsd first pull v2

Import our virtiofsd.
This pulls in the daemon to drive a file system connected to the
existing qemu virtiofsd device.
It's derived from upstream libfuse with lots of changes (and a lot
trimmed out).
The daemon lives in the newly created qemu/tools/virtiofsd

Signed-off-by: Dr. David Alan Gilbert <address@hidden>

v2
  drop the docs while we discuss where they should live
  and we need to redo the manpage in anything but texi

# gpg: Signature made Thu 23 Jan 2020 16:45:18 GMT
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <address@hidden>" 
[full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert-gitlab/tags/pull-virtiofs-20200123b: (108 commits)
  virtiofsd: add some options to the help message
  virtiofsd: stop all queue threads on exit in virtio_loop()
  virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()
  virtiofsd: Convert lo_destroy to take the lo->mutex lock itself
  virtiofsd: add --thread-pool-size=NUM option
  virtiofsd: fix lo_destroy() resource leaks
  virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races
  virtiofsd: process requests in a thread pool
  virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better 
performance
  virtiofsd: add definition of fuse_buf_writev()
  virtiofsd: passthrough_ll: Use cache_readdir for directory open
  virtiofsd: Fix data corruption with O_APPEND write in writeback mode
  virtiofsd: Reset O_DIRECT flag during file open
  virtiofsd: convert more fprintf and perror to use fuse log infra
  virtiofsd: do not always set FUSE_FLOCK_LOCKS
  virtiofsd: introduce inode refcount to prevent use-after-free
  virtiofsd: passthrough_ll: fix refcounting on remove/rename
  libvhost-user: Fix some memtable remap cases
  virtiofsd: rename inode->refcount to inode->nlookup
  virtiofsd: prevent races with lo_dirp_put()
  ...

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


Compare: https://github.com/qemu/qemu/compare/c0248b36d8d1...a43efa34c7d7



reply via email to

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