Hi Steffen On Tue, Apr 19, 2022 at 7:29 PM Steffen Nurpmeso <stef...@sdaoden.eu> wrote: > In my entropy_saver.c i did > > /* For at least statistics query entropy count once */ > rv = ioctl(randfd, (int)RNDGETENTCNT, &iocarg); > > regardless of the operation. This should succeed only for an > according device.
Your assumption isn't true; this isn't a great idea in general. Ioctls _can_ be used between different fds and have different semantics. It would be easy for me to make a driver that responds to RNDGETENTCNT. The "right" way of verifying that a given fd is the [u]random device is by calling fstat and checking for chardev and 1,8 or 1,9. But I'm not even convinced that such verification is really sensible in the first place. It makes it harder to swap out with a CUSE device, if desired for policy reasons, and in general if /dev is writable or misconfigured, all bets are off for everything. Jason _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox