Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-70606

QRandomGenerator only returns zeros on Linux

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.11.1
    • Core: Other
    • None
    • Linux/Other display system

    Description

      This is a follow-up to QTBUG-69423, and based on the diagnostics program (hwtest.cpp) posted in that bug.

      The program is failing on a XenServer VM, where QRandomGenerator::system() returns a bunch of zeros rather than random values. However, reading the output of /dev/urandom on a shell gives us random values.

      This the output of the program (compiled with Clang):

      Compile-time features:
       - GCC-compatible compiler version 402
       - Compiler supports RDRND instruction set
      Runtime CPU features:
       - Maximum basic CPUID leaf 13
       - CPUID leaf 1 ECX = 0xc3ba2203
       - CPU doesn't have RDRND support
      Dumping 64 bytes from QRandomGenerator::system() (should be zeroes):
       0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
      Samples from QRandomGenerator::system():
       0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
      Samples from the HW generator (this may crash):
       (0 entries total)
       0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
      

      The output of strace has been attached. I guess the relevant line is:
      getrandom(0x7fffd88a0060, 40, 0) = -1 ENOSYS (Function not implemented)
      I suppose the issue here is that while our Docker VM runs a recent Ubuntu, the Docker host is Debian Jessie. Jessie comes with kernel 3.16, while getrandom was only implemented in kernel 3.17. I couldn't find any information on Qt requiring a specific kernel version.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            j_schultz Johannes Schultz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes