From: sashiko-bot@kernel.org
To: "Hui Peng" <benquike@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v3] vt: selection: Fix unsigned underflow and slab-out-of-bounds read in paste_selection()
Date: Sat, 19 Sep 2026 11:07:37 +0000 [thread overview]
Message-ID: <20260919110737.D6B111F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260919110041.3763078-1-benquike@gmail.com>
> In paste_selection(), the loop copies min_t(unsigned int,
> vc_sel.buf_len - pasted,tty->receive_room) bytes per iteration into
> tty_ldisc_receive_buf() and increments pasted += count.
>
> Because the selection mutex (vc_sel.lock) is dropped inside the loop
> Whenever the line discipline buffer fills up and paste_selection()
> sleeps on tty->write_wait, a concurrent TIOCLINUX (TIOCL_SETSEL) ioctl
> can replace vc_sel.buffer with a shorter selection and reduce
> vc_sel.buf_len below pasted.
>
> When paste_selection() resumes, vc_sel.buf_len - pasted underflows as an
> unsigned integer to a large positive value, causing
> tty_ldisc_receive_buf(ld, vc_sel.buffer + pasted, NULL, count) to read
> up to 4094 bytes out-of-bounds past the newly allocated vc_sel.buffer.
>
> [ ... ]
> ==================================================================
>
> Fixes: e8c75a30a23c ("vt: selection, push sel_lock up")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919110041.3763078-1-benquike@gmail.com?part=1
prev parent reply other threads:[~2026-09-19 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <aq5hK-fxgPUCe4cr@hovoldconsulting.com>
2026-09-19 11:00 ` [PATCH v3] vt: selection: Fix unsigned underflow and slab-out-of-bounds read in paste_selection() Hui Peng
2026-09-19 11:07 ` sashiko-bot [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=20260919110737.D6B111F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=benquike@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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