NetBSD Problem Report #57582

From  Sun Aug 13 16:28:51 2023
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 91ACF1A9238
	for <>; Sun, 13 Aug 2023 16:28:51 +0000 (UTC)
Message-Id: <>
Date: Sun, 13 Aug 2023 16:28:50 +0000 (UTC)
Subject: ddb `write' command can't write to module text, only to main kernel text
X-Send-Pr-Version: www-1.0

>Number:         57582
>Category:       port-amd64
>Synopsis:       ddb `write' command can't write to module text, only to main kernel text
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 13 16:30:01 +0000 2023
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, 8, ...
The NetBSD fatal page fault in supervisor mode
For pages that are in the kernel text or kernel rodata segments, x86 db_write_bytes temporarily changes the kernel pmap to allow writes to the affected page while it works.

However, it doesn't do this for modules, only the main kernel.
db{0}> w/l kmem_cache_reap_now+9 fc7b1245
solaris:kmem_cache_reap_now+0x9         fc7b1230 = fc7b1245
[ 458962.7683486] fatal page fault in supervisor mode
[ 458962.7683486] trap type 6 code 0x3 rip 0xffffffff8023d829 cs 0x8 rflags 0x10246 cr2 0xffffffff841e0fc6 ilevel 0x8 rsp 0xffffd3849412a8a0
[ 458962.7683486] curlwp 0xfffff3f4e02ee040 pid 0.2 lowest kstack 0xffffd384941282c0
kernel: page fault trap, code=0
Faulted in DDB; continuing...

Teach db_write_bytes to detect module text/rodata segments too.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.