Re: Re: Re: Kernel module: return a number from a device

From: Rocky Hotas <rockyhotas_at_tilde.team>
Date: Tue, 09 Apr 2024 15:46:35 UTC
On apr 06 22:21, Warner Losh wrote:
> 
> running means there's a tight loop somewhere... uiomove doesn't do that. It
> is a bunch of ifs that go to a copyout.  Arc4random shouldn't either. I'd
> add printf to see where.

Using some uprintf along the code of rolld_read, I confirm that
there's a loop involving cat.

[...]

> This should produce an infinite number of chars...  maybe it is and d_size
> is 1 and they are all NULs. Try cat -v.

Yes: there was an infinite number of chars, but they were non-printable,
so invisibile, because they are the raw values 0, 1, 2, 3, 4 or 5 resulting
from `random_item % d_size'.

Only `cat -v' could show them.

The infinite `cat' output is provoked by the `1' value provided as
second parameter of `uiomove(&random_out, 1, uio)' without any other
comparison involving uio_offset, so never signaling the end of "file",
as mentioned by Dag-Erling.

Thank you!

Rocky