Bug#858488: dieharder segfaults when testing the XOR generator
On 11 December 2022 at 22:39, Bernhard Übelacker wrote: | just for convenience: | https://github.com/eddelbuettel/rdieharder/issues/3 Yeah, but rather than piling up links to existing issue we could probably do with a fix. Ah well... Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
Bug#858488: dieharder segfaults when testing the XOR generator
just for convenience: https://github.com/eddelbuettel/rdieharder/issues/3
Bug#858488: dieharder segfaults when testing the XOR generator
On 13 May 2017 at 17:24, Bernhard Übelacker wrote: | Hello, | just tried to reproduce the crash I came to following stack: | | | gdb -q --args dieharder -g 207 -a | | Program received signal SIGSEGV, Segmentation fault. | gsl_rng_get (r=0x0) at ../gsl/gsl_rng.h:161 | 161 return (r->type->get) (r->state); | (gdb) bt | #0 gsl_rng_get (r=0x0) at ../gsl/gsl_rng.h:161 | #1 0x77b5dcc6 in XOR_get (vstate=0x633030) at rng_XOR.c:42 | #2 0x77b59ed0 in rgb_timing (test=test@entry=0x635ac0, timing=timing@entry=0x7fffdb90) at rgb_timing.c:38 | #3 0x00405889 in time_rng () at time_rng.c:38 | #4 0x0040252f in select_rng (gennum=, genname=genname@entry=0x60a7c0 "", initial_seed=) at choose_rng.c:252 | #5 0x0040262a in choose_rng () at choose_rng.c:60 | #6 0x00402141 in main (argc=4, argv=0x7fffdcf8) at dieharder.c:71 | | | gsl_rng_get/XOR_get:42 relies here to have state->grngs[1] initialized. | | | I tried to follow it and got to gsl_rng_set/XOR_set in | function rgb_timing that should put the seed to the generator. | Unfortunately gvcount is here just 1, leaving just grngs[0] set. | | | state->grngs[0] = gsl_rng_alloc(dh_rng_types[14]); | ... | for(i=1;igrngs[i] = gsl_rng_alloc(dh_rng_types[gnumbs[i]]); | | | Further reading down leads to this comment saying we need at least one | additional -g parameter: | | rng_XOR.c: | /* | * This is a special XOR generator that takes a list of GSL | * wrapped rngs and XOR's their uint output together to produce | * each new random number. Note that it SKIPS THE FIRST ONE which | * MUST be the XOR rng itself. So there have to be at least two -g X | * stanzas on the command line to use XOR, and if there aren't three | * or more it doesn't "do" anything but use the second one. | */ | | | So this command "dieharder -g 207 -a" is probably not expected | to work and "just" fails to produce an error message. | | | Kind regards, | Bernhard | | | BTW: Kind of the same problem could be observed when using such | a command line: "dieharder -g 207 -g 207 -a". | This crashes later after exhausting the whole stack. *Really* nice work, and I concur from a quick glance. Opened a ticket in my 'upstream' RDieHarder github repo. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
Bug#858488: dieharder segfaults when testing the XOR generator
Hello, just tried to reproduce the crash I came to following stack: gdb -q --args dieharder -g 207 -a Program received signal SIGSEGV, Segmentation fault. gsl_rng_get (r=0x0) at ../gsl/gsl_rng.h:161 161 return (r->type->get) (r->state); (gdb) bt #0 gsl_rng_get (r=0x0) at ../gsl/gsl_rng.h:161 #1 0x77b5dcc6 in XOR_get (vstate=0x633030) at rng_XOR.c:42 #2 0x77b59ed0 in rgb_timing (test=test@entry=0x635ac0, timing=timing@entry=0x7fffdb90) at rgb_timing.c:38 #3 0x00405889 in time_rng () at time_rng.c:38 #4 0x0040252f in select_rng (gennum=, genname=genname@entry=0x60a7c0 "", initial_seed=) at choose_rng.c:252 #5 0x0040262a in choose_rng () at choose_rng.c:60 #6 0x00402141 in main (argc=4, argv=0x7fffdcf8) at dieharder.c:71 gsl_rng_get/XOR_get:42 relies here to have state->grngs[1] initialized. I tried to follow it and got to gsl_rng_set/XOR_set in function rgb_timing that should put the seed to the generator. Unfortunately gvcount is here just 1, leaving just grngs[0] set. state->grngs[0] = gsl_rng_alloc(dh_rng_types[14]); ... for(i=1;igrngs[i] = gsl_rng_alloc(dh_rng_types[gnumbs[i]]); Further reading down leads to this comment saying we need at least one additional -g parameter: rng_XOR.c: /* * This is a special XOR generator that takes a list of GSL * wrapped rngs and XOR's their uint output together to produce * each new random number. Note that it SKIPS THE FIRST ONE which * MUST be the XOR rng itself. So there have to be at least two -g X * stanzas on the command line to use XOR, and if there aren't three * or more it doesn't "do" anything but use the second one. */ So this command "dieharder -g 207 -a" is probably not expected to work and "just" fails to produce an error message. Kind regards, Bernhard BTW: Kind of the same problem could be observed when using such a command line: "dieharder -g 207 -g 207 -a". This crashes later after exhausting the whole stack.
Bug#858488: dieharder segfaults when testing the XOR generator
On 22 March 2017 at 14:12, Aaron Toponce wrote: | Package: dieharder | Version: 3.31.1-7 | | When testing the XOR generator with dieharder(1), the program segfaults: | | % dieharder -g 207 -a | zsh: segmentation fault dieharder -g 207 -a I can confirm that. There has not been a whole lot of upstream development in quite some time so not sure how likely it is that we will see a fix. Dirk | | This generator is a listed generator, according to `-g -1': | | % dieharder -g -1 | #=# | #dieharder version 3.31.1 Copyright 2003 Robert G. Brown # | #=# | #Id Test Name | Id Test Name | Id Test Name # | #=# | | 000 borosh13|001 cmrg|002 coveyou | | | 003 fishman18 |004 fishman20 |005 fishman2x | | | 006 gfsr4 |007 knuthran|008 knuthran2 | | | 009 knuthran2002|010 lecuyer21 |011 minstd | | | 012 mrg |013 mt19937 |014 mt19937_1999 | | | 015 mt19937_1998|016 r250|017 ran0 | | | 018 ran1|019 ran2|020 ran3 | | | 021 rand|022 rand48 |023 random128-bsd | | | 024 random128-glibc2|025 random128-libc5 |026 random256-bsd | | | 027 random256-glibc2|028 random256-libc5 |029 random32-bsd | | | 030 random32-glibc2 |031 random32-libc5 |032 random64-bsd | | | 033 random64-glibc2 |034 random64-libc5 |035 random8-bsd | | | 036 random8-glibc2 |037 random8-libc5 |038 random-bsd | | | 039 random-glibc2 |040 random-libc5|041 randu | | | 042 ranf|043 ranlux |044 ranlux389 | | | 045 ranlxd1 |046 ranlxd2 |047 ranlxs0 | | | 048 ranlxs1 |049 ranlxs2 |050 ranmar | | | 051 slatec |052 taus|053 taus2 | | | 054 taus113 |055 transputer |056 tt800 | | | 057 uni |058 uni32 |059 vax | | | 060 waterman14 |061 zuf | | | #=# | | 200 stdin_input_raw |201 file_input_raw |202 file_input | | | 203 ca |204 uvag|205 AES_OFB | | | 206 Threefish_OFB |207 XOR (supergenerator)|208 kiss | | | 209 superkiss || | | #=# | | 400 R_wichmann_hill |401 R_marsaglia_multic. |402 R_super_duper | | | 403 R_mersenne_twister |404 R_knuth_taocp |405 R_knuth_taocp2 | | #=# | | 500 /dev/random |501 /dev/urandom| | | #=# | #=# | | According to the dieharder(1) manpage, the XOR `supergenerator' uses the | `AES_OFB', `Threefish_OFB', and `kiss' generators, XOR-ing them together: | | `... for the hypercautious the XOR generator with AES, threefish, kiss, all | loaded at once and xor'd together.' | | Running the tests separately does not segfault: | | % dieharder -g 205 -a | (...snip...) | % dieharder -g 206 -a | (...snip...) | % dieharder -g 208 -a | (...snip...) | | This is on Debian GNU/Linux Sid, kernel 4.9.0-1-amd64, libc6 2.24-9. | | -- | . o . o . o . . o o . . . o . | . . o . o o o . o . o o . . o | o o o . o . . o o o o . o o o | [DELETED ATTACHMENT signature.asc, application/pgp-signature] -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
Bug#858488: dieharder segfaults when testing the XOR generator
Package: dieharder Version: 3.31.1-7 When testing the XOR generator with dieharder(1), the program segfaults: % dieharder -g 207 -a zsh: segmentation fault dieharder -g 207 -a This generator is a listed generator, according to `-g -1': % dieharder -g -1 #=# #dieharder version 3.31.1 Copyright 2003 Robert G. Brown # #=# #Id Test Name | Id Test Name | Id Test Name # #=# | 000 borosh13|001 cmrg|002 coveyou | | 003 fishman18 |004 fishman20 |005 fishman2x | | 006 gfsr4 |007 knuthran|008 knuthran2 | | 009 knuthran2002|010 lecuyer21 |011 minstd | | 012 mrg |013 mt19937 |014 mt19937_1999 | | 015 mt19937_1998|016 r250|017 ran0 | | 018 ran1|019 ran2|020 ran3 | | 021 rand|022 rand48 |023 random128-bsd | | 024 random128-glibc2|025 random128-libc5 |026 random256-bsd | | 027 random256-glibc2|028 random256-libc5 |029 random32-bsd | | 030 random32-glibc2 |031 random32-libc5 |032 random64-bsd | | 033 random64-glibc2 |034 random64-libc5 |035 random8-bsd | | 036 random8-glibc2 |037 random8-libc5 |038 random-bsd | | 039 random-glibc2 |040 random-libc5|041 randu | | 042 ranf|043 ranlux |044 ranlux389 | | 045 ranlxd1 |046 ranlxd2 |047 ranlxs0 | | 048 ranlxs1 |049 ranlxs2 |050 ranmar | | 051 slatec |052 taus|053 taus2 | | 054 taus113 |055 transputer |056 tt800 | | 057 uni |058 uni32 |059 vax | | 060 waterman14 |061 zuf | | #=# | 200 stdin_input_raw |201 file_input_raw |202 file_input | | 203 ca |204 uvag|205 AES_OFB | | 206 Threefish_OFB |207 XOR (supergenerator)|208 kiss | | 209 superkiss || | #=# | 400 R_wichmann_hill |401 R_marsaglia_multic. |402 R_super_duper | | 403 R_mersenne_twister |404 R_knuth_taocp |405 R_knuth_taocp2 | #=# | 500 /dev/random |501 /dev/urandom| | #=# #=# According to the dieharder(1) manpage, the XOR `supergenerator' uses the `AES_OFB', `Threefish_OFB', and `kiss' generators, XOR-ing them together: `... for the hypercautious the XOR generator with AES, threefish, kiss, all loaded at once and xor'd together.' Running the tests separately does not segfault: % dieharder -g 205 -a (...snip...) % dieharder -g 206 -a (...snip...) % dieharder -g 208 -a (...snip...) This is on Debian GNU/Linux Sid, kernel 4.9.0-1-amd64, libc6 2.24-9. -- . o . o . o . . o o . . . o . . . o . o o o . o . o o . . o o o o . o . . o o o o . o o o signature.asc Description: PGP signature