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:   Fri, 22 Oct 2021 11:38:27 +0800
From:   He Ying <heying24@...wei.com>
To:     <davidcomponentone@...il.com>, <keescook@...omium.org>
CC:     <arnd@...db.de>, <gregkh@...uxfoundation.org>,
        <linux-kernel@...r.kernel.org>,
        Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH lkdtm] lkdtm: Fix reference preceded by free


在 2021/10/22 9:28, davidcomponentone@...il.com 写道:
> From: Yang Guang <yang.guang5@....com.cn>
>
> The coccinelle check report:
> ./drivers/misc/lkdtm/heap.c:115:7-11:
> ERROR: reference preceded by free on line 112
> Moving the "kfree(base)" after using place to fix it.

Look at the name of the function "lkdtm_READ_AFTER_FREE". It's meant to

use after free to test something.

>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Yang Guang <yang.guang5@....com.cn>
> ---
>   drivers/misc/lkdtm/heap.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
> index 8a92f5a800fa..4c6341e7bdca 100644
> --- a/drivers/misc/lkdtm/heap.c
> +++ b/drivers/misc/lkdtm/heap.c
> @@ -109,8 +109,6 @@ void lkdtm_READ_AFTER_FREE(void)
>   	base[offset] = *val;
>   	pr_info("Value in memory before free: %x\n", base[offset]);
>   
> -	kfree(base);
> -
>   	pr_info("Attempting bad read from freed memory\n");
>   	saw = base[offset];
>   	if (saw != *val) {
> @@ -121,6 +119,7 @@ void lkdtm_READ_AFTER_FREE(void)
>   		pr_expected_config_param(CONFIG_INIT_ON_FREE_DEFAULT_ON, "init_on_free");
>   	}
>   
> +	kfree(base);
>   	kfree(val);
>   }
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ