Re: Open Sound System - OSS "soundon" command causes KERNEL PANIC FreeBSD-11

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Thu, 11 Feb 2016 11:19:56 +0100
On 02/11/16 11:14, Konstantin Belousov wrote:
> On Thu, Feb 11, 2016 at 07:54:57AM +0100, Hans Petter Selasky wrote:
>> On 02/11/16 03:02, Greg Quinlan wrote:
>>> Hi HPS,
>>> Note: Does not happen on FreeBSD 10.1-Stable!
>>>
>>
>> Yes, that's because WITNESS is off in 10.x by default.
>>
>> Does the attached patch solve your problem?
 >
> No, the patch below does not solve the issue, it only papers over it.
> I object against committing this change.

For cases where the returned pointer is not deferred, but only checked 
for a module's presence in the kernel you don't need a lock to protect 
anything. Maybe make a separate API for this?

>
> Issue is that, if called unlocked, the result from module_lookupbyname()
> could become invalid right after receiving.  It is the duty of the caller
> of the function to ensure that the result is still valid, and the only
> way to achieve it is to own the lock around the whole code region which
> calls the function and utilizes its result.
>
> A bug is in the OSS code.

Yes, so why not factor out the solution? Maybe more port KLD's will trip 
over this?

--HPS
Received on Thu Feb 11 2016 - 09:17:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:02 UTC