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]
Date:   Thu, 26 Aug 2021 15:57:11 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Mark Gross <mgross@...ux.intel.com>,
        Mario Limonciello <mario.limonciello@...l.com>,
        Pali Rohár <pali@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Dell.Client.Kernel@...l.com, platform-driver-x86@...r.kernel.org,
        Andy Lavr <andy.lavr@...il.com>, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH][RFC] platform/x86: dell-smbios-wmi: Avoid false-positive
 memcpy() warning

Hi,

On 8/25/21 6:07 PM, Kees Cook wrote:
> In preparation for FORTIFY_SOURCE performing compile-time and run-time
> field bounds checking for memcpy(), memmove(), and memset(), avoid
> intentionally writing across neighboring fields.
> 
> Since all the size checking has already happened, use input.pointer
> (void *) so memcpy() doesn't get confused about how much is being
> written.
> 
> Avoids this false-positive warning when run-time memcpy() strict
> bounds checking is enabled:
> 
> memcpy: detected field-spanning write (size 4096) of single field (size 36)
> WARNING: CPU: 0 PID: 357 at drivers/platform/x86/dell/dell-smbios-wmi.c:74 run_smbios_call+0x110/0x1e0 [dell_smbios]
> 
> Note: is there a missed kfree() in the marked error path?
> 
> Cc: Hans de Goede <hdegoede@...hat.com>
> Cc: Mark Gross <mgross@...ux.intel.com>
> Cc: Mario Limonciello <mario.limonciello@...l.com>
> Cc: "Pali Rohár" <pali@...nel.org>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: "Uwe Kleine-König" <u.kleine-koenig@...gutronix.de>
> Cc: Dell.Client.Kernel@...l.com
> Cc: platform-driver-x86@...r.kernel.org
> Reported-by: Andy Lavr <andy.lavr@...il.com>
> Signed-off-by: Kees Cook <keescook@...omium.org>

Thank you, I've applied the patch, minus the:

/* output.pointer memory allocation leak? */

Comment, instead I'll submit (and also apply right-away)
a patch to add the missing kfree()

Regards,

Hans


	
> ---
>  drivers/platform/x86/dell/dell-smbios-wmi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
> index 33f823772733..c410d6d920b8 100644
> --- a/drivers/platform/x86/dell/dell-smbios-wmi.c
> +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
> @@ -69,9 +69,10 @@ static int run_smbios_call(struct wmi_device *wdev)
>  		if (obj->type == ACPI_TYPE_INTEGER)
>  			dev_dbg(&wdev->dev, "SMBIOS call failed: %llu\n",
>  				obj->integer.value);
> +		/* output.pointer memory allocation leak? */
>  		return -EIO;
>  	}
> -	memcpy(&priv->buf->std, obj->buffer.pointer, obj->buffer.length);
> +	memcpy(input.pointer, obj->buffer.pointer, obj->buffer.length);
>  	dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n",
>  		priv->buf->std.output[0], priv->buf->std.output[1],
>  		priv->buf->std.output[2], priv->buf->std.output[3]);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ