lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210720214438.GA704@amd>
Date:   Tue, 20 Jul 2021 23:44:38 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Xie Yongji <xieyongji@...edance.com>,
        Jason Wang <jasowang@...hat.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.4 175/188] virtio_console: Assure used length from
 device is limited

Hi!

> From: Xie Yongji <xieyongji@...edance.com>
> 
> [ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ]
> 
> The buf->len might come from an untrusted device. This
> ensures the value would not exceed the size of the buffer
> to avoid data corruption or loss.

Since we are not trusting the other side, do we need to use _nospec
variants to prevent speculation attacks?

Best regards,
								Pavel

> +++ b/drivers/char/virtio_console.c
> @@ -487,7 +487,7 @@ static struct port_buffer *get_inbuf(struct port *port)
>  
>  	buf = virtqueue_get_buf(port->in_vq, &len);
>  	if (buf) {
> -		buf->len = len;
> +		buf->len = min_t(size_t, len, buf->size);
>  		buf->offset = 0;
>  		port->stats.bytes_received += len;
>  	}
> @@ -1752,7 +1752,7 @@ static void control_work_handler(struct work_struct *work)
>  	while ((buf = virtqueue_get_buf(vq, &len))) {
>  		spin_unlock(&portdev->c_ivq_lock);
>  
> -		buf->len = len;
> +		buf->len = min_t(size_t, len, buf->size);
>  		buf->offset = 0;
>  
>  		handle_control_message(vq->vdev, portdev, buf);

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ