1. 07 3月, 2017 14 次提交
    • M
      test-keyval: Cover use with qobject input visitor · 9e3943f8
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-6-git-send-email-armbru@redhat.com>
      9e3943f8
    • D
      qapi: qobject input visitor variant for use with keyval_parse() · cbd8acf3
      Daniel P. Berrange 提交于
      Currently the QObjectInputVisitor assumes that all scalar values are
      directly represented as the final types declared by the thing being
      visited. i.e. it assumes an 'int' is using QInt, and a 'bool' is using
      QBool, etc.  This is good when QObjectInputVisitor is fed a QObject
      that came from a JSON document on the QMP monitor, as it will strictly
      validate correctness.
      
      To allow QObjectInputVisitor to be reused for visiting a QObject
      originating from keyval_parse(), an alternative mode is needed where
      all the scalars types are represented as QString and converted on the
      fly to the final desired type.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1475246744-29302-8-git-send-email-berrange@redhat.com>
      
      Rebased, conflicts resolved, commit message updated to refer to
      keyval_parse().  autocast replaced by keyval in identifiers,
      noautocast replaced by fail in tests.
      
      Fix qobject_input_type_uint64_keyval() not to reject '-', for QemuOpts
      compatibility: replace parse_uint_full() by open-coded
      parse_option_number().  The next commit will add suitable tests.
      Leave out the fancy ERANGE error reporting for now, but add a TODO
      comment.  Add it qobject_input_type_int64_keyval() and
      qobject_input_type_number_keyval(), too.
      
      Open code parse_option_bool() and parse_option_size() so we have to
      call qobject_input_get_name() only when actually needed.  Again, leave
      out ERANGE error reporting for now.
      
      QAPI/QMP downstream extension prefixes __RFQDN_ don't work, because
      keyval_parse() splits them at '.'.  This will be addressed later in
      the series.
      
      qobject_input_type_int64_keyval(), qobject_input_type_uint64_keyval(),
      qobject_input_type_number_keyval() tweaked for style.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-5-git-send-email-armbru@redhat.com>
      cbd8acf3
    • M
      keyval: New keyval_parse() · d454dbe0
      Markus Armbruster 提交于
      keyval_parse() parses KEY=VALUE,... into a QDict.  Works like
      qemu_opts_parse(), except:
      
      * Returns a QDict instead of a QemuOpts (d'oh).
      
      * Supports nesting, unlike QemuOpts: a KEY is split into key
        fragments at '.' (dotted key convention; the block layer does
        something similar on top of QemuOpts).  The key fragments are QDict
        keys, and the last one's value is updated to VALUE.
      
      * Each key fragment may be up to 127 bytes long.  qemu_opts_parse()
        limits the entire key to 127 bytes.
      
      * Overlong key fragments are rejected.  qemu_opts_parse() silently
        truncates them.
      
      * Empty key fragments are rejected.  qemu_opts_parse() happily
        accepts empty keys.
      
      * It does not store the returned value.  qemu_opts_parse() stores it
        in the QemuOptsList.
      
      * It does not treat parameter "id" specially.  qemu_opts_parse()
        ignores all but the first "id", and fails when its value isn't
        id_wellformed(), or duplicate (a QemuOpts with the same ID is
        already stored).  It also screws up when a value contains ",id=".
      
      * Implied value is not supported.  qemu_opts_parse() desugars "foo" to
        "foo=on", and "nofoo" to "foo=off".
      
      * An implied key's value can't be empty, and can't contain ','.
      
      I intend to grow this into a saner replacement for QemuOpts.  It'll
      take time, though.
      
      Note: keyval_parse() provides no way to do lists, and its key syntax
      is incompatible with the __RFQDN_ prefix convention for downstream
      extensions, because it blindly splits at '.', even in __RFQDN_.  Both
      issues will be addressed later in the series.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1488317230-26248-4-git-send-email-armbru@redhat.com>
      d454dbe0
    • M
      tests: Fix gcov-files-test-qemu-opts-y, gcov-files-test-logging-y · 112c9446
      Markus Armbruster 提交于
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-3-git-send-email-armbru@redhat.com>
      112c9446
    • M
      test-qemu-opts: Cover qemu_opts_parse() of "no" · 0e2052b2
      Markus Armbruster 提交于
      qemu_opts_parse() interprets "no" as negated empty key.  Consistent
      with its acceptance of empty keys elsewhere, whatever that's worth.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-Id: <1488317230-26248-2-git-send-email-armbru@redhat.com>
      0e2052b2
    • P
      Merge remote-tracking branch 'remotes/xtensa/tags/20170306-xtensa' into staging · ff79d5e9
      Peter Maydell 提交于
      target/xtensa updates:
      
      - instantiate local memories in xtensa sim machine;
      - add two missing include files to xtensa core importing script.
      
      # gpg: Signature made Mon 06 Mar 2017 22:32:45 GMT
      # gpg:                using RSA key 0x51F9CC91F83FA044
      # gpg: Good signature from "Max Filippov <filippov@cadence.com>"
      # gpg:                 aka "Max Filippov <max.filippov@cogentembedded.com>"
      # gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"
      # Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044
      
      * remotes/xtensa/tags/20170306-xtensa:
        target/xtensa: add two missing headers to core import script
        target/xtensa: sim: instantiate local memories
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      ff79d5e9
    • P
      Merge remote-tracking branch 'remotes/gkurz/tags/fixes-for-2.9' into staging · d6780c82
      Peter Maydell 提交于
      Fixes issues that got merged with the latest pull request:
      - missing O_NOFOLLOW flag for CVE-2016-960
      - build break with older glibc that don't have O_PATH and AT_EMPTY_PATH
      - various bugs reported by Coverity
      
      # gpg: Signature made Mon 06 Mar 2017 17:51:29 GMT
      # gpg:                using DSA key 0x02FC3AEB0101DBC2
      # gpg: Good signature from "Greg Kurz <groug@kaod.org>"
      # gpg:                 aka "Greg Kurz <groug@free.fr>"
      # gpg:                 aka "Greg Kurz <gkurz@linux.vnet.ibm.com>"
      # gpg:                 aka "Gregory Kurz (Groug) <groug@free.fr>"
      # gpg:                 aka "[jpeg image of size 3330]"
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 2BD4 3B44 535E C0A7 9894  DBA2 02FC 3AEB 0101 DBC2
      
      * remotes/gkurz/tags/fixes-for-2.9:
        9pfs: fix vulnerability in openat_dir() and local_unlinkat_common()
        9pfs: fix O_PATH build break with older glibc versions
        9pfs: don't use AT_EMPTY_PATH in local_set_cred_passthrough()
        9pfs: fail local_statfs() earlier
        9pfs: fix fd leak in local_opendir()
        9pfs: fix bogus fd check in local_remove()
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      d6780c82
    • P
      Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2017-03-06-tag' into staging · 7dc3bc7a
      Peter Maydell 提交于
      qemu-ga patch queue for 2.9
      
      * fix fsfreeze for filesystems mounted in multiple locations
      * fix test failure when running in a chroot
      * support for socket-based activation
      
      # gpg: Signature made Mon 06 Mar 2017 07:54:17 GMT
      # gpg:                using RSA key 0x3353C9CEF108B584
      # gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
      # gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
      # gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
      # Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584
      
      * remotes/mdroth/tags/qga-pull-2017-03-06-tag:
        tests: check path to avoid a failing qga/get-vcpus test
        qga: ignore EBUSY when freezing a filesystem
        qga: add systemd socket activation support
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      7dc3bc7a
    • G
      9pfs: fix vulnerability in openat_dir() and local_unlinkat_common() · b003fc0d
      Greg Kurz 提交于
      We should pass O_NOFOLLOW otherwise openat() will follow symlinks and make
      QEMU vulnerable.
      
      While here, we also fix local_unlinkat_common() to use openat_dir() for
      the same reasons (it was a leftover in the original patchset actually).
      
      This fixes CVE-2016-9602.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      b003fc0d
    • G
      9pfs: fix O_PATH build break with older glibc versions · 918112c0
      Greg Kurz 提交于
      When O_PATH is used with O_DIRECTORY, it only acts as an optimization: the
      openat() syscall simply finds the name in the VFS, and doesn't trigger the
      underlying filesystem.
      
      On systems that don't define O_PATH, because they have glibc version 2.13
      or older for example, we can safely omit it. We don't want to deactivate
      O_PATH globally though, in case it is used without O_DIRECTORY. The is done
      with a dedicated macro.
      
      Systems without O_PATH may thus fail to resolve names that involve
      unreadable directories, compared to newer systems succeeding, but such
      corner case failure is our only option on those older systems to avoid
      the security hole of chasing symlinks inappropriately.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      (added last paragraph to changelog as suggested by Eric Blake)
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      918112c0
    • G
      9pfs: don't use AT_EMPTY_PATH in local_set_cred_passthrough() · b314f6a0
      Greg Kurz 提交于
      The name argument can never be an empty string, and dirfd always point to
      the containing directory of the file name. AT_EMPTY_PATH is hence useless
      here. Also it breaks build with glibc version 2.13 and older.
      
      It is actually an oversight of a previous tentative patch to implement this
      function. We can safely drop it.
      Reported-by: NMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      b314f6a0
    • G
      9pfs: fail local_statfs() earlier · 23da0145
      Greg Kurz 提交于
      If we cannot open the given path, we can return right away instead of
      passing -1 to fstatfs() and close(). This will make Coverity happy.
      
      (Coverity issue CID1371729)
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NDaniel P. berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      23da0145
    • G
      9pfs: fix fd leak in local_opendir() · faab207f
      Greg Kurz 提交于
      Coverity issue CID1371731
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      faab207f
    • G
      9pfs: fix bogus fd check in local_remove() · b7361d46
      Greg Kurz 提交于
      This was spotted by Coverity as a fd leak. This is certainly true, but also
      local_remove() would always return without doing anything, unless the fd is
      zero, which is very unlikely.
      
      (Coverity issue CID1371732)
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      b7361d46
  2. 06 3月, 2017 26 次提交