From: Jiri Slaby <jirislaby@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tty: vt: initialize unicode screen buffer
Date: Tue, 19 Jul 2022 08:03:26 +0200 [thread overview]
Message-ID: <7026ec81-fa6e-a470-cd10-9894050e7f0d@kernel.org> (raw)
In-Reply-To: <4ef053cf-e796-fb5e-58b7-3ae58242a4ad@I-love.SAKURA.ne.jp>
On 19. 07. 22, 7:49, Tetsuo Handa wrote:
> syzbot reports kernel infoleak at vcs_read() [1], for buffer can be read
> immediately after resize operation. Initialize buffer using kzalloc().
>
> ----------
> #include <fcntl.h>
> #include <unistd.h>
> #include <sys/ioctl.h>
> #include <linux/fb.h>
>
> int main(int argc, char *argv[])
> {
> struct fb_var_screeninfo var = { };
> const int fb_fd = open("/dev/fb0", 3);
> ioctl(fb_fd, FBIOGET_VSCREENINFO, &var);
> var.yres = 0x21;
> ioctl(fb_fd, FBIOPUT_VSCREENINFO, &var);
> return read(open("/dev/vcsu", O_RDONLY), &var, sizeof(var)) == -1;
> }
> ----------
>
> Link: https://syzkaller.appspot.com/bug?extid=31a641689d43387f05d3 [1]
> Reported-by: syzbot <syzbot+31a641689d43387f05d3@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Yes, it makes sense.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
> ---
> drivers/tty/vt/vt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index f8c87c4d7399..6968517d6f8b 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -344,7 +344,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows)
> /* allocate everything in one go */
> memsize = cols * rows * sizeof(char32_t);
> memsize += rows * sizeof(char32_t *);
> - p = vmalloc(memsize);
> + p = vzalloc(memsize);
> if (!p)
> return NULL;
>
thanks,
--
js
suse labs
prev parent reply other threads:[~2022-07-19 6:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 15:25 KMSAN: kernel-infoleak in vcs_read (2) syzbot
2020-09-06 4:04 ` syzbot
2022-07-19 5:49 ` [PATCH] tty: vt: initialize unicode screen buffer Tetsuo Handa
2022-07-19 6:03 ` Jiri Slaby [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=7026ec81-fa6e-a470-cd10-9894050e7f0d@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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
Powered by JetHome