LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Jiri Slaby <jslaby@suse.com>
To: Nicolas Pitre <nico@fluxnic.net>,
	Or Cohen <orcohen@paloaltonetworks.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	textshell@uchuujin.de, Daniel Vetter <daniel.vetter@ffwll.ch>,
	sam@ravnborg.org, mpatocka@redhat.com, ghalat@redhat.com,
	linux-kernel@vger.kernel.org, jwilk@jwilk.net,
	Nadav Markus <nmarkus@paloaltonetworks.com>,
	syzkaller@googlegroups.com
Subject: Re: Bug report - slab-out-of-bounds in vcs_scr_readw
Date: Tue, 5 Nov 2019 07:54:21 +0100
Message-ID: <c30fc539-68a8-65d7-226c-6f8e6fd8bdfb@suse.com> (raw)
In-Reply-To: <nycvar.YSQ.7.76.1911041928030.30289@knanqh.ubzr>

On 04. 11. 19, 19:33, Nicolas Pitre wrote:
> On Mon, 4 Nov 2019, Or Cohen wrote:
> 
>> @gregkh@linuxfoundation.org @nico@fluxnic.net  - Thanks for the quick response.
>> @gregkh@linuxfoundation.org  - Regarding your question, I don't think
>> the 1 byte buffer is related to the problem. (  it's just was there in
>> the initial reproducer the fuzzer created, and I forgot to remove it
>> while reducing code from the reproducer ).
> 
> I think I know what the problem is. I have no time to test it though.
> 
> Please try this (untested) patch. Also please try running the same test 
> code but with vcsa6 in addition to vcsu6 to be sure.
> 
> ---------- >8
> Subject: [PATCH] vcs: add missing validation on vcs_size() returned value
> 
> One usage instance didn't account for the fact that vcs_size() may
> return a negative error code.
> 
> Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
> 
> diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> index 1f042346e7..fa07d79027 100644
> --- a/drivers/tty/vt/vc_screen.c
> +++ b/drivers/tty/vt/vc_screen.c
> @@ -474,6 +474,10 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
>  		goto unlock_out;
>  
>  	size = vcs_size(inode);
> +	if (size < 0) {
> +		ret = size;
> +		goto unlock_out;
> +	}
>  	ret = -EINVAL;
>  	if (pos < 0 || pos > size)
>  		goto unlock_out;

pos must be >= 0, so "pos > size" would catch this case as a side
effect, or am I missing something? That being said, the patch is
correct, but won't fix the issue IMO.

thanks,
-- 
js
suse labs

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAM6JnLeEnvjjQPyLeh+8dt5wGNud_vks5k_eXJZy2T1H7ao=hQ@mail.gmail.com>
2019-11-04 15:24 ` Greg KH
2019-11-04 15:50   ` Nicolas Pitre
2019-11-04 16:15     ` Or Cohen
2019-11-04 18:33       ` Nicolas Pitre
2019-11-05  6:54         ` Jiri Slaby [this message]
2019-11-05  9:03           ` Or Cohen
2019-11-05  9:14             ` Jiri Slaby
2019-11-05  9:33               ` Nicolas Pitre
2019-11-05 10:29                 ` Jiri Slaby
2019-11-05 10:53                   ` Dmitry Vyukov
2019-11-05 13:44                   ` Nicolas Pitre
2019-11-06 17:01                     ` Or Cohen
2019-11-26 21:55                 ` Nicolas Pitre
2019-11-27  6:45                   ` Greg KH
2019-11-27 16:24                     ` Nicolas Pitre
2019-11-27 16:30                       ` Greg KH

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=c30fc539-68a8-65d7-226c-6f8e6fd8bdfb@suse.com \
    --to=jslaby@suse.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=ghalat@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jwilk@jwilk.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=nico@fluxnic.net \
    --cc=nmarkus@paloaltonetworks.com \
    --cc=orcohen@paloaltonetworks.com \
    --cc=sam@ravnborg.org \
    --cc=syzkaller@googlegroups.com \
    --cc=textshell@uchuujin.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git