From nobody Thu Nov 09 16:10:13 2023 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SR6PM3F2kz50K2y for ; Thu, 9 Nov 2023 16:10:31 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SR6PM2j2rz3glG; Thu, 9 Nov 2023 16:10:31 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699546231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=edBH6kfkbvwcSw22Q68kSQCPz8q8dBQn0OhlF9wpxbY=; b=xH9ePsFNWy4MBBvIkeu9B45sekfWFkVn338wAm2Qc1yi5Svt0yE4DgV8KAbfq0VT42krpo uPSUYn+O+ZgGpwxOZlTB5tWt4q0HTHHmlGayDrCyNKqe+m0FOV809gKeWS2QMcRwZRtOOi GFDD3ps4L2KXsnFKQFX9ESgDn8RUxSHJaeMJ0GgPu8lFgeyn3Y7L1PV4ucyLVRChPyIWnG nXBKd3fYuAD60H4T7MpsQZAxCKhZE7DUxmn/PWmpQn5LNvBK1bzOZoShI19n8DCCZ3yGOF TYV5kWM+oQQvMbgvJrX+kNpuRG8njHzw+j9a/ITP8ctr4uqRcS3DBtNQvxM5cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699546231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=edBH6kfkbvwcSw22Q68kSQCPz8q8dBQn0OhlF9wpxbY=; b=rLf/ItI1OWR1sSW2Fscx9kea5uASf6PLWKudKAeFt9RbhH5i54DqK6nen2GrDagApStlix lgXnK6yiVxPVg1KaKaXtB+1wZRpcGcCw6OOqHovMX14hKvqS0x64RwdwbKWmRbZ3YQvLTd /u9htHN2DpH7G1uyQu2Qtzn+tWBPMwKs4ziwDbjgX7jMMxYOWSVSNQMAIMPWbeqsDUT03I RsfbKsSc1e+lqtdWFU180VO1inLE1twjZDyZXpLXcutkujxXV1pMcJQ3+w5Tk7f2xghNn0 +jNpZRWhIDg3PGjzaJask2Z+pCH/n8dHaXjfI/oq5hGncuc5PposYOZiFFDjQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699546231; a=rsa-sha256; cv=none; b=uRY+CJzb7d01Pc5kBMwsGqoTeYvfOK515WLxVCtSTd3+S31nQqgBlTqm6UHnDvayYBIjMw kya8H77TJEkQesPSfD/fqy7f/VU68+AfNa3OEzPXWfuzgChUzTjGbPaP5zmsJ2ALhbY01i 2ZxYmRCAhMj/hY3xQQ7H4UnaMLm1e2+gKuipEQjlLJ85mi+kNjrkhnZhOkeM94SVEy5dqU EkDbELhUdM5Gm8p5cKI/8N+uDC9pd1d0dqtcYzdTJ6CcOkeg+zFC/yfRawd45pNfVyvMDX aoF3mCdcjd2HlafGfjzjjGbBZc4H4NMngQ6+ENsQ/jZv8vSG9m1tz+bEpm3qDQ== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4SR6PK55HmzCt6; Thu, 9 Nov 2023 16:10:29 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: kldunload kernel: How should the kernel behave when it is requested to unload itself Message-Id: <07168C68-9F81-443C-AFB6-24958BB01F9E@FreeBSD.org> Date: Fri, 10 Nov 2023 00:10:13 +0800 Cc: Konstantin Belousov , Doug Rabson To: FreeBSD Current X-Mailer: Apple Mail (2.3696.120.41.1.4) 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