1. 18 2月, 2014 1 次提交
  2. 22 11月, 2013 1 次提交
    • S
      qga: Fix compiler warnings (missing format attribute, wrong format strings) · d607a523
      Stefan Weil 提交于
      gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):
      
        CC    qga/commands.o
      qga/commands.c: In function ‘slog’:
      qga/commands.c:28:5: error:
       function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
           g_logv("syslog", G_LOG_LEVEL_INFO, fmt, ap);
           ^
      
      gcc 4.8.2 reports this warning when slog is declared with the
      gnu_printf format attribute:
      
      qga/commands-posix.c: In function ‘qmp_guest_file_open’:
      qga/commands-posix.c:404:5: warning:
       format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat=]
           slog("guest-file-open, handle: %d", handle);
           ^
      
      On 32 bit hosts there are three more warnings which are also fixed here.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d607a523
  3. 16 11月, 2013 1 次提交
    • W
      qga: Fix shutdown command of guest agent to work with SysV · 485e741c
      whitearchey 提交于
      For now guest agent uses following command to shutdown system:
      shutdown -P +0 "blabla"
      but this syntax works only with shutdown command from systemd or upstart,
      because SysV shutdown requires -h switch.
      
      Following patch changes the command so it works with systemd, upstart and SysV
      
      With upstart/systemd qga use one of thee commands, depending on 'mode' parameter:
        shutdown -P +0 "..."
        shutdown -H +0 "..."
        shutdown -r +0 "..."
      SysV equivalents for these are:
        shutdown -h -P +0 "..."
        shutdown -h -H +0 "..."
        shutdown -h -r +0 "..."
      and these retain their meaning with upstart/systemd.
      
      According to FreeBSD manpages, shutdown does not accept -P and -H options. Commands should be:
        shutdown -p +0 "..."
        shutdown -h +0 "..."
        shutdown -r +0 "..."
      
      shutdown in Solaris does not accept any of -hHpPr and does not accept time in "+0" format
      Signed-off-by: NMichael Avdienko <whitearchey@gmail.com>
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      485e741c
  4. 11 10月, 2013 1 次提交
  5. 13 5月, 2013 2 次提交
  6. 07 5月, 2013 1 次提交
    • L
      qga: set umask 0077 when daemonizing (CVE-2013-2007) · c689b4f1
      Laszlo Ersek 提交于
      The qemu guest agent creates a bunch of files with insecure permissions
      when started in daemon mode. For example:
      
        -rw-rw-rw- 1 root root /var/log/qemu-ga.log
        -rw-rw-rw- 1 root root /var/run/qga.state
        -rw-rw-rw- 1 root root /var/log/qga-fsfreeze-hook.log
      
      In addition, at least all files created with the "guest-file-open" QMP
      command, and all files created with shell output redirection (or
      otherwise) by utilities invoked by the fsfreeze hook script are affected.
      
      For now mask all file mode bits for "group" and "others" in
      become_daemon().
      
      Temporarily, for compatibility reasons, stick with the 0666 file-mode in
      case of files newly created by the "guest-file-open" QMP call. Do so
      without changing the umask temporarily.
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      c689b4f1
  7. 22 3月, 2013 1 次提交
  8. 12 3月, 2013 6 次提交
  9. 29 1月, 2013 2 次提交
  10. 19 1月, 2013 1 次提交
  11. 09 1月, 2013 11 次提交
  12. 19 12月, 2012 2 次提交
  13. 05 10月, 2012 2 次提交
  14. 22 6月, 2012 2 次提交
  15. 30 5月, 2012 2 次提交
  16. 25 5月, 2012 1 次提交
  17. 15 5月, 2012 3 次提交
    • L
      qemu-ga: guest-shutdown: use only async-signal-safe functions · 3674838c
      Luiz Capitulino 提交于
      POSIX mandates[1] that a child process of a multi-thread program uses
      only async-signal-safe functions before exec(). We consider qemu-ga
      to be multi-thread, because it uses glib.
      
      However, qmp_guest_shutdown() uses functions that are not
      async-signal-safe. Fix it the following way:
      
      - fclose() -> reopen_fd_to_null()
      - execl() -> execle()
      - exit() -> _exit()
      - drop slog() usage (which is not safe)
      
        [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.htmlSigned-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      3674838c
    • L
      qemu-ga: guest-shutdown: become synchronous · d5dd3498
      Luiz Capitulino 提交于
      Last commit dropped qemu-ga's SIGCHLD handler, used to automatically
      reap terminated children processes. This introduced a bug to
      qmp_guest_shutdown(): it will generate zombies.
      
      This problem probably doesn't matter in the success case, as the VM
      will shutdown anyway, but let's do the right thing and reap the
      created process. This ultimately means that guest-shutdown is now a
      synchronous command.
      
      An interesting side effect is that guest-shutdown is now able to
      report an error to the client if shutting down fails.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      d5dd3498
    • L
      qemu-ga: guest-suspend: make the API synchronous · dc8764f0
      Luiz Capitulino 提交于
      Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
      children processes. The idea is to avoid having qemu-ga commands blocked
      waiting for children to terminate.
      
      That approach has two problems:
      
       1. qemu-ga is unable to detect errors in the child, meaning that qemu-ga
          returns success even if the child fails to perform its task
      
       2. if a command does depend on the child exit status, the command has to
          play tricks to bypass the automatic reaper
      
      Case 2 impacts the guest-suspend-* API, because it has to execute an external
      program to check for suspend support. Today, to bypass the automatic reaper,
      suspend code has to double fork and pass exit status information through a
      pipe. Besides being complex, this is prone to race condition bugs. Indeed,
      the current code does have such bugs.
      
      Making the guest-suspend-* API synchronous (ie. by dropping the SIGCHLD
      handler and calling waitpid() from commands) is a much simpler approach,
      which fixes current race conditions bugs and enables commands to detect
      errors in the child.
      
      This commit does just that. There's a side effect though, guest-shutdown
      will generate zombies if shutting down fails. This will be fixed by the
      next commit.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      dc8764f0