Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2024 17:46:35 +0200
From:      Rocky Hotas <rockyhotas@tilde.team>
To:        freebsd-hackers@freebsd.org
Cc:        Warner Losh <imp@bsdimp.com>
Subject:   Re: Re: Re: Kernel module: return a number from a device
Message-ID:  <xvzl2mbuavcuumko2efkazrh6f55fmbxaeoq2nrzb5wkuzs2il@hdjwpeiwel62>
In-Reply-To: <CANCZdfrN3HnqfLLptMF5PBaNGpDDkC-LwGCCzMj6unAw=U-JnQ@mail.gmail.com>
References:  <CANCZdfqAUWqp_s8ULhi9A97jrMCxA1CAXJKmUJ307=PSpekKug@mail.gmail.com> <qarvyeobx2iumkc3ae6noaiukffpfgwihap32vi4yaqnkqigbi@3nxb4nmvub32> <CANCZdfrN3HnqfLLptMF5PBaNGpDDkC-LwGCCzMj6unAw=U-JnQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xvzl2mbuavcuumko2efkazrh6f55fmbxaeoq2nrzb5wkuzs2il>