Re: kldunload kernel: How should the kernel behave when it is requested to unload itself

From: Warner Losh <imp_at_bsdimp.com>
Date: Thu, 09 Nov 2023 17:03:05 UTC
Yea. Kexec is what you'd need to do to get a new kernel... and we don't
support kexec... so I agree this is good..

Warner

On Thu, Nov 9, 2023, 9:34 AM Doug Rabson <dfr@rabson.org> wrote:

> I think your intuition is correct - it never makes sense to unload the
> kernel (IMO). I approved the review.
>
> Doug.
>
>
> On Thu, 9 Nov 2023 at 16:10, Zhenlei Huang <zlei@freebsd.org> wrote:
>
>> Hi,
>>
>> This is *NOT* joking.
>>
>> While working on https://reviews.freebsd.org/D42527 I realized the
>> module kernel also has userrefs, that is to say, userland can request
>> to unload kernel, aka `kldunload kernel`.
>>
>> This is interesting. Well no doubt that the loader can unload kernel.
>> Then after the kernel is loaded and has been initialized (SYSINIT), how
>> should it behave when it get an unload request?
>>
>> I'm proposing https://reviews.freebsd.org/D42530 to do not allow
>> unloading
>> the kernel. It is by intuition.
>>
>> What do you think ?
>>
>>
>> Best regards,
>> Zhenlei
>>
>>