Re: jitterentropy-rngd woes on armel
On Sat, Jun 26, 2021 at 08:43:22PM +0200, Christoph Biedl wrote:
>...
> can please somebody check the armel jitterentropy-rngd package in
> testing and unstable (1.2.1-2) on various arm platforms? Things look
> really weird and I have no idea how to proceed.
>
> Initial observation: On an old Seagate Dockstar (Feroceon 88FR131, armv5tel
> CPU) running Debian bullseye (buster is fine), jitterentropy-rngd ("je-r")
> fails to start:
>
> # jitterentropy-rngd
> Floating point exception
>
> Using gdb:
>
> Program received signal SIGFPE, Arithmetic exception.
> 0xb6fb6810 in raise () from /lib/arm-linux-gnueabi/libpthread.so.0
> (gdb) bt
> #0 0xb6fb6810 in raise () from /lib/arm-linux-gnueabi/libpthread.so.0
> #1 0x00404968 in __aeabi_ldiv0 ()
> #2 0x00402664 in sha3_update (ctx=0xbefff55c, in=0x404b50 <msg_256> "^", <incomplete sequence \326>,
> inlen=3) at jitterentropy-base.c:567
> #3 0x00402d48 in sha3_tester () at jitterentropy-base.c:658
> #4 0x004038dc in jent_entropy_init () at jitterentropy-base.c:1387
> #5 0x00400ffc in alloc () at jitterentropy-rngd.c:666
> #6 main (argc=1, argv=0xbefff914) at jitterentropy-rngd.c:794
>
> So this is most likely caused by
>
> size_t partial = ctx->msg_len % ctx->r;
>
>
> Surprise however: In an armel bullseye chroot on both a Cubietruck
> (armhf) and Raspberry Pi 4 (arm64), je-r just runs fine.
>
> And running a rebuilt je-r on the Dockstar yields a completely different
> message:
>
> jitterentropy-rngd - Error: The initialization of CPU Jitter RNG failed with error code 11
>
> Adding some debug print statements reveals this is caused from a fail in
> sha3_tester, and indeed the computed hash is different. But the line
> that initially caused trouble is passed.
>
>
> Possibly unrelated, the gcc warnings (line number are a bit off)
>
> jitterentropy-base.c: In function ‘sha3_tester’:
> jitterentropy-base.c:311:25: warning: cast increases required alignment of target type [-Wcast-align]
> 311 | struct sha_ctx *name = (struct sha_ctx *) name ## _ctx_buf
> | ^
> jitterentropy-base.c:649:2: note: in expansion of macro ‘HASH_CTX_ON_STACK’
> 649 | HASH_CTX_ON_STACK(ctx);
> | ^~~~~~~~~~~~~~~~~
>
> don't look good but I fail to understand the root cause behind this.
> Applying some #pragma pack made the warnings go away, the issue
> remained, though.
>
> Any idea?
This sounds similar to other problems reported on armv5tel:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975977#44
https://bugs.debian.org/987566
I've added Bernhard to Cc, who has done most of the investigation
work on these bugs.
> Christoph
cu
Adrian
Reply to: