Bug 253147

Summary: Setting for displaying utf8 characters on all vt consoles results in panic on 14-CURRENT and 13.0-ALPHA3
Product: Base System Reporter: Yasuhiro Kimura <yasu>
Component: kernAssignee: Toomas Soome <tsoome>
Status: Closed FIXED    
Severity: Affects Some People CC: tsoome
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Yasuhiro Kimura 2021-02-01 03:33:00 UTC
To display utf8 characters on all vt console I did following settings.

1. Download GNU Unifont BDF file (http://unifoundry.com/pub/unifont/unifont-13.0.05/font-builds/unifont-13.0.05.bdf.gz)
2. gunzip unifont-13.0.05.bdf.gz
3. vtfontcvt unifont-13.0.05.bdf unifont.fnt
4. cp unifont.fnt /usr/share/vt/fonts
5. Add 'allscreens_flags="-f 8x16 unifont.fnt"' to /etc/rc.conf
6. Add 'hw.vga.textmode=0' to /boot/loader.conf.local
7. shutdown -r now

On 12.2-RELEASE and 11.4-RELEASE it works as is expected. But on 14-CURRENT(man) and 13.0-ALPHA3(stable/13) it result in kernel panic.

Screen shot of 14-CURRENT.
https://www.utahime.org/FreeBSD/panic.20210201.14-CURRENT.png

14-CURRENT(main):
yasu@rolling-vm-freebsd1[1006]% uname -a
FreeBSD rolling-vm-freebsd1.home.utahime.org 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n244517-f17fc5439f5: Mon Feb  1 10:55:51 JST 2021     rootz@rolling-vm-freebsd1.home.utahime.org:/usr0/freebsd/src/obj/usr0/freebsd/src/git/amd64.amd64/sys/GENERIC  amd64

13.0-ALPHA3(stable/13):
yasu@rolling-vm-freebsd5[1005]% uname -a
FreeBSD rolling-vm-freebsd5.home.utahime.org 13.0-ALPHA3 FreeBSD 13.0-ALPHA3 #0 stable/13-c256214-g40cb0344eb2: Mon Feb  1 11:30:28 JST 2021     rootz@rolling-vm-freebsd5.home.utahime.org:/usr0/freebsd/src/obj/usr0/freebsd/src/git/amd64.amd64/sys/GENERIC  amd64
Comment 1 commit-hook freebsd_committer 2021-02-01 22:35:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd

commit 1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-01-31 21:04:59 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-02-01 22:33:58 +0000

    vt: parse_font_info_static should set refcount, not parse_font_info

    As we get started with no memory allocator, we set up static font data
    for font passed by loader (if there is any). At this time, we also must
    set refcount 1, and refcount will get incremented in cnprobe() callback.

    At some point the memory allocator will be available, and we will set up
    properly allocated font data, but we should not disturb the refcount.

    PR: 253147

 sys/dev/vt/vt_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Comment 2 commit-hook freebsd_committer 2021-02-02 12:56:52 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b79f2bc6c5c7431fa1f7c02937ec97a64653ade1

commit b79f2bc6c5c7431fa1f7c02937ec97a64653ade1
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-01-24 18:59:36 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-02-02 10:11:38 +0000

    vt: panic while changing vt font

    Set refcount for loader provided font to 1 to prevent this font
    from being released (so we can reset to default).

    As we get started with no memory allocator, we set up static font data
    for font passed by loader (if there is any). At this time, we also must
    set refcount 1, and refcount will get incremented in cnprobe() callback.

    At some point the memory allocator will be available, and we will set up
    properly allocated font data, but we should not disturb the refcount.

    PR: 252833
    PR: 253147

    (cherry picked and squashed 93ebd6307efeb95a29bc614edd0c67c2af850e98 and
    1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd)

 sys/dev/vt/vt_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)