https://bugs.kde.org/show_bug.cgi?id=411189

            Bug ID: 411189
           Summary: Valgrind does not support POWER9 "DARN" RNG
                    instructions
           Product: valgrind
           Version: 3.15 SVN
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: ll...@randombit.net
  Target Milestone: ---

SUMMARY

Valgrind does not currently support the POWER9 DARN RNG instructions. These are
similar to x86 RDRAND/RDSEED.

STEPS TO REPRODUCE

$ cat min_darn.c
#include <stdint.h>
#include <stdio.h>

int main()
{
  uint64_t darn = __builtin_darn();
  printf("%016llX\n", darn);
  return 0;
}
$ powerpc64le-unknown-linux-gnu-gcc -mcpu=power9 -O min_darn.c -o min_darn
$ ./min_darn
51302492414386A8 # this will differ each time the program is run
$ valgrind ./min_darn

OBSERVED RESULT

==129755== Memcheck, a memory error detector
==129755== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==129755== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==129755== Command: ./min_darn
==129755== 
disInstr(ppc): unhandled instruction: 0x7C8105E6
                 primary 31(0x1F), secondary 1510(0x5E6)
==129755== valgrind: Unrecognised instruction at address 0x100005d0.
==129755==    at 0x100005D0: main (in /home/lloyd/min_darn)
==129755== Your program just tried to execute an instruction that Valgrind
==129755== did not recognise.  There are two possible reasons for this.
==129755== 1. Your program has a bug and erroneously jumped to a non-code
==129755==    location.  If you are running Memcheck and you just saw a
==129755==    warning about a bad jump, it's probably your program's fault.
==129755== 2. The instruction is legitimate but Valgrind doesn't handle it,
==129755==    i.e. it's Valgrind's fault.  If you think this is the case or
==129755==    you are not sure, please let us know and we'll try to fix it.
==129755== Either way, Valgrind will now raise a SIGILL signal which will
==129755== probably kill your program.
==129755== 
==129755== Process terminating with default action of signal 4 (SIGILL)
==129755==  Illegal opcode at address 0x100005D0
==129755==    at 0x100005D0: main (in /home/lloyd/min_darn)
==129755== 
==129755== HEAP SUMMARY:
==129755==     in use at exit: 0 bytes in 0 blocks
==129755==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==129755== 
==129755== All heap blocks were freed -- no leaks are possible
==129755== 
==129755== For lists of detected and suppressed errors, rerun with: -s
==129755== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction


EXPECTED RESULT

It should run ;)

SOFTWARE/OS VERSIONS
Valgrind 3.15.0 release
GCC 9.2.0 release
POWER9 running CentOS 7, kernel 4.14.0

ADDITIONAL INFORMATION
A POWER9 machine is available on the GCC compile farm (gcc135).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to