Linux Media Controller development
 help / color / mirror / Atom feed
From: syzbot <syzbot+09b54b89ef0ae7af3c2b@syzkaller.appspotmail.com>
To: arnd@arndb.de, hans.verkuil@cisco.com, hverkuil+cisco@kernel.org,
	 linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	mchehab@kernel.org,  mchehab@osg.samsung.com,
	syzkaller-bugs@googlegroups.com
Subject: [syzbot] [media?] KASAN: vmalloc-out-of-bounds Write in tpg_fill_plane_extras
Date: Mon, 30 Nov 2026 01:54:51 -0800	[thread overview]
Message-ID: <6b0d47eb.218a765f.b2f5d.0216.GAE@google.com> (raw)

Hello,

syzbot found the following issue on:

HEAD commit:    fe6ff8d5d675 Linux 7.4-rc5
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=15e3c3bd580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d07b2352498f5906
dashboard link: https://syzkaller.appspot.com/bug?extid=09b54b89ef0ae7af3c2b
compiler:       Debian clang version 22.1.8 (1~deb13u5), Debian LLD 22.1.8
userspace arch: i386
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=155d6ce9580000

The issue was bisected by AI to:

commit 9991deff1ac9361abbe0c5938b27f903f16d1ca0
Author: Hans Verkuil <hans.verkuil@cisco.com>
Date:   Sun Mar 8 08:53:10 2015 +0000

    [media] vivid-tpg: add helper functions to simplify common calculations

reasoning:      https://syzkaller.appspot.com/ai_job?id=67113508-6669-42b6-891d-a89e28beedfb

AI-generated root cause summary:
In `tpg_fill_plane_extras()` (`drivers/media/common/v4l2-tpg/v4l2-tpg-core.c`),
when `tpg->insert_eav` is enabled, the function unconditionally writes a 4-byte
EAV sequence (`p[0..3]`) at `vbuf + tpg_hdiv(tpg, p, tpg->compose.width * 2 /
3)` without verifying that `offset + 4 <= params->img_width`. For planar YUV
formats with horizontal subsampling (`hdownsampling[p] == 2`, `twopixelsize[p]
== 2`, such as `YUV420` or `YUV422P` chroma planes) and a small `compose.width`
allowed by `vivid` (`16` or `18`, where `MIN_WIDTH == 16`), `params->img_width`
is 8 or 9 bytes while `offset` is 5 or 6 bytes, causing `p[3]` at line 2441 to
write 1 byte past `params->img_width`. When the compose rectangle reaches the
bottom-right edge of the buffer on the final plane, `vbuf + params->img_width`
coincides with the end of the `vmalloc_user()` buffer, producing a 1-byte
vmalloc out-of-bounds write.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=09b54b89ef0ae7af3c2b

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+09b54b89ef0ae7af3c2b@syzkaller.appspotmail.com

The bisection result may be wrong.
If you agree with it, please also add:
Fixes: 9991deff1ac9 ("[media] vivid-tpg: add helper functions to simplify common calculations")

==================================================================
BUG: KASAN: vmalloc-out-of-bounds in tpg_fill_plane_extras+0x1883/0x2580 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2441
Write of size 1 at addr ffffc9000374b000 by task vivid-000-vid-c/5961

CPU: 1 UID: 0 PID: 5961 Comm: vivid-000-vid-c Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 tpg_fill_plane_extras+0x1883/0x2580 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2441
 tpg_fill_plane_buffer+0x1230/0x22b0 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2709
 vivid_fillbuff drivers/media/test-drivers/vivid/vivid-kthread-cap.c:470 [inline]
 vivid_thread_vid_cap_tick+0x115c/0x6340 drivers/media/test-drivers/vivid/vivid-kthread-cap.c:629
 vivid_thread_vid_cap+0x922/0x11d0 drivers/media/test-drivers/vivid/vivid-kthread-cap.c:767
 kthread+0x38b/0x480 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

The buggy address belongs to a 18-page vmalloc region starting at 0xffffc90003739000 allocated at vb2_vmalloc_alloc+0xef/0x360 drivers/media/common/videobuf2/videobuf2-vmalloc.c:47
Memory state around the buggy address:
 ffffc9000374af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc9000374af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc9000374b000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                   ^
 ffffc9000374b080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc9000374b100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#ai-bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

                 reply	other threads:[~2026-11-30  9:54 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=6b0d47eb.218a765f.b2f5d.0216.GAE@google.com \
    --to=syzbot+09b54b89ef0ae7af3c2b@syzkaller.appspotmail.com \
    --cc=arnd@arndb.de \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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