From nobody Fri Dec 30 19:13:19 2022 X-Original-To: freebsd-fs@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 4NkFLX5pNfz2lMxS for ; Fri, 30 Dec 2022 19:14:28 +0000 (UTC) (envelope-from jafarlihi@gmail.com) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NkFLW1yJCz3MmQ for ; Fri, 30 Dec 2022 19:14:27 +0000 (UTC) (envelope-from jafarlihi@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=UlhGuoXv; spf=pass (mx1.freebsd.org: domain of jafarlihi@gmail.com designates 2607:f8b0:4864:20::52d as permitted sender) smtp.mailfrom=jafarlihi@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-x52d.google.com with SMTP id h192so9883594pgc.7 for ; Fri, 30 Dec 2022 11:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=0uzOPyTC5KtbbH4j72xt64H+D9uoXqAIguTMNmFcZaA=; b=UlhGuoXvzbTnWFyydOvCaJDR9v0UE9UJtgjifrtrJOhLFmhq44xGaqy1V7h84WLBX8 n/SYp7dvMPLbtXDAarqEMQqi+T38Z8ziJlWNE1InwxzomyEsZpQQOpkdz8hT6Ne979Ik f1T6QwobNNzwtdTb4Qklo9XiyNlWIu4gfDws2qZpfIG0wdr2M/CFShKnawkH1f582M0Z whZJhg2QqwB/R1OM7+5lflDRK1vI1I8sIc4axHTznezN07FTd9OfMUKFnHZidPho65nC Sqlsa9FoT88UDSKLcxPhYn9ASFPt0YUnmXM6cMeKEK8ORCZkKYb3TL/X8rWpf2Gpv46v 1ekw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0uzOPyTC5KtbbH4j72xt64H+D9uoXqAIguTMNmFcZaA=; b=OwlN8A2kvWq4xyWeK2Li+u+r+yNLzth6PMTL8fRNIbqM45WzZITUxHAu0wxlAE5tlf F8fCJrgC2EYLf4QjefftTZ9rM3rBw8EDMAXUqRFplLyJeoMmqNSXO18w19ZfXoDkpNdA C6pIVd48CndzLS3o59JsHlO/828bMwM/FerimhroqMRhxRJMblEcTOcR0ZyWldUYoD0e LAWo4h4oqtUfuaZGzigtT3B4+CpOTIgwi6679Vucxtxi+RsnfwVwt7TjtOxi7WTXlEqJ RFYiRzYSt3bUpix5Z4JcfGTsnqHCUw6J6eeLjjBaR3tvToNvN1Fe+O+iKHYlKSUbNcsC 7d1w== X-Gm-Message-State: AFqh2kpwoH1iAu/l/P6l2Svqm2GPS3/OJigOdMebXngm/kuP4cWMKwgg IqoB408IshPn+9Pz4NsXshb5W39JbV1YpuY4C9m6NLmdP2w= X-Google-Smtp-Source: AMrXdXsrI6UtfPPv7BeMxEc68D6HSsHXXX7ZUvamTE8u2WV6BXnYCxAhlzC3vLSJOaFe2TElmmBvdXSPTz2A+hRPy/Q= X-Received: by 2002:a62:198a:0:b0:577:16ac:8447 with SMTP id 132-20020a62198a000000b0057716ac8447mr1886458pfz.56.1672427665257; Fri, 30 Dec 2022 11:14:25 -0800 (PST) List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 From: Hikmat Jafarli Date: Fri, 30 Dec 2022 23:13:19 +0400 Message-ID: Subject: Trying to implement BFS, page fault at vfs_domount_first, how to debug? To: freebsd-fs@freebsd.org Content-Type: multipart/alternative; boundary="000000000000e67b7e05f1106808" X-Spamd-Result: default: False [-3.00 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.995]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::52d:from]; ARC_NA(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; MLMMJ_DEST(0.00)[freebsd-fs@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4NkFLW1yJCz3MmQ X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N --000000000000e67b7e05f1106808 Content-Type: text/plain; charset="UTF-8" I'm trying to implement the BeOS filesystem (BFS) for FreeBSD. The repository is here: https://github.com/jafarlihi/freebsd-bfs (Please don't mind bad styling and all the copy-paste work, I'll polish it later, I'm just trying to get to some PoC where it works) Now when I try to mount a valid BFS partition (reported as BFS by `fstyp`) it executes all the way to printf that logs "Either not a BFS volume or corrupted" and then crashes with "page fault while in kernel mode" in vfs_domount_first+0x271. Here's the log: ``` Either not a BFS volume or corrupted Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x18 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff82b2427b stack pointer = 0x28:0xfffffe00df399ac0 frame pointer = 0x28:0xfffffe00df399ac0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 1208 (mount) trap number = 12 panic: page fault cpuid = 0 time = 1672414952 KDB: stack backtrace: #0 0xffffffff80c694a5 at kdb_backtrace+0x65 #1 0xffffffff80c1bb5f at vpanic+0x17f #2 0xffffffff80c1b9d3 at panic+0x43 #3 0xffffffff810afdf5 at trap_fatal+0x385 #4 0xffffffff810afe4f at trap_pfault+0x4f #5 0xffffffff810875b8 at calltrap+0x8 #6 0xffffffff80cf0651 at vfs_domount_first+0x271 #7 0xffffffff80cece9d at vfs_domount+0x2ad #8 0xffffffff80cec2d8 at vfs_donmount+0x8f8 #9 0xffffffff80ceb9a9 at sys_nmount+0x69 #10 0xffffffff810b06ec at amd64_syscall+0x10c #11 0xffffffff81087ecb at fast_syscall_common+0xf8 ``` Now I'm trying to understand what exactly goes wrong here and how to map 0x271 to the exact source line. I'd appreciate it if someone could tell me how to debug this. (Sorry for noob question, I already tried IRC and was directed here) --000000000000e67b7e05f1106808 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm trying to implement the BeOS filesystem (BFS) for = FreeBSD.
The repository is here:=C2=A0https://github.com/jafarlihi/freebsd-b= fs
(Please don't mind bad styling and all the copy-paste work,I'll polish it later, I'm just trying to get to some PoC where it= works)

Now when I try to mount a valid BFS partition (reported as B= FS by `fstyp`)
it executes all the way to printf that logs "Either = not a BFS volume or
corrupted" and then crashes with "page fau= lt while in kernel mode" in
vfs_domount_first+0x271. Here's the= log:
```
Either not a BFS volume or corrupted

Fatal trap 12: = page fault while in kernel mode
cpuid =3D 0; apic id =3D 00
fault vir= tual address =3D 0x18
fault code =3D supervisor read data, page not pres= ent
instruction pointer =3D 0x20:0xffffffff82b2427b
stack pointer =C2= =A0 =C2=A0 =C2=A0 =C2=A0=3D 0x28:0xfffffe00df399ac0
frame pointer =C2=A0= =C2=A0 =C2=A0 =C2=A0=3D 0x28:0xfffffe00df399ac0
code segment =3D base 0= x0, limit 0xfffff, type 0x1b
=3D DPL 0, pres 1, long 1, def32 0, gran 1<= br>processor eflags =3D interrupt enabled, resume, IOPL =3D 0
current pr= ocess =3D 1208 (mount)
trap number =3D 12
panic: page fault
cpuid = =3D 0
time =3D 1672414952
KDB: stack backtrace:
#0 0xffffffff80c69= 4a5 at kdb_backtrace+0x65
#1 0xffffffff80c1bb5f at vpanic+0x17f
#2 0x= ffffffff80c1b9d3 at panic+0x43
#3 0xffffffff810afdf5 at trap_fatal+0x385=
#4 0xffffffff810afe4f at trap_pfault+0x4f
#5 0xffffffff810875b8 at c= alltrap+0x8
#6 0xffffffff80cf0651 at vfs_domount_first+0x271
#7 0xfff= fffff80cece9d at vfs_domount+0x2ad
#8 0xffffffff80cec2d8 at vfs_donmount= +0x8f8
#9 0xffffffff80ceb9a9 at sys_nmount+0x69
#10 0xffffffff810b06e= c at amd64_syscall+0x10c
#11 0xffffffff81087ecb at fast_syscall_common+0= xf8
```

Now I'm trying to understand what exactly goes wrong = here
and how to map 0x271 to the exact source line.

I'd appre= ciate it if someone could tell me how to debug this.

(Sorry for noob= question, I already tried IRC and was directed here)
--000000000000e67b7e05f1106808--