On Fri, May 26, 2023 at 09:00:41PM +0200, Henryk Paluch wrote: > > fatal protection fault in supervisor mode > > Finally I was able to build custom ramdisk kernel with DDB to get stacktrace. > > Kernel ident: > OpenBSD 7.3 (RAMDISK_CD) #1: Fri May 26 20:28:53 CEST 2023 > root@openbsd-kvm.default:/usr/src/sys/arch/amd64/compile/RAMDISK_CD > > While installing sets from cd0: > wdc_atapi_start: not ready, st = 50 > kernel: protection fault trap, code=0 > Stopped at wdcstart+0x19: movl 0x58(%rdi),%eax > ddb> trace > wdcstart(ffff80000007c168,ffff80000007c168,ffff80000007c168,10,ffff800021712d88,10282) > at wdcstart+0x19 > wdc_atapi_the_machine(ffff80000007c168,fffffd807e9aed08,2,ffff80000007c168,ffff80000007c168,fffffd807e9aed08) > at wdc_atapi_the_machine+0x14a > wdc_atapi_intr(ffff80000007c168,fffffd807e9aed08,1,ffff80000007c168,fffffd807e9aed08,ffff80000007c168) > at wdc_atapi_intr+0x47 > wdcintr(ffff80000007c168,ffff80000007c168,ffff800000024dc0,0,6,1) at > wdcintr+0xae > intr_handler(ffff800021712ed8,ffff800000065500,ffff800000065680,ffffffff811f91b0,ffffffff81211216,ffff800021712ec8) > at intr_handler+0x26 > Xintr_ioapic_edge14_untramp(0,ffffffff811f91b0,0,18041969,ffff800000024dc0,6) > at Xintr_ioapic_edge14_untramp+0x18f > Xspllower(0,0,ffff800000024d00,0,ffffffff81211455,602) at Xspllower+0xc > scsi_xsh_runqueue(ffff800000024d00,ffff800000024d00,0,ffff800000024d00,ffff80000014b100,ffff800000023970) > at scsi_xsh_runqueue+0xe3 > scsi_xsh_add(ffff800000023970,ffff800000023970,fffffd806ccfc700,ffff800000023800,fffffd806ccfc7f0,6) > at scsi_xsh_add+0x80 > cdstrategy(fffffd806ccfc700,fffffd806ccfc700,fffffd806ccfc700,fffffd806ccfc700,fffffd806ccfc7f0,150) > at cdstrategy+0xe4 > spec_strategy(ffff8000217130c0,ffff8000217130c0,fffffd806ccfc700,1f,ffffffff81141f01,ffff8000217130b0) > at spec_strategy+0x3f > VOP_STRATEGY(fffffd807de4f6c8,fffffd806ccfc700,fffffd806ccfc700,fffffd807de4f6c8,ffffffff8114026b,ffff8000217130e0) > at VOP_STRATEGY+0x3c > cd9660_strategy(ffff800021713130,ffff800021713130,fffffd806ccfc700,4,fffffd807e9d2970,fffffd807e9d2970) > at cd9660_strategy+0xce > VOP_STRATEGY(fffffd807e9d2970,fffffd806ccfc700,fffffd806ccfc700,fffffd807e9d2970,ffffffff8114026b,ffff800021713150) > at VOP_STRATEGY+0x3c > bio_doread(fffffd807e9d2970,1c1e,800,4,ffff800000148f00,20) at bio_doread+0x67 > breadn(fffffd807e9d2970,1bfe,800,ffff800000148e00,ffff800000148f00,20) at > breadn+0x71 > cd9660_read(ffff8000217132b0,ffff8000217132b0,fffffd807edfb170,fffffd807e9d2970,0,ffff8000217133e0) > at cd9660_read+0x12b > VOP_READ(fffffd807e9d2970,ffff8000217133e0,0,fffffd807f7bff08,fffffd807f7bff08,ffff800000000000) > at VOP_READ+0x31 > vn_read(fffffd807edfb170,ffff8000217133e0,0,fffffd807edfb170,fffffd807edfb170,20000) > at vn_read+0xad > dofilereadv(ffff8000216cd888,3,ffff8000217133e0,0,ffff8000217134a0,ffff8000216cd888) > at dofilereadv+0x62 > sys_read(ffff8000216cd888,ffff800021713450,ffff8000217134a0,ffff8000216cd888,1000,2d0170000) > at sys_read+0x43 > syscall(ffff800021713500,ffff800021713500,0,ffff8000216cd888,0,0) at > syscall+0x201 > Xsyscall(0,3,0,3,0,238128000) at Xsyscall+0x128 > end of kernel > end trace frame: 0x79ff6e90a870, count: -23 > ddb> > > Please let me know if you need more information on specific frame. > > I build my custom ramdisk kernel this way: > 1. installed these sets: `sys` and `src` > 2. added to /usr/src/sys/arch/amd64/conf/RAMDISK_CD > > option DDB > option DDB_SAFE_CONSOLE > > 3. prepared config but did not build kernel yet > > cd /usr/src/sys/arch/amd64/conf > config RAMDISK_CD > > 4. Now tricky part - short circuit to make kernel with ramdisk... > > cd /usr/src > make obj > # workaround for error "-lstubs not found" > cd /usr/src/distrib/special/libstubs > make > # now back to work... > cd /usr/src/distrib/amd64/ramdisk_cd/ > # don't do this BUILDUSER=root on production! > make bsd.gz BUILDUSER=root > > 5. obj/bsd.gz is your own gzipped kernel with installation ramdisk you can > boot. > (I used virtual hdd with exiting OpenBSD 7.3/amd64 to boot this kernel and > (re)installing > OpenBSD from CD there to trigger that trap). > > Best regards > -- > --Henryk Paluch >
qemu command line for this vm?