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

Valgrind crashes when running QRandomGenerator code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 5.10
    • Core: Other
    • None

    Description

      Valgrind crashes when running on the example in qtbug61754.tar.gz from QTBUG-61754 with a dev build of Qt 5:

      mitch@mitch:~/dev/temp/qtbug61754-qt5_dev_debug-Debug$ valgrind --leak-check=full ./qtbug61754 
      ==11435== Memcheck, a memory error detector
      ==11435== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
      ==11435== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
      ==11435== Command: ./qtbug61754
      ==11435== 
      vex amd64->IR: unhandled instruction bytes: 0x48 0xF 0xC7 0xF2 0x48 0x89 0x10 0xBE
      vex amd64->IR:   REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=0
      vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F
      vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
      ==11435== valgrind: Unrecognised instruction at address 0x5919180.
      ==11435==    at 0x5919180: _rdrand64_step (immintrin.h:186)
      ==11435==    by 0x5919180: qt_random_cpu(void*, long long) (qrandom.cpp:97)
      ==11435==    by 0x591923D: fill_cpu(unsigned int*, long long) (qrandom.cpp:315)
      ==11435==    by 0x59198AF: fill_internal(unsigned int*, long long) (qrandom.cpp:331)
      ==11435==    by 0x5919A8C: fill(void*, void*) (qrandom.cpp:377)
      ==11435==    by 0x5919B63: QRandomGenerator::get32() (qrandom.cpp:839)
      ==11435==    by 0x59827A2: qt_create_qhash_seed() (qhash.cpp:297)
      ==11435==    by 0x598287E: qt_initialize_qhash_seed() (qhash.cpp:323)
      ==11435==    by 0x598311F: QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int) (qhash.cpp:499)
      ==11435==    by 0x5A82F25: QHash<QLoggingCategory*, QtMsgType>::detach_helper() (qhash.h:597)
      ==11435==    by 0x5A80C91: detach (qhash.h:275)
      ==11435==    by 0x5A80C91: insert (qhash.h:769)
      ==11435==    by 0x5A80C91: QLoggingRegistry::registerCategory(QLoggingCategory*, QtMsgType) (qloggingregistry.cpp:339)
      ==11435==    by 0x5A7F52E: QLoggingCategory::init(char const*, QtMsgType) (qloggingcategory.cpp:252)
      ==11435==    by 0x5A7F552: QLoggingCategory::QLoggingCategory(char const*) (qloggingcategory.cpp:224)
      ==11435== Your program just tried to execute an instruction that Valgrind
      ==11435== did not recognise.  There are two possible reasons for this.
      ==11435== 1. Your program has a bug and erroneously jumped to a non-code
      ==11435==    location.  If you are running Memcheck and you just saw a
      ==11435==    warning about a bad jump, it's probably your program's fault.
      ==11435== 2. The instruction is legitimate but Valgrind doesn't handle it,
      ==11435==    i.e. it's Valgrind's fault.  If you think this is the case or
      ==11435==    you are not sure, please let us know and we'll try to fix it.
      ==11435== Either way, Valgrind will now raise a SIGILL signal which will
      ==11435== probably kill your program.
      ==11435== 
      ==11435== Process terminating with default action of signal 4 (SIGILL)
      ==11435==  Illegal opcode at address 0x5919180
      ==11435==    at 0x5919180: _rdrand64_step (immintrin.h:186)
      ==11435==    by 0x5919180: qt_random_cpu(void*, long long) (qrandom.cpp:97)
      ==11435==    by 0x591923D: fill_cpu(unsigned int*, long long) (qrandom.cpp:315)
      ==11435==    by 0x59198AF: fill_internal(unsigned int*, long long) (qrandom.cpp:331)
      ==11435==    by 0x5919A8C: fill(void*, void*) (qrandom.cpp:377)
      ==11435==    by 0x5919B63: QRandomGenerator::get32() (qrandom.cpp:839)
      ==11435==    by 0x59827A2: qt_create_qhash_seed() (qhash.cpp:297)
      ==11435==    by 0x598287E: qt_initialize_qhash_seed() (qhash.cpp:323)
      ==11435==    by 0x598311F: QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int) (qhash.cpp:499)
      ==11435==    by 0x5A82F25: QHash<QLoggingCategory*, QtMsgType>::detach_helper() (qhash.h:597)
      ==11435==    by 0x5A80C91: detach (qhash.h:275)
      ==11435==    by 0x5A80C91: insert (qhash.h:769)
      ==11435==    by 0x5A80C91: QLoggingRegistry::registerCategory(QLoggingCategory*, QtMsgType) (qloggingregistry.cpp:339)
      ==11435==    by 0x5A7F52E: QLoggingCategory::init(char const*, QtMsgType) (qloggingcategory.cpp:252)
      ==11435==    by 0x5A7F552: QLoggingCategory::QLoggingCategory(char const*) (qloggingcategory.cpp:224)
      ==11435== 
      ==11435== HEAP SUMMARY:
      ==11435==     in use at exit: 93,932 bytes in 16 blocks
      ==11435==   total heap usage: 16 allocs, 0 frees, 93,932 bytes allocated
      ==11435== 
      ==11435== LEAK SUMMARY:
      ==11435==    definitely lost: 0 bytes in 0 blocks
      ==11435==    indirectly lost: 0 bytes in 0 blocks
      ==11435==      possibly lost: 0 bytes in 0 blocks
      ==11435==    still reachable: 93,932 bytes in 16 blocks
      ==11435==         suppressed: 0 bytes in 0 blocks
      ==11435== Reachable blocks (those to which a pointer was found) are not shown.
      ==11435== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==11435== 
      ==11435== For counts of detected and suppressed errors, rerun with: -v
      ==11435== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
      Illegal instruction (core dumped)
      

      5.9.1 works as expected.

      SHA-1s of modules that are part of the dev build:

      Entering 'qtbase'
      commit c888d302bc4ae3b2970c6db188c7276b3c831cc7
      Entering 'qtdeclarative'
      commit 1e41f6c269e23fff4c89cd907bc28f25ea0ba51c
      Entering 'qtgraphicaleffects'
      commit c1c259ea76c4d8c94f6d96c3fd0bbbece25785bf
      Entering 'qtquickcontrols2'
      commit a87d53e56c120d90d908ba1d9e19bc74343a985d
      Entering 'qtsvg'
      commit af289aced943418128f84c753017d571ed1e4d4d
      Entering 'qttools'
      commit ebb7a33ed90264a6b82c7978b58ce71b5c7cf042
      Entering 'qtvirtualkeyboard'
      commit 7c770c6e510d6c2274fd10a10e6f812672e3a6d1
      Entering 'qtxmlpatterns'
      commit c9a4897aa09d723d22b842b1fabcc296bf3c7f91
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes