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] [day] [month] [year] [list]
Message-ID: <202201181035.2CF27A0262@keescook>
Date:   Tue, 18 Jan 2022 10:35:33 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Stefan Berger <stefanb@...ux.ibm.com>
Cc:     Peter Huewe <peterhuewe@....de>,
        Jarkko Sakkinen <jarkko@...nel.org>,
        Jason Gunthorpe <jgg@...pe.ca>,
        linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] tpm: vtpm_proxy: Avoid device-originated buffer overflow

On Thu, Jan 13, 2022 at 04:19:32PM -0500, Stefan Berger wrote:
> I just want to clarify this. In vtpm_proxy_tpm_op_send() we have the only
> place that sets req_len to a value larger than 0:
> 
> static int vtpm_proxy_tpm_op_send(struct tpm_chip *chip, u8 *buf, size_t
> count)
> {
>     struct proxy_dev *proxy_dev = dev_get_drvdata(&chip->dev);
> 
>     if (count > sizeof(proxy_dev->buffer)) {
>         dev_err(&chip->dev,
>             "Invalid size in send: count=%zd, buffer size=%zd\n",
>             count, sizeof(proxy_dev->buffer));
>         return -EIO;
>     }
> 
> [...]
> 
>     proxy_dev->req_len = count;
>     memcpy(proxy_dev->buffer, buf, count);
> 
> [...]
> 
> }
> 
> 
> The above makes sure that we cannot copy more bytes into the
> proxy_dev->buffer than the what the buffer has bytes for.
> 
> It then sets req_len to a valid value that is less or equal to the buffer
> size.
> 
> Considering this your check above seems to only be there to make the
> compiler happy but otherwise I don't see that this is a real problem with a
> buffer overflow?!
> 
> Nevertheless, let all those compilers be happy:
> 
> Reviewed-by: Stefan Berger <stefanb@...ux.ibm.com>

Ah yes, thanks! I'll reword the commit log for v2. :)

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ