Re: git: 112c453ba910 - stable/15 - geom(9): struct bio KBI fix

From: Ka Ho Ng <khng300_at_gmail.com>
Date: Tue, 30 Dec 2025 04:17:14 UTC
On Mon, Dec 29, 2025 at 11:08 PM Ka Ho Ng <khng300@gmail.com> wrote:

> On Mon, Dec 29, 2025 at 10:51 PM Konstantin Belousov <kostikbel@gmail.com>
> wrote:
>
>> On Mon, Dec 29, 2025 at 10:22:50AM +0100, Kristof Provost wrote:
>> > On 22 Dec 2025, at 1:38, Ka Ho Ng wrote:
>> > > The branch stable/15 has been updated by khng:
>> > >
>> > > URL:
>> https://cgit.FreeBSD.org/src/commit/?id=112c453ba91012f19ed140c56a3ac8fc929ddabb
>> > >
>> > > commit 112c453ba91012f19ed140c56a3ac8fc929ddabb
>> > > Author:     Ka Ho Ng <khng@FreeBSD.org>
>> > > AuthorDate: 2025-12-21 22:45:03 +0000
>> > > Commit:     Ka Ho Ng <khng@FreeBSD.org>
>> > > CommitDate: 2025-12-22 00:37:40 +0000
>> > >
>> > >     geom(9): struct bio KBI fix
>> > >
>> > >     The struct bio was changed after cb85c2e2e995 on the branch. To
>> fix
>> > >     this, move BIO_ERROR flag to another value, and now
>> BIO_ERROR_COMPAT
>> > >     occupies 0x1 instead. Also, introduce b_error_compat field at the
>> > > place
>> > >     where the old bio_error was.
>> > >
>> > >     This allows non-CAM(9) disk drivers and software volume manager
>> > > modules
>> > >     compiled against 15.0-RELEASE kernel to work on 15-STABLE kernel
>> > > again.
>> > >
>> > >     Reviewed by:    kib
>> > >     Differential Revision:  https://reviews.freebsd.org/D54327
>> > >
>> > >     Approved by:    re (cperciva)
>> >
>> > I’m seeing panics on boot now:
>> >
>> >       vtnet0: Ethernet address: 58:9c:fc:0c:60:85
>> >       vtnet0: netmap queues/slots: TX 1/1024, RX 1panic: Memory
>> modified after
>> > free 0xfffff800038b51a8 (424, g_bio) + 0 = deadc0dedeacc0de
>> >
>> >       cpuid = 6
>> >       time = 1
>> >       KDB: stack backtrace:
>> >       db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
>> > 0xfffffe008d5679a0
>> >       vpanic() at vpanic+0x136/frame 0xfffffe008d567ad0
>> >       panic() at panic+0x43/frame 0xfffffe008d567b30
>> >       trash_ctor() at trash_ctor+0x74/frame 0xfffffe008d567b40
>> >       item_ctor() at item_ctor+0x59/frame 0xfffffe008d567b90
>> >       g_clone_bio() at g_clone_bio+0x1d/frame 0xfffffe008d567bb0
>> >       g_part_start() at g_part_start+0x96/frame 0xfffffe008d567c40
>> >       g_io_request() at g_io_request+0x2ca/frame 0xfffffe008d567c70
>> >       g_read_data() at g_read_data+0x95/frame 0xfffffe008d567cb0
>> >       g_raid_md_taste_intel() at g_raid_md_taste_intel+0x1d8/frame
>> > 0xfffffe008d567e50
>> >       g_raid_taste() at g_raid_taste+0x18e/frame 0xfffffe008d567ea0
>> >       g_new_provider_event() at g_new_provider_event+0xaa/frame
>> > 0xfffffe008d567ec0
>> >       g_run_events() at g_run_events+0x104/frame 0xfffffe008d567ef0
>> >       fork_exit() at fork_exit+0x82/frame 0xfffffe008d567f30
>> >       fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe008d567f30
>> >       --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
>> >       KDB: enter: panic
>> >       [ thread pid 13 tid 100069 ]
>> >       Stopped at      kdb_enter+0x33: movq    $0,0x121aa92(%rip)
>> >       db>
>> >
>> > With this commit (and the follow-up “geom(9): unset the BIO_ERROR_COMPAT
>> > flag correctly”) reverted the VM boots again.
>>
>> Does the following help?
>>
>> diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
>> index dc90bd3add22..2368f863a248 100644
>> --- a/sys/kern/vfs_bio.c
>> +++ b/sys/kern/vfs_bio.c
>> @@ -4523,8 +4523,6 @@ biodone(struct bio *bp)
>>                         bp->bio_flags |= BIO_ERROR_COMPAT;
>>                 }
>>                 done(bp);
>> -               bp->bio_error_compat = 0;
>> -               bp->bio_flags &= ~BIO_ERROR_COMPAT;
>>         }
>>  }
>>
>>
>> Yep that fixes the issue. I committed this as 9cfd75a6f88f.
>
> Ka Ho
>
+ the missing recipients and the mailing lists.

Ka Ho