You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
auto_initramfs=0 with fullscreen kernel splash image prevents the kernel from booting #7086
Boot. If console logging is enabled in the bootloader and kernel, you'll only see log messages from the bootloader, not the kernel. The kernel will not boot
Remove fullscreen_logo_enabled=1 and fullscreen_logo_name=logo.tga from cmdline.txt. Notice it boots fine
Device (s)
Raspberry Pi CM5 Lite
System
pi@raspberrypi:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2025-10-01
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 7dadcf1fc5ce1648ab09409ab978831690c9a955, stage4
pi@raspberrypi:~ $ vcgencmd version
2025/09/23 12:05:55
Copyright (c) 2012 Broadcom
version 02da46a3 (release) (embedded)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.12.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
Admittedly it sounds like the error handling if it can't find the logo file has issues
Yes, that's the fundamental problem I'm trying to bring attention to with this issue.
However, why does the fullscreen splash image feature need to be dependent on initramfs? If the .tga file is in /lib/firmware, why can't it just read the file from there and display it?
It's probably a question of initialisation order. With a splash screen there is the desire to get it on the display as early as possible, but waiting for some USB mass storage device to enumerate in order for the rootfs to be loaded will clearly delay the presentation.
The logo is only loaded from the con_switch hook when fbcon initialises. If the logo isn't available at that point then it is too late.
This is reusing the mechanism that puts up the N raspberries with a larger logo.
I've found a couple of niggles with the handling, but actually the handling if the file isn't present seems to be reasonable.
Fixes are in #7088
@6by9 I'm sorry, but I haven't had an opportunity to retest this, as I've had to abandon this feature due to the fact that the bootloader does not support the display resolution (800x480) and timings I need. See raspberrypi/rpi-eeprom#479 Testing this is on my todo list, but I'm under tight deadlines at the moment and can't afford the resource spend to test a feature I can't use.
I was told by your applications team that a new bootloader would be released soon (~1 month) with the ability to specify additional timings, and I'm waiting for that to drop before I pick this up again.
This is still reproducible after #7088, on current rpi-6.18.y (4bb2406) and rpi-6.12.y
(9c40c75). fb_logo.c is identical on both. Tested on a Pi 4B (8 GB) with the stock 6.18.34+rpt-rpi-v8 kernel.
The fullscreen path has two separate bugs (line numbers are from rpi-6.18.y):
Uninitialised struct fb_image when the file can't be used.fb_set_logo_from_file() returns
void. Every goto cleanup before line 401 (firmware not found, empty file, short header, unsupported TGA)
leaves image->data unset, and width/height/dx/dy/depth unset too. The caller's struct fb_image image;
(line 488) is uninitialised stack memory. It still reads image.data[0] (line 564) and calls fb_do_show_logo() (line 578). The two exits after line 401 ("TGA: Unexpected end of file" at 424 and the
palette allocation failure at 459) do set image->data, but that buffer is freed at cleanup and the
geometry is never set.
Use-after-free on success. After image->data = read_logo; (line 401), execution falls through to cleanup: kfree(read_logo); (lines 476–477). The caller then draws from the freed buffer. It only works
because the pages haven't been reused yet.
Reproduction on the stock kernel with loglevel=5 fullscreen_logo=1 fullscreen_logo_name=flyer-acilis.tga
(a 1920x1080, 24-bit, 223-colour TGA). Evidence comes from reading back the simplefb framebuffer
(0x3e402000, a8r8g8b8) after boot and comparing it with the TGA:
Case
Setup
Result
B
TGA on the root filesystem only, not in the initramfs
Oops at 0.82 s, then Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b. Trace: fb_show_logo_line.constprop.0+0x1b0/0x8a0 ← fb_show_logo+0x50 ← fbcon_switch ← redraw_screen ← do_bind_con_driver ← do_take_over_console ← do_fbcon_takeover ← fbcon_fb_registered ← register_framebuffer ← simplefb_probe ← … ← simplefb_driver_init ← kernel_init. The faulting instruction 39400004 is ldrb w4, [x0], the image.data[0] load. x13 holds the ASCII tga': -2 left over from the "Failed to load logo file" message.
A0
TGA in the initramfs
Boots. Framebuffer identical to the TGA (0 of 2,073,600 pixels differ).
A
A0 + init_on_free=1
Boots. Framebuffer is completely black (all 2,073,600 pixels are 0). The file was still loaded and parsed: simplefb registration took 95 ms (91 ms in A0).
The only difference between A0 and A is init_on_free=1. A black screen means the logo was drawn from the
freed and zeroed read_logo.
The patch below makes fb_set_logo_from_file() return an error, skips drawing on failure, and frees the
image data after fb_do_show_logo(). With it applied to the same tree:
With init_on_free=1, the logo is drawn correctly on both simplefb and vc4drmfb (0 differing pixels).
With a missing file, Failed to load logo file 'yok.tga': -2 is logged for simplefb and again for vc4,
nothing is drawn, and the system boots normally.
Two more things found by reading the code (not tested, and not covered by the patch):
fb_set_logo_from_file() replaces info->pseudo_palette with a kzalloc()ed palette that is never
restored or freed. The palette argument is passed by value, so the caller's kfree(palette) frees NULL.
That leaks 1 KiB per framebuffer, and the driver's own pseudo palette stays replaced.
A TGA header with width or height 0 makes kmalloc_array() return ZERO_SIZE_PTR, and image.data[0]
then faults.
I'll take this. I'm going to reproduce the missing file crash and the use-after-free on a bcm2711_defconfig build of rpi-6.18.y in QEMU with simplefb, then open a PR with the fix.
Thanks for the fix, and for catching the zero width/height case — kmalloc_array() returning ZERO_SIZE_PTR past the NULL check was not something I had spotted.
For anyone arriving here from a downstream tree: the fix is 64dae084 in rpi-6.18.y. We had been carrying a local patch for the uninitialised fb_image and the use-after-free; we are dropping it in favour of this one, since the upstream version also covers the zero-dimension case.
I will retest the missing-file path on a Pi 4B once we rebuild onto a tree that contains the commit.
Activity
6by9 commentedon Oct 13, 2025
The logo is loaded from /lib/firmware, so unless you have an initramfs that provides /lib/firmware then the kernel won't be able to display a logo.
Admittedly it sounds like the error handling if it can't find the logo file has issues, but AIUI your test case is fundamentally flawed.
JinShil commentedon Oct 13, 2025
Yes, that's the fundamental problem I'm trying to bring attention to with this issue.
However, why does the fullscreen splash image feature need to be dependent on initramfs? If the .tga file is in /lib/firmware, why can't it just read the file from there and display it?
pelwell commentedon Oct 13, 2025
It's probably a question of initialisation order. With a splash screen there is the desire to get it on the display as early as possible, but waiting for some USB mass storage device to enumerate in order for the rootfs to be loaded will clearly delay the presentation.
6by9 commentedon Oct 13, 2025
The logo is only loaded from the con_switch hook when fbcon initialises. If the logo isn't available at that point then it is too late.
This is reusing the mechanism that puts up the N raspberries with a larger logo.
I've found a couple of niggles with the handling, but actually the handling if the file isn't present seems to be reasonable.
Fixes are in #7088
6by9 commentedon Oct 21, 2025
#7088 is now merged. That seems fairly robust to me, so please retest.
6by9 commentedon Nov 19, 2025
@JinShil Are you happy to close?
JinShil commentedon Nov 19, 2025
@6by9 I'm sorry, but I haven't had an opportunity to retest this, as I've had to abandon this feature due to the fact that the bootloader does not support the display resolution (800x480) and timings I need. See raspberrypi/rpi-eeprom#479 Testing this is on my todo list, but I'm under tight deadlines at the moment and can't afford the resource spend to test a feature I can't use.
I was told by your applications team that a new bootloader would be released soon (~1 month) with the ability to specify additional timings, and I'm waiting for that to drop before I pick this up again.
flyeriNsomniac commentedon Sep 21, 2026
This is still reproducible after #7088, on current
rpi-6.18.y(4bb2406) andrpi-6.12.y(9c40c75).
fb_logo.cis identical on both. Tested on a Pi 4B (8 GB) with the stock6.18.34+rpt-rpi-v8kernel.The fullscreen path has two separate bugs (line numbers are from rpi-6.18.y):
struct fb_imagewhen the file can't be used.fb_set_logo_from_file()returnsvoid. Every
goto cleanupbefore line 401 (firmware not found, empty file, short header, unsupported TGA)leaves
image->dataunset, and width/height/dx/dy/depth unset too. The caller'sstruct fb_image image;(line 488) is uninitialised stack memory. It still reads
image.data[0](line 564) and callsfb_do_show_logo()(line 578). The two exits after line 401 ("TGA: Unexpected end of file" at 424 and thepalette allocation failure at 459) do set
image->data, but that buffer is freed at cleanup and thegeometry is never set.
image->data = read_logo;(line 401), execution falls through tocleanup: kfree(read_logo);(lines 476–477). The caller then draws from the freed buffer. It only worksbecause the pages haven't been reused yet.
Reproduction on the stock kernel with
loglevel=5 fullscreen_logo=1 fullscreen_logo_name=flyer-acilis.tga(a 1920x1080, 24-bit, 223-colour TGA). Evidence comes from reading back the simplefb framebuffer
(0x3e402000, a8r8g8b8) after boot and comparing it with the TGA:
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b. Trace:fb_show_logo_line.constprop.0+0x1b0/0x8a0←fb_show_logo+0x50←fbcon_switch←redraw_screen←do_bind_con_driver←do_take_over_console←do_fbcon_takeover←fbcon_fb_registered←register_framebuffer←simplefb_probe← … ←simplefb_driver_init←kernel_init. The faulting instruction39400004isldrb w4, [x0], theimage.data[0]load. x13 holds the ASCIItga': -2left over from the "Failed to load logo file" message.init_on_free=1The only difference between A0 and A is
init_on_free=1. A black screen means the logo was drawn from thefreed and zeroed
read_logo.The patch below makes
fb_set_logo_from_file()return an error, skips drawing on failure, and frees theimage data after
fb_do_show_logo(). With it applied to the same tree:init_on_free=1, the logo is drawn correctly on both simplefb and vc4drmfb (0 differing pixels).Failed to load logo file 'yok.tga': -2is logged for simplefb and again for vc4,nothing is drawn, and the system boots normally.
Two more things found by reading the code (not tested, and not covered by the patch):
fb_set_logo_from_file()replacesinfo->pseudo_palettewith akzalloc()ed palette that is neverrestored or freed. The
paletteargument is passed by value, so the caller'skfree(palette)frees NULL.That leaks 1 KiB per framebuffer, and the driver's own pseudo palette stays replaced.
kmalloc_array()returnZERO_SIZE_PTR, andimage.data[0]then faults.
awss1i commentedon Oct 17, 2026
I'll take this. I'm going to reproduce the missing file crash and the use-after-free on a bcm2711_defconfig build of rpi-6.18.y in QEMU with simplefb, then open a PR with the fix.
fbcon: Don't draw the fullscreen logo if it fails to load
flyeriNsomniac commentedon Oct 20, 2026
Thanks for the fix, and for catching the zero width/height case —
kmalloc_array()returningZERO_SIZE_PTRpast the NULL check was not something I had spotted.For anyone arriving here from a downstream tree: the fix is
64dae084inrpi-6.18.y. We had been carrying a local patch for the uninitialisedfb_imageand the use-after-free; we are dropping it in favour of this one, since the upstream version also covers the zero-dimension case.I will retest the missing-file path on a Pi 4B once we rebuild onto a tree that contains the commit.
fbcon: Don't draw the fullscreen logo if it fails to load
fbcon: Don't draw the fullscreen logo if it fails to load
fbcon: Don't draw the fullscreen logo if it fails to load
fbcon: Don't draw the fullscreen logo if it fails to load
fbcon: Don't draw the fullscreen logo if it fails to load