Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-commits: [Wireshark-commits] master-2.6 569ab41: Tweak ws_cpuid so that Valgrind is happy

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 06 Apr 2018 23:54:36 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=569ab414c588a31ab53a32cd22fdb636825d90c4
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-2.6
Repository: wireshark

Commits:

569ab41 by Darius Davis (darius@xxxxxxxxxx):

    Tweak ws_cpuid so that Valgrind is happy.
    
    Valgrind considers the "cpuid" instruction to always depend on inputs from eax
    and ecx, even though it's only a subset of values of eax for which ecx is
    relevant.  If ecx is undefined when cpuid is executed, the outputs of cpuid
    will be considered undefined.
    
    Instead of suppressing the resulting uninitialised-value warning (the
    suppression for which is now out-of-date anyway, now that
    register_all_protocols is moved to a worker thread), let's simply set ecx to
    zero in ws_cpuid.
    
    Testing done: Built Wireshark on Linux amd64.  Before this change, running
       "tools/valgrind-wireshark.sh ./test/captures/dhcp.pcap" with
       valgrind-3.12.0.SVN on Debian 9.4 amd64 would yield the following Valgrind
       error:
    
       ==2416== Thread 2:
       ==2416== Conditional jump or move depends on uninitialised value(s)
       ==2416==    at 0xACB8B22: ws_mempbrk_sse42_compile (ws_mempbrk_sse42.c:58)
       ==2416==    by 0x74F4960: register_all_protocols_worker (register.c:37)
       ==2416==    by 0xB1403D4: g_thread_proxy (gthread.c:784)
       ==2416==    by 0xD438493: start_thread (pthread_create.c:333)
       ==2416==    by 0xB4CAACE: clone (clone.S:97)
    
       With the change, the above message is gone.  Inspected the disassembly of
       function ws_cpuid, and it looks sane -- just an added "xor ecx, ecx" at the
       top.
    
    Change-Id: I2fb382309cac234c400286a6e9fac7d922912c63
    Reviewed-on: https://code.wireshark.org/review/26733
    Petri-Dish: Anders Broman <a.broman58@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    (cherry picked from commit 5c2eade45d733433bfa5e513950b28819faa8751)
    Reviewed-on: https://code.wireshark.org/review/26783
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  c3c9727   SIP: Fix handling of response time
    adds  569ab41   Tweak ws_cpuid so that Valgrind is happy.


Summary of changes:
 tools/vg-suppressions | 11 -----------
 wsutil/ws_cpuid.h     |  3 ++-
 2 files changed, 2 insertions(+), 12 deletions(-)