1. 04 5月, 2020 11 次提交
  2. 03 5月, 2020 2 次提交
  3. 02 5月, 2020 7 次提交
    • P
      Merge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20200501' into staging · 6897541d
      Peter Maydell 提交于
      virtiofsd: Pull 2020-05-01 (includes CVE fix)
      
      This set includes a security fix, other fixes and improvements.
      
      Security fix:
      The security fix is for CVE-2020-10717 where, on low RAM hosts,
      the guest can potentially exceed the maximum fd limit.
      This fix adds some more configuration so that the user
      can explicitly set the limit.
      
      Fixes:
      
      Recursive mounting of the exported directory is now used in
      the sandbox, such that if there was a mount underneath present at
      the time the virtiofsd was started, that mount is also
      visible to the guest; in the existing code, only mounts that
      happened after startup were visible.
      
      Security improvements:
      
      The jailing for /proc/self/fd is improved - but it's something
      that shouldn't be accessible anyway.
      
      Most capabilities are now dropped at startup; again this shouldn't
      change any behaviour but is extra protection.
      
      # gpg: Signature made Fri 01 May 2020 20:06:46 BST
      # gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
      # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
      # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7
      
      * remotes/dgilbert-gitlab/tags/pull-virtiofs-20200501:
        virtiofsd: drop all capabilities in the wait parent process
        virtiofsd: only retain file system capabilities
        virtiofsd: Show submounts
        virtiofsd: jail lo->proc_self_fd
        virtiofsd: stay below fs.file-max sysctl value (CVE-2020-10717)
        virtiofsd: add --rlimit-nofile=NUM option
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      6897541d
    • S
      virtiofsd: drop all capabilities in the wait parent process · 66502bbc
      Stefan Hajnoczi 提交于
      All this process does is wait for its child.  No capabilities are
      needed.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      66502bbc
    • S
      virtiofsd: only retain file system capabilities · a59feb48
      Stefan Hajnoczi 提交于
      virtiofsd runs as root but only needs a subset of root's Linux
      capabilities(7).  As a file server its purpose is to create and access
      files on behalf of a client.  It needs to be able to access files with
      arbitrary uid/gid owners.  It also needs to be create device nodes.
      
      Introduce a Linux capabilities(7) whitelist and drop all capabilities
      that we don't need, making the virtiofsd process less powerful than a
      regular uid root process.
      
        # cat /proc/PID/status
        ...
                Before           After
        CapInh: 0000000000000000 0000000000000000
        CapPrm: 0000003fffffffff 00000000880000df
        CapEff: 0000003fffffffff 00000000880000df
        CapBnd: 0000003fffffffff 0000000000000000
        CapAmb: 0000000000000000 0000000000000000
      
      Note that file capabilities cannot be used to achieve the same effect on
      the virtiofsd executable because mount is used during sandbox setup.
      Therefore we drop capabilities programmatically at the right point
      during startup.
      
      This patch only affects the sandboxed child process.  The parent process
      that sits in waitpid(2) still has full root capabilities and will be
      addressed in the next patch.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20200416164907.244868-2-stefanha@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      a59feb48
    • M
      virtiofsd: Show submounts · ace0829c
      Max Reitz 提交于
      Currently, setup_mounts() bind-mounts the shared directory without
      MS_REC.  This makes all submounts disappear.
      
      Pass MS_REC so that the guest can see submounts again.
      
      Fixes: 5baa3b8eSigned-off-by: NMax Reitz <mreitz@redhat.com>
      Message-Id: <20200424133516.73077-1-mreitz@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
        Changed Fixes to point to the commit with the problem rather than
                the commit that turned it on
      ace0829c
    • M
      virtiofsd: jail lo->proc_self_fd · 397ae982
      Miklos Szeredi 提交于
      While it's not possible to escape the proc filesystem through
      lo->proc_self_fd, it is possible to escape to the root of the proc
      filesystem itself through "../..".
      
      Use a temporary mount for opening lo->proc_self_fd, that has it's root at
      /proc/self/fd/, preventing access to the ancestor directories.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Message-Id: <20200429124733.22488-1-mszeredi@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      397ae982
    • S
      virtiofsd: stay below fs.file-max sysctl value (CVE-2020-10717) · 8c1d353d
      Stefan Hajnoczi 提交于
      The system-wide fs.file-max sysctl value determines how many files can
      be open.  It defaults to a value calculated based on the machine's RAM
      size.  Previously virtiofsd would try to set RLIMIT_NOFILE to 1,000,000
      and this allowed the FUSE client to exhaust the number of open files
      system-wide on Linux hosts with less than 10 GB of RAM!
      
      Take fs.file-max into account when choosing the default RLIMIT_NOFILE
      value.
      
      Fixes: CVE-2020-10717
      Reported-by: NYuval Avrahami <yavrahami@paloaltonetworks.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20200501140644.220940-3-stefanha@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      8c1d353d
    • S
      virtiofsd: add --rlimit-nofile=NUM option · 6dbb7168
      Stefan Hajnoczi 提交于
      Make it possible to specify the RLIMIT_NOFILE on the command-line.
      Users running multiple virtiofsd processes should allocate a certain
      number to each process so that the system-wide limit can never be
      exhausted.
      
      When this option is set to 0 the rlimit is left at its current value.
      This is useful when a management tool wants to configure the rlimit
      itself.
      
      The default behavior remains unchanged: try to set the limit to
      1,000,000 file descriptors if the current rlimit is lower.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20200501140644.220940-2-stefanha@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      6dbb7168
  4. 01 5月, 2020 1 次提交
    • P
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 1c476135
      Peter Maydell 提交于
      Block layer patches:
      
      - Fix resize (extending) of short overlays
      - nvme: introduce PMR support from NVMe 1.4 spec
      - qemu-storage-daemon: Fix non-string --object properties
      
      # gpg: Signature made Thu 30 Apr 2020 16:51:45 BST
      # gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
      # gpg:                issuer "kwolf@redhat.com"
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        qemu-storage-daemon: Fix non-string --object properties
        qom: Factor out user_creatable_add_dict()
        nvme: introduce PMR support from NVMe 1.4 spec
        qcow2: Forward ZERO_WRITE flag for full preallocation
        iotests: Test committing to short backing file
        iotests: Filter testfiles out in filter_img_info()
        block: truncate: Don't make backing file data visible
        file-posix: Support BDRV_REQ_ZERO_WRITE for truncate
        raw-format: Support BDRV_REQ_ZERO_WRITE for truncate
        qcow2: Support BDRV_REQ_ZERO_WRITE for truncate
        block-backend: Add flags to blk_truncate()
        block: Add flags to bdrv(_co)_truncate()
        block: Add flags to BlockDriver.bdrv_co_truncate()
        qemu-iotests: allow qcow2 external discarded clusters to contain stale data
        qcow2: Add incompatibility note between backing files and raw external data files
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      1c476135
  5. 30 4月, 2020 19 次提交