From: "Cen Zhang (Microsoft)" <blbllhy@gmail.com>
To: mchehab+huawei@kernel.org
Cc: AutonomousCodeSecurity@microsoft.com, axboe@kernel.dk,
blbllhy@gmail.com, hverkuil@kernel.org, kees@kernel.org,
kys@microsoft.com, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, mchehab@kernel.org,
rongqianfeng@vivo.com, tgopinath@linux.microsoft.com
Subject: Re: [PATCH] media: dvb-core: add upper bound check in DMX_SET_BUFFER_SIZE ioctl
Date: Thu, 30 Jul 2026 23:14:34 -0400 [thread overview]
Message-ID: <20260731031434.174630-1-blbllhy@gmail.com> (raw)
In-Reply-To: <20260729084431.30e0fee8@foz.lan>
Hi Mauro,
> Forgot to mention, but instead of returning -EINVAL, probably the best
> would be to setup the ringbuffer size to the maximum value, as
> otherwise this would break existing apps.
Thanks for pointing this out. I will revise this in v3.
> Having a limit is good, but why 64MB?
>
> Btw, what apps did you use to test it? Had you check what's the current
> limit on what apps?
I chose 64 MiB as a conservative upper bound based on a brief source
survey of DVB applications:
- The kernel DVR buffer defaults to approximately 1.84 MiB. In the
upstream revisions I checked, TVheadend, MythTV and MuMuDVB do not
actively call DMX_SET_BUFFER_SIZE and therefore retain this default:
https://github.com/torvalds/linux/blob/acb7500801e98639f6d8c2d796ed9f64cba83d3a/include/media/dmxdev.h#L189
- SATPI allows approximately 30 MiB:
https://github.com/Barracuda09/SATPI/blob/09df7402870b1dff2c7b2d7f4a085002a333045f/src/input/dvb/Frontend.cpp#L57
- DVBlast defaults to approximately 7.34 MiB:
https://github.com/videolan/dvblast/blob/ae6b24ae8cdf6eaa1ada8534a257258f3c906a77/dvb.c#L71
- dvbv5-zap uses approximately 5.88 MiB:
https://github.com/gjasny/v4l-utils/blob/95ad25f6a77a0a6650f5f657ac2c5046efcd04a0/utils/dvb/dvbv5-zap.c#L32
- minisatip defaults to approximately 5.51 MiB:
https://github.com/catalinii/minisatip/blob/d20136e23d47bd7f5de2967b34463f14bce6f988/src/adapter.h#L12
I have limited experience with DVB hardware and production workloads.
Do you have a recommended limit based on known hardware or application
requirements? I am happy to use the value you recommend in v3.
> Can you provide me more details about the test scenario: e.g. with
> what TV standards had you test it, and such.
The reproducer used the vidtv virtual DVB adapter
(dvb-vidtv-bridge) in a QEMU VM with approximately 3 GiB of RAM. The
root-only setup loaded the driver, made dvr0 accessible and set
oom_score_adj=-1000 for the process lineage to make the panic
deterministic. The ioctl itself was issued by an unprivileged process.
The test did not exercise a particular TV standard or transport stream,
since the failure occurs directly in the buffer-allocation ioctl path
before stream processing. I have not tested this on physical DVB
hardware.
I can share the reproducer package privately if that would be useful.
Best regards,
Cen
prev parent reply other threads:[~2026-07-31 3:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 19:37 [PATCH] media: dvb-core: add upper bound check in DMX_SET_BUFFER_SIZE ioctl Cen Zhang (Microsoft)
2026-07-29 6:30 ` Mauro Carvalho Chehab
2026-07-29 6:44 ` Mauro Carvalho Chehab
2026-07-31 3:14 ` Cen Zhang (Microsoft) [this message]
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=20260731031434.174630-1-blbllhy@gmail.com \
--to=blbllhy@gmail.com \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=axboe@kernel.dk \
--cc=hverkuil@kernel.org \
--cc=kees@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=mchehab@kernel.org \
--cc=rongqianfeng@vivo.com \
--cc=tgopinath@linux.microsoft.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