Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: "Jiacheng Xu" <stitch@zju.edu.cn>
To: "Helge Deller" <deller@gmx.de>
Cc: "Thomas Zimmermann" <tzimmermann@suse.de>,
	"Simona Vetter" <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org
Subject: [BUG] fbcon rotate causes vmalloc out-of-bounds write after vc_resize failure
Date: Tue, 25 Aug 2026 17:01:35 +0800 (GMT+08:00)	[thread overview]
Message-ID: <3394ce6f.1a32a.1a038275127.Coremail.stitch@zju.edu.cn> (raw)

Execution environment:

- Kernel: Linux commit 0f23d56f
- Architecture: x86_64
- QEMU: KVM-enabled qemu-system-x86_64
- Guest image: Debian Bullseye
- KASAN and fault injection enabled


The kernel was started with:

qemu-system-x86_64 \
    -m 2G \
    -smp 2 \
    -kernel ./bzImage \
    -append "console=ttyS0 root=/dev/sda earlyprintk=serial net.ifnames=0" \
    -drive file=./bullseye.img,format=raw \
    -net user,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10021-:22 \
    -net nic,model=e1000 \
    -enable-kvm \
    -nographic \
    -pidfile vm.pid \
    2>&1 | tee vm.log


Trigger condition:

1. Write to `/sys/class/graphics/fbcon/rotate` to initialize the attribute.
2. Set the current thread's fault-injection counter to 13 through
    `/proc/thread-self/fail-nth`.
3. Request rotation value 1 through the same `rotate` attribute.

The injected failure occurs during memory allocation in vc_do_resize(). The subsequent redraw path reaches sys_imageblit() and reports a KASAN vmalloc out-of-bounds write.


Potential root cause:

fbcon_modechanged() switches to the new rotation and blitting operations before resizing the virtual console. When vc_resize() fails, its
return value is ignored and update_screen() still runs.

As a result, the VT geometry and screen buffer remain in the old state while the framebuffer console uses the new rotation state.
sys_imageblit() then calculates an invalid framebuffer address and performs an out-of-bounds write.

Best,
Jiacheng


                 reply	other threads:[~2026-08-25  9:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3394ce6f.1a32a.1a038275127.Coremail.stitch@zju.edu.cn \
    --to=stitch@zju.edu.cn \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox