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: <754bde27-df3b-d98e-2ca8-5b16ccdc5345@telliq.com>
Date:   Tue, 15 Jun 2021 16:35:52 +0200
From:   Jan Kardell <jan.kardell@...liq.com>
To:     Linux ARM <linux-arm-kernel@...ts.infradead.org>
Cc:     linux-kernel@...r.kernel.org, Russell King <linux@...linux.org.uk>,
        linux-omap@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org
Subject: Re: [PATCH] arm: Define arch_is_kernel_initmem_freed() for lockdep

A ping on this as there is no reply yet. I'm not entirely sure who 
should be on the CC list, or maybe this patch is just forgotten for some 
reason, maybe I should have written a better subject? I don't mean to 
complain, I do know that core developers are very busy!

//Jan

Jan Kardell skrev:
> This fixes the warning:
>
> WARNING: CPU: 0 PID: 1994 at kernel/locking/lockdep.c:1119 alloc_netdev_mqs+0xb4/0x3b0
>
> This warning is because the check in static_obj() assumes that all
> memory within [_stext, _end] belongs to static objects. The init
> section is also part of this range, and freeing it allows the buddy
> allocator to allocate memory from it.
>
> To fix this, define arch_is_kernel_initmem_freed() for arm, it will
> return 1 if initmem has been freed and the address is in the range
> [__init_begin, __init_end], and this function is called by the
> static_obj() function in lockdep.
>
> Tested on TI am3352 (Cortex A8).
>
> This change is modelled after commit 7a5da02de8d6eafba995
> ("locking/lockdep: check for freed initmem in static_obj()") for s390 by
> Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
>
> Signed-off-by: Jan Kardell <jan.kardell@...liq.com>
> ---
>   arch/arm/include/asm/sections.h | 13 +++++++++++++
>   arch/arm/mm/init.c              |  6 +++++-
>   2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h
> index 700b8bcdf9bd..1dd64c90c1ac 100644
> --- a/arch/arm/include/asm/sections.h
> +++ b/arch/arm/include/asm/sections.h
> @@ -2,6 +2,8 @@
>   #ifndef _ASM_ARM_SECTIONS_H
>   #define _ASM_ARM_SECTIONS_H
>   
> +#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
> +
>   #include <asm-generic/sections.h>
>   
>   extern char _exiprom[];
> @@ -11,6 +13,17 @@ extern char __idmap_text_end[];
>   extern char __entry_text_start[];
>   extern char __entry_text_end[];
>   
> +extern bool initmem_freed;
> +
> +static inline int arch_is_kernel_initmem_freed(unsigned long addr)
> +{
> +	if (!initmem_freed)
> +		return 0;
> +	return addr >= (unsigned long)__init_begin &&
> +	       addr < (unsigned long)__init_end;
> +}
> +
> +
>   static inline bool in_entry_text(unsigned long addr)
>   {
>   	return memory_contains(__entry_text_start, __entry_text_end,
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index 828a2561b229..cd7a4273797a 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -41,6 +41,8 @@
>   
>   #include "mm.h"
>   
> +bool initmem_freed;
> +
>   #ifdef CONFIG_CPU_CP15_MMU
>   unsigned long __init __clear_cr(unsigned long mask)
>   {
> @@ -523,8 +525,10 @@ void free_initmem(void)
>   	fix_kernmem_perms();
>   
>   	poison_init_mem(__init_begin, __init_end - __init_begin);
> -	if (!machine_is_integrator() && !machine_is_cintegrator())
> +	if (!machine_is_integrator() && !machine_is_cintegrator()) {
> +		initmem_freed = true;
>   		free_initmem_default(-1);
> +	}
>   }
>   
>   #ifdef CONFIG_BLK_DEV_INITRD

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ